Skip to content

Commit

Permalink
fixed issue wth BND_UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
fraguada committed Feb 6, 2025
1 parent f92d5a1 commit 6e3f378
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ BND_TUPLE NullTuple()
{
#if defined(ON_PYTHON_COMPILE)
#if defined(NANOBIND)
UNIMPLEMENTED_EXCEPTION;
return py::tuple();
#else
return py::none();
#endif
Expand Down
3 changes: 1 addition & 2 deletions src/bindings/bnd_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ BND_TUPLE BND_InstanceDefinitionGeometry::GetObjectIds() const
return rc;
}

//TODO: This function is not working properly due to issues casting from BND_UUID
std::vector<BND_UUID> BND_InstanceDefinitionGeometry::GetObjectIds2() const
{
const ON_SimpleArray<ON_UUID>& list = m_idef->InstanceGeometryIdList();
int count = list.Count();
std::vector<BND_UUID> rc(count);
std::vector<BND_UUID> rc;
for (int i = 0; i < count; i++)
rc.push_back(ON_UUID_to_Binding(list[i]));
return rc;
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/bnd_uuid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ON_UUID Binding_to_ON_UUID(const BND_UUID& id)
#if !defined(NANOBIND)
std::string s = py::str(id);
#else
std::string s = py::cast<std::string>(id);
std::string s = py::cast<std::string>(id.attr("hex"));
#endif
return ON_UuidFromString(s.c_str());
}
Expand Down
1 change: 0 additions & 1 deletion tests/python/test_File3dm_DimStyleTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import unittest

#objective: to test creating file with bitmaps
@unittest.skip("BAD CAST")
class TestFile3dmBitmapTable(unittest.TestCase):

def test_deleteDimStyle(self):
Expand Down
3 changes: 1 addition & 2 deletions tests/python/test_File3dm_LayerTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def test_createFileWithLayers(self):

self.assertTrue(qtyLayers == 2 and qtyLayers2 == 2)

#objective: to test creating file with layers and deleting a layer
@unittest.skip("BAD CAST")
#objective: to test creating file with layers and deleting a layer
def test_deleteLayer(self):
file3dm = rhino3dm.File3dm()
file3dm.ApplicationName = 'python'
Expand Down
1 change: 0 additions & 1 deletion tests/python/test_File3dm_MaterialTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#objective: to test creating file with bitmaps
class TestFile3dmMaterialTable(unittest.TestCase):

@unittest.skip("BAD CAST")
def test_deleteMaterial(self):
file3dm = rhino3dm.File3dm()
file3dm.ApplicationName = 'python'
Expand Down
3 changes: 1 addition & 2 deletions tests/python/test_File3dm_ObjectTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def test_negativeIndexing(self) -> None:
with self.subTest(msg="Test negative indexing"):
self.assertEqual(file_3dm.Objects[-2].Geometry.Location, rhino3dm.Point3d(0, 0, 0))

#@unittest.skip("BAD CAST")
def test_deleteObject(self):
file3dm = rhino3dm.File3dm()
file3dm.ApplicationName = 'python'
Expand All @@ -105,7 +104,7 @@ def test_deleteObject(self):

qtyObjects = len(file3dm.Objects)

file3dm.Objects.Delete(str(id1))
file3dm.Objects.Delete(id1)

qtyObjects2 = len(file3dm.Objects)

Expand Down
6 changes: 2 additions & 4 deletions tests/python/test_Instance.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import unittest
import rhino3dm
import uuid

#objective
class TestInstance(unittest.TestCase):

@unittest.skip("need to fix UUID interop")
def test_instanceGetObjectIDs(self):
file3dm = rhino3dm.File3dm.Read('../models/blocks.3dm')
instanceDefinition = file3dm.InstanceDefinitions[0]
ids = instanceDefinition.GetObjectIds2()
self.assertTrue(type(ids) == list)
self.assertTrue(type(ids[0]) == str)


self.assertTrue(type(ids[0]) == uuid.UUID)

if __name__ == '__main__':
print("running tests")
Expand Down

0 comments on commit 6e3f378

Please sign in to comment.