Ilogic - code for checking model type at drawing

Ilogic - code for checking model type at drawing

Anonymous
Not applicable
623 Views
3 Replies
Message 1 of 4

Ilogic - code for checking model type at drawing

Anonymous
Not applicable

Hello

I want to use an Ilogic code to check if the drawing is created from a  part, weldment or assembly document.

After that I will use different parts list styles depending of document type.

 

I can't find a code that works for it.

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

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

Hello, try this rule in the drawing file

Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisDoc.Document

Dim oSheet As Sheet
oSheet = oDrawingDoc.ActiveSheet
For Each oSheet In oDrawingDoc.Sheets
	oViews = oSheet.DrawingViews
	Dim oView As DrawingView 
	For Each oView In oViews
		
		CentText = ThisApplication.TransientGeometry.CreatePoint2d(oView.Center.X , oView.Center.Y + oView.Height/2 + sFSize1*12)
		oView.Label.Position= CentText
		oView.Label.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextLeft	
		oView.ShowLabel = True

		oViewModelDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument
		
		If oViewModelDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then oView.Label.FormattedText = "ASSEMBLY"
		If oViewModelDoc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then oView.Label.FormattedText = "WELDMENT"
		If oViewModelDoc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Then oView.Label.FormattedText = "PART"
		If oViewModelDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then oView.Label.FormattedText = "SHEET METAL"

	Next	
Next

 I hope it's useful


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 3 of 4

goran.nilssonRSJCU
Participant
Participant

Thank you Sergio. It worked very well.

0 Likes
Message 4 of 4

Sergio.D.Suárez
Mentor
Mentor

I am glad that the rule has served you, please mark my answer as a solution to the problem, thank you very much


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes