pythonocc-core icon indicating copy to clipboard operation
pythonocc-core copied to clipboard

XCAFDoc_Dimension.DownCast returned a result with an exception set

Open aruig666 opened this issue 1 year ago • 6 comments

I think it's possible because TDF_Attribute No constructor defined

        doc = TDocStd_Document("MDTV-CAF")
        # self.doc = TDocStd_Document(TCollection_ExtendedString("pythonocc-doc"))
        m_dimTolTool = XCAFDoc_DocumentTool.DimTolTool(doc.Main())
        step_reader = STEPCAFControl_Reader()
        step_reader.ReadFile(step_filename)
        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))

微信图片_20240524151947

aruig666 avatar May 24 '24 07:05 aruig666