Open gggstamm opened 9 months ago
I can reproduce this with my own quick and dirty script.
Have you tested this in VB? pycatia doesn't do anything fancy here so I suspect the fault lies with CATIA V5?
So, I recorded a macro to see how CATIA does it in VB and converted that to pycatia. Interestingly this works:
caa = catia()
application = caa.application
document = application.active_document
product_document = document
component_node = Product(product_document.get_item('Product2').com_object)
products = Products(component_node.products.com_object)
sub_part = products.item('LL300010P-101.2')
sub_part.name = 'purple_monkey'
Been playing some more. The key here seems to be to use get_item
on the ProductDocument
to get the component node and not by getting the Products
collection from the top Product
.
I don't think this is a pycatia bug.
You are right : " The key here seems to be to use get_item" Then the difficulty is to know what is the name of the item we are looking for (when we come from add_components_from_files) It is really weird. In any case, look like it is not a bug on pycatia side, and your comments helped me to get around the issue. Thanks a lot for your reactivity
It's maybe bit hacky but I'm thinking you could maybe use your method to get the name of the instance and use that name with get_item()
.
It's definitely a bit weird. I'm hoping to have a look at this a bit more soon.
@gggstamm , Have you resolved your issue ?
@gggstamm , Have you resolved your issue ? @siddhu2310 I do not get your question; evereux gave a working python code with get_item. It is a bad workaround, but a working one!
Describe the bug when trying to change the "name" it is not taken into account if the Part is in a Component
To Reproduce Sample of code with snapshot
Expected behavior the cube instance name should be changed
Screenshots screenshot of the bad result given Cube.zip
Desktop (please complete the following information):
Additional context no