Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I have been working on making automatic dimensions in a .dwg document but I have not been able to center the text of the dimensions, since the occurrences can vary in size and add more, I do not know if you can help me to center the text so that it is always in the center regardless of the size of the occurrence.
Since if I try to give size to the text on some occasions it is put with another dimension or it is too small, I attach the code that I am working on.
Sub Main()
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub
Dim oDDoc As DrawingDocument = ThisDoc.Document
Dim oStMgr As DrawingStylesManager = oDDoc.StylesManager
Dim oDimStyles As DimensionStylesEnumerator = oStMgr.DimensionStyles
Dim oDimStyle As DimensionStyle = oDimStyles.Item("Default (ANSI)")
oDimStyle.ArrowheadType = ArrowheadTypeEnum.kBlankArrowheadType
oDimStyle.ArrowheadSize = 0.2286
oDimStyle.ArrowheadHeight = 0.08
oDimStyle.Extension = 0.4572
oDimStyle.Gap = 0.000
oDimStyle.Spacing = 0.000
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oDStyle As DimensionStyle = oDrawDoc.StylesManager.ActiveStandardStyle.ActiveObjectDefaults.LinearDimensionStyle
Dim sFontSize As String = oDStyle.TextStyle.FontSize
Dim x As Double
x = 0.25
oDStyle.TextStyle.FontSize = x
End Sub
Solved! Go to Solution.