Re: iLogic to add symbols to dimension text in drawings

Re: iLogic to add symbols to dimension text in drawings

rhasell
Advisor Advisor
1,557 Views
7 Replies
Message 2 of 8

Re: iLogic to add symbols to dimension text in drawings

rhasell
Advisor
Advisor

Hi there

 

The characters are in the AIGDT font set. I used MS Word to get the character codes, and as an example I used M (Maximum material condition)

 

See if this works for you.

Sub main()
Dim oDoc As DrawingDocument = ThisDrawing.Document
Dim oSSet As SelectSet = oDoc.SelectSet

If oSSet.Count = 0 Then
	oDimSelect = ThisApplication.CommandManager.Pick(kDrawingDimensionFilter, "Select a dimension")
	'MessageBox.Show("Select at least one dimension please", "Dimension to modify", MessageBoxButtons.OK, MessageBoxIcon.Information)
	oSSet.Select(oDimSelect)
	Call oDim(oSSet)

Else
	Call oDim(oSSet)

End If
End Sub

Sub oDim(ByRef oSSet)
	oSym = "<StyleOverride Font='AIGDT' FontSize='0.25'>" & Chr(109) & "</StyleOverride>"
	For Each obj As Object In oSSet
		Dim oDim As GeneralDimension = obj
		Dim oDimensionText As DimensionText = oDim.Text
		oDimensionText.HorizontalJustification = (19969) ' this is the correct string to format the line for "Center Justifictaion"
		oDimensionText.FormattedText = (oSym)
	Next
End Sub

 

 

Reg
2026.1
1,558 Views
7 Replies
Replies (7)
Message 1 of 8

engilic
Advocate
Advocate

Hi,

 

How to add symbols to existing dimensions on the text.
Square, Centerline, Total Run-Out, ... all those symbols on the right side of Edit Dimension form.

 

Thank you

0 Likes
Message 3 of 8

rhasell
Advisor
Advisor

Hi

 

I did some more looking around and found this:

https://forums.autodesk.com/t5/inventor-customization/global-form-for-drawings-to-add-custom-prefixe...

I managed to pull some data out of thread, and have added all my testing into the code, the reason is I did not know how to move the symbol around the dimension value.

 

Sub main()
Dim oDoc As DrawingDocument = ThisDrawing.Document
Dim oSSet As SelectSet = oDoc.SelectSet

If oSSet.Count = 0 Then
	oDimSelect = ThisApplication.CommandManager.Pick(kDrawingDimensionFilter, "Select a dimension")
	'MessageBox.Show("Select at least one dimension please", "Dimension to modify", MessageBoxButtons.OK, MessageBoxIcon.Information)
	oSSet.Select(oDimSelect)
	Call oDim(oSSet)

Else
	Call oDim(oSSet)

End If
End Sub


'--------------
'copy from forum to test
''oText = Parameter("Modifier") & " " & "<DimensionValue/>"
''Else
''oText = "<DimensionValue/>" & " " & Parameter("Modifier") 	
''End If

''oDimensionText.FormattedText = oText
'------------

Sub oDim(ByRef oSSet)
	oSym = "<StyleOverride Font='AIGDT' FontSize='0.25'>" & Chr(109) & "</StyleOverride>"
	oText = oSym & " " & "<DimensionValue/>"
	For Each obj As Object In oSSet
		Dim oDim As GeneralDimension = obj
		Dim oDimensionText As DimensionText = oDim.Text
		oDimensionText.HorizontalJustification = (19969) ' this is the correct string to format the line for "Center Justifictaion"
		'oDimensionText.FormattedText = oSym
		oDimensionText.FormattedText = oText
	Next
End Sub
Reg
2026.1
Message 4 of 8

engilic
Advocate
Advocate

Thank you Rag,

 

I knew it is AIGDT font but did not know how to use it.

 

I just copied one row from your code, put in mine, and guess what, it works.

 

oSym = "<StyleOverride Font='AIGDT' FontSize='0.25'>" & Chr(109) & "</StyleOverride>"

 

I found out what it is just sis not know how to do it.

 

I did: MessageBox.Show(oDimensionText.FormattedText) and found out what I should use but as I said did not know how.

 

this is the final code and using MessageBox top show text you can change it manually and get the letter that wil represent the symbol you want, easy now when you did it for me.

 

'Square

'CHECK TO SEE IF THIS DOCUMENT IS A DRAWING FILE
If ThisDoc.Document.DocumentType <> kDrawingDocumentObject
        MessageBox.Show("File is not an *.idw file", "Wrong File Type")
        Exit Sub
End If
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveEditDocument

'DETERMINE IF THERE ARE ANY DIMENSIONS IN THE SELECT SET
Dim oSelectSet As SelectSet  = oDrawDoc.SelectSet
Dim colDimensions As New Collection
Dim oDim As DrawingDimension
Dim i As Long

For i = 1 To oSelectSet.Count
        
        If TypeOf oSelectSet.Item(i) Is DrawingDimension Then
               'ADD ANY DIMENSIONS TO THE COLLECTION.
               'WE NEED TO SAVE THEM IN SOMETHING BESIDES THE SELECTION SET BECAUSE ONCE WE START MANIPULATING THEM THE SELECT SET WILL BE CLEARED.
               colDimensions.Add(oSelectSet.Item(i))
        End If

' Square symbol
oSym = "<StyleOverride Font='AIGDT'>" & "o" & "</StyleOverride>"

Next 
If colDimensions.Count = 0 Then 
               MessageBox.Show("First Pick Dimension/s", "No Dimensions Selected")
        Exit Sub
        End If'MessageBox.Show(oSelectSet.Count)
For Each oDim In colDimensions
        Dim oDimensionText As DimensionText = oDim.Text
'print text content
'	Debug.Print oDimensionText.Text
'	Debug.Print oDimensionText.FormattedText
' change text
oDimensionText.FormattedText = "<DimensionValue/> " + oSym
Next

 

Thank you Rag once again very much. 

Message 5 of 8

engilic
Advocate
Advocate

How to move this post to the Inventor Customization board?
Can I do it?

0 Likes
Message 6 of 8

WCrihfield
Mentor
Mentor

Just to add a couple more links to the subject...

Add special characters to text or prompted entries 

Special characters and symbols are not displayed correctly in drawings in Inventor 

[Bugreport] Drawing - Text - Text style change replaces special characters (Solved) 

For Windows 10, to access the Character Map:

  1. Click windows 'Start' button, then on the 'All Programs' side, scroll down to 'Windows Accessories' and click it.
  2. This reveals its sub items.  And usually the first item there is the 'Character Map'.  Click that.
  3. Once its dialog is open, click in the drop-down list beside 'Font:', then choose 'AIGDT' from that list.
  4. Now it will be displaying all the available characters within that font.  But be aware, this dialog is usually not resizable, and there is usually a small vertical scroll bar along the right side.  You may have to scroll a long ways to see all available characters.
  5. If you click on an available symbol in the chart, then click the 'Select' button, it will add that character to the 'Characters to copy:' text box.  Then when you click the 'Copy' button, it obviously copies them to the clipboard.
  6. Once you click the check box beside the 'Advanced view' option, it will expand an additional area at the bottom of the dialog.  When you click on specific available characters in the chart above, the bottom line of the dialog box will display the 'character code' of that character.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 7 of 8

engilic
Advocate
Advocate

Thank you @WCrihfield , @CGBenner moved my post to this board but only last two messages,

You can see one post is here:
https://forums.autodesk.com/t5/inventor-forum/ilogic-to-add-symbols-to-dimension-text-in-drawings/td...

And the new one, moved, but just two last messages here (actually second and last one):
https://forums.autodesk.com/t5/inventor-customization/re-ilogic-to-add-symbols-to-dimension-text-in-...

Would be nice if there is only one post with all messages, also the second one is not related to me so when I open My Dashboard I don't see it and there is your last message with some information from you and @rhasell .

 

Actually, if you can move all messages to one post would be nice to sort them by time, since the second and last are moved to a new board. Now it is confusing.

 

Can this be fixed, please?

 

Have a lovely day.

0 Likes
Message 8 of 8

CGBenner
Community Manager
Community Manager

@engilic 

 

Hi.  I have no idea what happened here... I am attempting to merge the two into one post in customization.  I'm guessing it was my bad.  The posts may or may not show up in the original order, but it looks like they are all here.

 

Very sorry for the problem!

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

0 Likes