List Model Parameter Values in Drawing

List Model Parameter Values in Drawing

Anonymous
Not applicable
800 Views
3 Replies
Message 1 of 4

List Model Parameter Values in Drawing

Anonymous
Not applicable

I want to create an iLogic rule in an active drawing that will list the options selected on the model. This is a layout of what I want to do:

delete previous notes

create note at location (18,20), font size .12, "Options Selected"

create note at location (18,19), font size .10

     if model parameter engine = ford

            "ford motor selected"

     else

            "kohler motor selected"

     end if

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

Anonymous
Not applicable

Update:

 

This is the code I have so far. Still struggling to assign text size and line spacing. It appears the text size is being driven by a percentage rather than the actual size. The line spacing is acting rather unpredictably.

 

I'm sure this isn't the best way to go about it.

 

SyntaxEditor Code Snippet

Sub Main()
	Call DeleteNote()
	Call AddNote()
End Sub

 Sub DeleteNote()
 	Dim invApp As Inventor.Application
	invApp = ThisApplication
	
	Dim oDrawDoc As Document
	oDrawDoc = invApp.ActiveEditDocument
		
	For Each oSheet In oDrawDoc.Sheets
		For Each oGeneralNote In oSheet.DrawingNotes.GeneralNotes
			oGeneralNote.Delete
		Next
	Next
 End Sub
Sub AddNote()
	Dim invApp As Inventor.Application
	invApp = ThisApplication
	
	Dim oDrawDoc As Document
	oDrawDoc = invApp.ActiveEditDocument
	
	Dim oTG As Inventor.TransientGeometry = invApp.TransientGeometry
	
	oModelDoc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
	oFrame = Parameter(oModelDoc, "frame")
	oEng = Parameter(oModelDoc, "engine")
	
	For Each oSheet In oDrawDoc.Sheets
		Dim Ycoord = 20
		Dim Xcoord = 8
		Dim LS = 0.65
		oNote = oSheet.DrawingNotes.GeneralNotes.AddFitted(oTG.CreatePoint2d(oSheet.Width -Xcoord, Ycoord), "Model " & oFrame & " Customer Selected Options")
		With oNote
				.HorizontalJustification = Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter
				.VerticalJustification = Inventor.VerticalTextAlignmentEnum.kAlignTextMiddle
'				.TextStyle.FontSize = 0.305
				.TextStyle.FontSize = 0.254
		End With
		
		If oEng = "ford" Then
			Ycoord = Ycoord - LS
			oNote = oSheet.DrawingNotes.GeneralNotes.AddFitted(oTG.CreatePoint2d(oSheet.Width - Xcoord, Ycoord), "2.5L Ford Engine")
		ElseIf oEng = "cat 49.5hp" Then
			Ycoord = Ycoord - LS
			oNote = oSheet.DrawingNotes.GeneralNotes.AddFitted(oTG.CreatePoint2d(oSheet.Width - Xcoord, Ycoord), "Cat 49.5HP Diesel Engine")
		ElseIf oEng = "cat 60hp" Then
			Ycoord = Ycoord - LS
			oNote = oSheet.DrawingNotes.GeneralNotes.AddFitted(oTG.CreatePoint2d(oSheet.Width - Xcoord, Ycoord), "Cat 60HP Turbo Diesel Engine")
		End If
		
		oDrawDoc.Update()
	Next
 End Sub

 

0 Likes
Message 3 of 4

cshunt
Enthusiast
Enthusiast

Would it be helpful to use the style override commands in the textbox?

This is from vba but I think the style overrides and carrige return will still work in ilogic

<Br/> adding carrige return.

<StyleOverride Font='Arial' FontSize='0.2413'>STAMP:</StyleOverride> for font and style overrides

 

 

Dim LeaderNoteText As String
LeaderNoteText = "<StyleOverride Font='Arial' FontSize='0.2413'>STAMP:</StyleOverride><Br/><StyleOverride Font='Arial' FontSize='0.2413'>1) JOB NUMBER</StyleOverride><Br/><StyleOverride Font='Arial' FontSize='0.2413'>2) DRAWING NUMBER</StyleOverride><Br/><StyleOverride Font='Arial' FontSize='0.2413'>3) TYPE</StyleOverride><Br/><StyleOverride Font='Arial' FontSize='0.2413'>4) FINAL</StyleOverride>"

 

0 Likes
Message 4 of 4

Anonymous
Not applicable
Accepted solution

By making Ycoord = 20.25 instead of 20, the LS = 0.65 was finally recognized. For some reason I could only make it adjust by whatever significant digit the original number was. I believe the only way to make a different font type is to make a separate sub group in the code. 

0 Likes