Closed echeng22 closed 2 years ago
Confirmed, this is an OCP issue.
Also reported here: https://github.com/CadQuery/cadquery/issues/825
For now, the workaround would be to use OCP.TDF.TDF_AttributeIterator
and find the attribute by hand. This means essentially re-implementing FindAttribute
by hand.
Relevant pybind11 issues: https://github.com/pybind/pybind11/issues/1320 https://github.com/pybind/pybind11/issues/2751
Great! Thanks for the follow up and suggestion. I'll take a look through and see what I can do with it.
Something along those lines:
i = OCP.TDF.TDF_AttributeIterator(l)
v = i.Value()
while i.More():
i.Next()
...
Got it to work with this for name attribute specifically. Can be easily updated to search for other attributes as needed. Sharing this here in case it's of any help for other people.
def find_name(label: TDF.TDF_Label) -> TDataStd.TDataStd_Name:
label_it = TDF.TDF_AttributeIterator(label)
while label_it.More():
attr = label_it.Value()
if Standard.Standard_GUID.IsEqual_s(
attr.ID(), TDataStd.TDataStd_Name.GetID_s()
):
return attr
label_it.Next()
Thanks again for the help on this.
@a09418849 take a look at the workaround.
Hi, I'm running into an issue where the FindAttribute() function under TDF_Label does not update the TDF_Attribute handle passed to it. I've attached the script, and files in the zip file of an example.
Relevant snippet of the script:
The output of the script is attached below:
I would expect the
Attribute name
to returnSOLID
, based off what thetest_input.stp
andtest_input.xml
is showing for this label, but that doesn't seem to be the case here. Is there something that I'm missing to get the result I want?input_files.zip