AnsweredAssumed Answered

Open A Part in an Assembly

Question asked by Alan Thomason on Apr 29, 2016
Latest reply on Apr 29, 2016 by Deepak Gupta

I am currently using the following syntax to open a part in an assembly...

 

Given:

Assembly name = Assembly.SLDASM

Component Name = Widget.SLDPRT

 

Dim bValue as boolean

bValue = Part.Extension.SelectByID2("Widget-1@Assembly, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)

Part.OpenCompFile

 

'Perform actions on part

swap.CloseDoc "Widget.SLDPRT"

 

Questions:

1. I don't like having to add the instance (the -1) to the part name to identify it.  Sometimes in an assembly the instance is -2 just because the part has been deleted and reinserted.  So, even if all the parts are unique there is no guarantee that they are all -1.  I wish there was a way to just select the first instance of that name or use a wildcard.

2. Is there a way to just close the file that is currently open, to avoid having to specify the filename.

 

Any other more elegant methods of selecting parts in an assembly would be helpful.

Outcomes