Showing results for 
Search instead for 
Did you mean: 

Select part in tree

Valued Contributor
Valued Contributor



So I have just installed ST10 and was using the new Open drawing command,

I have been using my own macro to open the drawing from a part or assembly file for some time.

In my macro if the draft is not found it automatically runs the create a new draft command to save a bit of effort.


I now also see that the new built in command uses the windows indexed links ( I think) so it fails to find the draft all of the time.  So going to continue to use my own.

However  the built in command does something I likeSmiley Happy , i can open the draft by just selecting the file in the tree... and not just the active document.


So I am trying to update my own!  

and here I run into an issue


If the part is in the top level assembly i can find it with:-




but if its in a sub assembly i need to use :-




and using the wrong one fails so I cannot seem to test for isnothing.


Using the excellent spy i can see;






 a crude way of testing..  it runs if I comment out the wrong "test" line.


 I was using the OccurrenceFileName for testing but will prefer to use the OccurrenceDocument reference

for .path and .Fullname etc


 The question is how should I be finding the filename / path from the selected item.


Sorry that seemed harder to explain than necessary.


Thanks for your help 

Regards Kevin





Re: Select part in tree

if objApp.ActiveSelectSet.Item(1).Type = igReference then

Re: Select part in tree

Valued Contributor
Valued Contributor
Thank you so much for your help Gerald , that worked a treat.

Regards Kevin