Instance Name & number from selected part
Instance Name & number from selected part
(OP)
Hi,
I'm trying to get the instance name from a selected part but with no luck.
I cant find anything in the v5 automation file but found some code online.
I have asked this in another thread but I thought I would ask everyone as i'm stuck.
Set InstName = CATIA.ActiveDocument.Selection.Name.Value "dosent work"
&
Set InstName = sSel.Item(1).Value "This one returns the part name"
thanks
Alan
I'm trying to get the instance name from a selected part but with no luck.
I cant find anything in the v5 automation file but found some code online.
I have asked this in another thread but I thought I would ask everyone as i'm stuck.
Set InstName = CATIA.ActiveDocument.Selection.Name.Value "dosent work"
&
Set InstName = sSel.Item(1).Value "This one returns the part name"
thanks
Alan





RE: Instance Name & number from selected part
If you are in an assembly and you've selected a product from the tree, you'd have to use this:
CODE -->
You'd also need to learn basic VBA concept before attempting to script in CATIA (e.g. use 'set' to assign object to variables, not strings).
Calin
RE: Instance Name & number from selected part
Thanks for the reply but the code would show the part name not the instance name & number.
Do you know how to modify it to do so?
regards
Alan
RE: Instance Name & number from selected part
I am very sure that IF you are in an assembly (CATProduct), your active document is the CATProduct and you select an item from the tree, the code I provided would return the Instance Name not the Part Number.
Please see the attached image for details.
Calin
RE: Instance Name & number from selected part
Your quite right.
Thanks
Alan