Skip to content

Commit

Permalink
AddPoint with attributes - add Python tests
Browse files Browse the repository at this point in the history
  • Loading branch information
StudioWEngineers committed Dec 16, 2024
1 parent 48e796f commit ddfb974
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_addPoint(self) -> None:
"""Tests for the `AddPoint` 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))

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

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

def test_addPolyline(self):

pointArray = []
Expand Down

0 comments on commit ddfb974

Please sign in to comment.