iLogic created dimensions incorrect format in AutoCAD export

iLogic created dimensions incorrect format in AutoCAD export

rhasell
Advisor Advisor
525 Views
2 Replies
Message 1 of 3

iLogic created dimensions incorrect format in AutoCAD export

rhasell
Advisor
Advisor

Hi All

The problem:

I have just written some iLogic code to automatically create an arc length dimension.

When I export my drawing to AutoCAD, the dimension is not formatted correctly.

The fix: In Inventor, edit the dimension and then close the dimension dialog box. I don’t have to do anything, just double click on the dimension and then click OK. Then it formats the dimension in AutoCAD correctly.

 

Is there something I can add to my code to do this automatically?

 

I will add a small section of code, which will prompt the user for a dimension value and place it on the drawing. This still presents the same problem when exporting to AutoCAD.

 

Please refer to the ScreenCast

 

Dim oDoc As DrawingDocument = ThisDrawing.Document
Dim oSSet As SelectSet = oDoc.SelectSet
oSym = "<StyleOverride Font='AIGDT' FontSize='0.25'>" & Chr(94) & "</StyleOverride>"
Dim oValue As String=""

If oSSet.Count = 0 Then
    MessageBox.Show("Select at least one dimension please", "iLogic", _
        MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
oValue = InputBox("Enter the Dimension Value", "iLogic", oValue)
    For Each obj As Object In oSSet
            Dim oDim As GeneralDimension=obj
            Dim oDimensionText As DimensionText = oDim.Text
			oDim.HideValue = True
			oDimensionText.LineSpacingType = (29185) ' this is the correct string to format the line for "Exact"
			oDimensiontext.HorizontalJustification = (19969) ' this is the correct string to format the line for "Center Justifictaion"
			oDimensionText.LineSpacing = ("0.25") ' This will set the dimension text to Exactly of 0.25\
			oDimensionText.FormattedText = oSym & "<br/>" & oValue
					Next
End If 

 

Thanks

Regards

 

Reg
2026.1
0 Likes
Accepted solutions (1)
526 Views
2 Replies
Replies (2)
Message 2 of 3

rhasell
Advisor
Advisor

 

 

 

Apologies, the  screencast did not post

Reg
2026.1
0 Likes
Message 3 of 3

rhasell
Advisor
Advisor
Accepted solution

Okay fixed.

 

I had to format the colour of the dimension text. It will then export the dimension on the correct layer and colour.

(Note the code below is a snippet of a much larger rule set, it is proof of concept only)

 

The colour was really messing me around, because all automatically created dimensions have to be edited first.

 

 

Dim oDoc As DrawingDocument = ThisDrawing.Document
Dim oSSet As SelectSet = oDoc.SelectSet
oSym = "<StyleOverride Font='AIGDT' FontSize='0.25'>" & Chr(94) & "</StyleOverride>"
Dim oValue As String = ""

'Define colour
'Note: The export to Autocad was not formatting the Text correctly.
Dim oColor As Color
'set color to black
oColor = ThisApplication.TransientObjects.CreateColor(0, 0, 0)
oColor.ColorSourceType = ColorSourceTypeEnum.kLayerColorSource

If oSSet.Count = 0 Then
	MessageBox.Show("Select at least one dimension please", "iLogic", _
	MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
	oValue = InputBox("Enter the Dimension Value", "iLogic", oValue)
	For Each obj As Object In oSSet
		Dim oDim As GeneralDimension = obj
		Dim oDimensionText As DimensionText = oDim.Text
		oDim.HideValue = True
		oDimensionText.LineSpacingType = (29185) ' this is the correct string to format the line for "Exact"
		oDimensionText.HorizontalJustification = (19969) ' this is the correct string to format the line for "Center Justifictaion"
		oDimensionText.LineSpacing = ("0.25") ' This will set the dimension text to Exactly of 0.25\
		oDimensionText.Color = oColor
		oDimensionText.FormattedText = oSym & "<br/>" & oValue
	Next
End If

 

 

Reg
2026.1
0 Likes