mirror of
https://github.com/gumyr/build123d.git
synced 2025-12-06 02:30:55 -08:00
Handling null TDF Label - Fix Issue #618
This commit is contained in:
parent
ad55863d30
commit
8a3ee82b5d
2 changed files with 14 additions and 1 deletions
|
|
@ -135,7 +135,7 @@ def _create_xde(to_export: Shape, unit: Unit = Unit.MM) -> TDocStd_Document:
|
|||
shape_tool.FindShape(sub_node, findInstance=False)
|
||||
for sub_node in sub_nodes
|
||||
]
|
||||
if node.label:
|
||||
if node.label and not node_label.IsNull():
|
||||
TDataStd_Name.Set_s(node_label, TCollection_ExtendedString(node.label))
|
||||
|
||||
if node.color is not None:
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import re
|
|||
import unittest
|
||||
from typing import Optional
|
||||
|
||||
from bd_warehouse.thread import TrapezoidalThread
|
||||
from build123d.build_common import GridLocations
|
||||
from build123d.build_enums import Unit
|
||||
from build123d.build_line import BuildLine
|
||||
|
|
@ -141,6 +142,18 @@ class TestExportStep(DirectApiTestCase):
|
|||
os.chmod("box_read_only.step", 0o777) # Make the file read/write
|
||||
os.remove("box_read_only.step")
|
||||
|
||||
def test_export_step_null_label(self):
|
||||
# Moving the object creates a null TDF_Label
|
||||
testobj = TrapezoidalThread(
|
||||
diameter=20,
|
||||
pitch=1.5,
|
||||
length=20,
|
||||
thread_angle=30.0,
|
||||
)
|
||||
testobj_moved = testobj.moved(Pos(0, 0, 10))
|
||||
self.assertTrue(export_step(testobj_moved, "test.step"))
|
||||
os.remove("test.step")
|
||||
|
||||
|
||||
class TestExportGltf(DirectApiTestCase):
|
||||
def test_export_gltf(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue