-
-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XCAFDoc_Dimension.DownCast returned a result with an exception set #1336
Comments
Can you please post a code that can be run (add all the required imports, insert the example file as a zip archive) |
@tpaviot It is the whole code. from OCC.Core.Quantity import Quantity_Color, Quantity_TOC_RGB
from OCC.Core.STEPCAFControl import STEPCAFControl_Reader
from OCC.Core.Standard import Standard_Transient
from OCC.Core.TCollection import TCollection_ExtendedString
from OCC.Core.TDF import TDF_LabelSequence, TDF_Attribute
from OCC.Core.TDocStd import TDocStd_Document
from OCC.Core.XCAFDoc import XCAFDoc_DocumentTool_ColorTool, XCAFDoc_DocumentTool_ShapeTool
from OCC.Extend.TopologyUtils import TopologyExplorer
from OCC.Core.XCAFDoc import XCAFDoc_DocumentTool, XCAFDoc_Dimension
from OCC.Core.Geom import Geom_BSplineCurve
if __name__ == "__main__":
step_filename = r"C:\Users\agem\Desktop\aaapmi_stp.stp"# import a step with a dimension pmi
doc = TDocStd_Document("MDTV-CAF")
m_dimTolTool = XCAFDoc_DocumentTool.DimTolTool(doc.Main())
step_reader = STEPCAFControl_Reader()
step_reader.ReadFile(step_filename)
step_reader.SetColorMode(True)
step_reader.SetGDTMode(True)
step_reader.SetSHUOMode(True)
step_reader.SetMatMode(True)
step_reader.SetNameMode(True)
step_reader.SetLayerMode(True)
step_reader.SetPropsMode(True)
step_reader.SetViewMode(True)
step_reader.Transfer(doc)
root_labels = TDF_LabelSequence()
m_dimTolTool.GetDimensionLabels(root_labels)
if root_labels.Length() > 0:
for i in range(root_labels.Length()):
label = root_labels.Value(i + 1)
baseAttr = Standard_Transient()
aDimAttr = XCAFDoc_Dimension()
if label.HasAttribute():
label.FindAttribute(XCAFDoc_Dimension.GetID(), XCAFDoc_Dimension.DownCast(baseAttr)) # the error line. It is also wrong to ues Attribute.DownCast(baseAttr)
aobj = aDimAttr.GetObject() # in 7.5.1, could not get the object of attribute Output error message: SystemError: <built-in function Handle_XCAFDoc_Dimension_DownCast> returned a result with an exception set Their inheritance relationship is XCAFDoc_Dimension to TDF_Attribute to Standard_Transient |
insert the aaa_pmi step file, the same you're using |
attachFiles.zip |
ok, I think this comes from a missing wrapping method for FindAttribute https://github.com/Open-Cascade-SAS/OCCT/blob/master/src/TDF/TDF_Label.hxx#L147 |
Thanks, how can I update the local wrapping method? How can I build pythoocc from source code on windows platform. |
I think it's possible because TDF_Attribute No constructor defined
The text was updated successfully, but these errors were encountered: