Not run script if a drawing is an assembly drawing

Not run script if a drawing is an assembly drawing

Gwennberg
Advocate Advocate
333 Views
2 Replies
Message 1 of 3

Not run script if a drawing is an assembly drawing

Gwennberg
Advocate
Advocate

Hi

How could I check if my drawing reference to an assembly? I have a script that makes pdf and stp-file but I do not want to make a stp-file in an assembly case.

BR/Goran

0 Likes
Accepted solutions (1)
334 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @Gwennberg.  The quickest and simplest way to check what type of model document is being represented by a drawing (assuming there is only one model), is to use something like this iLogic code:

oDrawingDoc = ThisDrawing.Document
oModel = ThisDrawing.ModelDocument
If oModel.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
	Exit Sub
End If
'the rest of your code here

Those lines will only work in iLogic, not in VBA.  There are also other ways to obtain referenced model documents from a drawing document, then check their type too, if needed.

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS :bulb: or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

Gwennberg
Advocate
Advocate

Thank you Crihfield

It worked out well.

BR/Goran

0 Likes