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 like , 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
Solved! Go to Solution.
@kevin_parker would you be so kind to post the updated Macro? (We're still on ST7).
Btw, does it matter what folder the files are saved in? We use a server to store the files, and the top level assembly is in a different folder than the subassemblies/parts.
Our drawings are, however, usually stored in the same folder as its assy/part.
I think I have attached the latest version I have.
I can attach the source code later if it helps, ( written in VB)
The macro expects that a file is open in SE.
it looks in the same directory as the part / assy for a dft used by the part or assy.
if one is not found it runs the create a draft from model command.
I only use one draft per part so it only looks for the first one it finds,
Hope it helps,
I still use it, as its more reliable than the one provided in ST9+
I have attached the original files,
I wrote this some time ago now in VB, so be gentle with the comments..
i used VB studio, the free version
I still use the app daily as it just works, for my needs.
When the exe is run with a file open it checks for any linked draft files and opens the first one,
if a draft file is not found it runs the create new draft command.
if a part is highlighted in an assembly then it opens the draft for the highlighted part.
Thank you for your reply and code.
The main issues were choosing the Occurrence in the assembly and the Occurrence in the sub-accessory included in the assembly.
Your code has been very helpful.
Thank you very much.