You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the execution gets in the line aDimObject = aDimAttr.GetObject() I get this error:
I have verified and compared the label_dim variable in both python and c++ :
python
c++
Do you have any ideas why I'm getting this error?
I suspect that the problem is coming from TDF_Label.FindAttribute method:
I think that for my case it's falling in the third case, and maybe the pybind11 wrapping of this method is not working properly because the generic type?
I'm attaching the c++ project and the step file used to test the reading. The main file is called TestOCCT.cpp
Thank you very much for the attention. Any insight on how to solve this issue or workaround will be highly appreciated! TestOCCPMI.zip
The text was updated successfully, but these errors were encountered:
GabrielJMS
changed the title
PMI annotations implementation (TDF_Label.FindAttribute from OCP not working properly)
PMI annotations reading (TDF_Label.FindAttribute from OCP not working properly)
Aug 14, 2024
The workaround was to reimplement the FindAttribute method in python using OCP
deffind_attribute(label, guid):
""" Reimplementation of the TDF_Label::FindAttribute method in Python. :param label: The label to search in. :type label: TDF_Label :param guid: The GUID of the attribute to find. :type guid: Standard_GUID :return: A tuple where the first element is a boolean indicating if the attribute was found, and the second element is the found attribute handle. :rtype: (bool, TDF_Attribute) """iflabel.IsNull():
raiseStandard_NullObject("A null Label has no attribute.")
itr=TDF_AttributeIterator(label)
whileitr.More():
attr=itr.Value()
ifattr.ID().IsSame(guid):
returnTrue, attritr.Next()
returnFalse, None
Does anyone have a suggestion for refactoring the C++ FindAttribute method to improve its compatibility with pybind11? Please let me know if you do, so I can propose a change to the OpenCASCADE project.
Hello,
I'm trying to implement the reading of PMI annotations (Geometrical Dimensions and tolerances) from a step file using OCP.
I have a C++ code that is working fine and that I have already tested:
In my C++ code, I have something like this:
So, I have translated into python:
When the execution gets in the line
aDimObject = aDimAttr.GetObject()
I get this error:I have verified and compared the label_dim variable in both python and c++ :
python
c++
Do you have any ideas why I'm getting this error?
I suspect that the problem is coming from TDF_Label.FindAttribute method:
I think that for my case it's falling in the third case, and maybe the pybind11 wrapping of this method is not working properly because the generic type?
I'm attaching the c++ project and the step file used to test the reading. The main file is called TestOCCT.cpp
Thank you very much for the attention. Any insight on how to solve this issue or workaround will be highly appreciated!
TestOCCPMI.zip
The text was updated successfully, but these errors were encountered: