Skip to content

Commit

Permalink
AddLine with attributes - add Python tests
Browse files Browse the repository at this point in the history
  • Loading branch information
StudioWEngineers committed Dec 20, 2024
1 parent 3884f01 commit 732ffff
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/python/test_File3dm_ObjectTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@

#objective: to test that passing a list of points or a Point3dList to the CreateControlPointCurve method returns the same curve
class TestFile3dmObjectTable(unittest.TestCase):
def test_addLine(self) -> None:
"""Tests for the `AddLine` method.
"""
file_3dm = rhino3dm.File3dm()

# create layers
file_3dm.Layers.AddLayer("layer1", (30, 144, 255, 255))
file_3dm.Layers.AddLayer("layer2", (255, 215, 0, 255))

# liness added without attributes are added to the current layer, i.e., the first
# layer added to the model
file_3dm.Objects.AddLine(rhino3dm.Point3d(0, 0, 0), rhino3dm.Point3d(1, 0, 0))
with self.subTest(msg="AddLine without attributes"):
self.assertEqual(file_3dm.Objects[0].Attributes.LayerIndex, 0)

# add line with attributes
obj_attr = rhino3dm.ObjectAttributes()
obj_attr.LayerIndex = 1
file_3dm.Objects.AddLine(rhino3dm.Point3d(1, 1, 0), rhino3dm.Point3d(1, 0, 0), obj_attr)
with self.subTest(msg="AddLine with attributes"):
self.assertEqual(file_3dm.Objects[1].Attributes.LayerIndex, 1)

def test_addPoint(self) -> None:
"""Tests for the `AddPoint` method.
"""
Expand Down

0 comments on commit 732ffff

Please sign in to comment.