I have a windows form app that takes selected properties of the open draft and adds them to a database and also takes a PDF and puts it in a folder on the sever.
I’ve also written another app to put a 3D PDF from an open part/assembly and put that in a folder.
I now need to combine these so they both work from the app in draft, how would I get that app to open the base model and then run the code to 3d pdf it.
Im using VB by the way
Solved! Go to Solution.
Start with the draft file and you can get the models linked to it.
Then it would be a case of opening each model and creating a 3d pdf.
If you haven't already done so I would download Jason Newell's Spy for Solid Edge - will show you everything you need to know about Solid Edge files.
The link is on this pinned thread -
Useful Solid Edge Developer Community Links
Open a draft file and start Spy.
At the top you have Application
Expand that and you should then see Documents
Expand Documents and you will see Item(1)
Expand Item(1) and you will see ModelLinks, with the number of linked models in 
Click on ModelLinks and in the right pane you will see the Count property
Expand ModelLinks and again you will see a list of items - these are the models linked to the draft file.
We often detail several parts on one draft but if you use a one-draft-one-model approach you will only see Item(1)
Click on the item and again in the right pane you should now see FileName.
This is the path to open the model, then you can create the 3d pdf.
This same structure also appears under ActiveDocument - which is where you need to start if your program has the draft open.
Active Document > Model Links > Item(1) etc
I'm not enough of a regular programmer to write the code off the top of my head - maybe someone else can do that - but this should point you in the right direction.
Hi thats great thanks, I have that part working now.
I need it now to determine whether the model link file that is opened is a part file or assembly file,
how would I code that?
maybe something like IF SE.activedocument = SE.partdocument then?
am I thinking along the right lines?
The ActiveDocument is your draft document, so your IF condition would never be true.
You should check the ModelLink.ModelType property against ModelLinkTypeConstants.igPartLink or ModelLinkTypeConstants.igAssemblyLink to distinguish between both types.
I have set it to open the model link file so that then becomes the active document, then it detemines if its a part or assembly or is it better to check the type before it opens it?
Depends on the workflow of your macro, e.g whether to open the files differently or not for different types.
If you need to check BEFORE opening the document, then have a look at the ModelLink.ModelType property.
If you need to check AFTER opening the document, then look for the Application.ActiveDocumentType property.