you have to set the annotative property to true. Let me look for an example
Never mind, that was something new for C#, not VBA



Registered forum members do not see this ad.
Subject: Using VBA to create Annotative Dim in DimStyle object.
AutoCAD 2009 VBA
How can someone use VBA make a dimstyle that will
make an annotative dimension?
Thank you,
you have to set the annotative property to true. Let me look for an example
Never mind, that was something new for C#, not VBA
Last edited by CmdrDuh; 9th Jan 2009 at 05:04 pm.
Everyone has a Photographic memory, some just don't have film



How to you set the annotative property. I have done an internet
search without any luck.
Thank you,

DIMANNO needs to be set to 1
This routines will create a s dim style. I actually have this routine use part the the stylename to set the dimscale and I read stuff from a file I created.
SYSVDLG is a great command to find out what the system variable are currently set to.
I had to strip move of the code down to stay with in the posting rules.
HTH
Public Sub MakeDimStyle(stylename As String)
' initial variables
Dim objDimStyle As AcadDimStyle
Dim objDimCollection As AcadDimStyles
Dim strDimStyles(2) As String
Dim strWhichSpace As String
Dim strWhichPaper As String
Dim intPos As Integer
Dim sTemp1 As String
Dim strvar As String
Dim varValue As Variant
Dim strValue As String
Dim i As Integer
Dim dbldimscale As Double
Dim lngValue As Long
Dim stemp As String
Dim lenstr As Integer
Dim IntInFile As Integer
Dim file2use As String
file2use = Left(stylename, 3) & "0"
lenstr = Len(stylename)
dbldimscale = CDbl(Right(stylename, lenstr - 3))
On Error Resume Next
Set objDimStyle = ThisDrawing.DimStyles.Item(stylename)
If Err Then
On Error GoTo 0
Set objDimStyle = ThisDrawing.DimStyles.Add(stylename)
ThisDrawing.ActiveDimStyle = objDimStyle
'--- CHANGE YOUR DIM VARIABLE HERE------
ThisDrawing.SetVariable "DIMANNO",1
objDimStyle.CopyFrom ThisDrawing
End Sub
Dimanno is read only in 08 and 09, so I am curious how your making it work
Everyone has a Photographic memory, some just don't have film



I am wonding about Dimanno being is read only. I am using 2009.
My code uses sendcommand to reset dimanno but I have not
looked at the posted above code.
Here is my code.
It is at 'Annotation Dim flagged note.
My code is changing dimstyle picking a dimension and
that is my objective in my code. Only way I know how to
do it is to use sendcommnd shown in the last part of my code.
Dim objDimension As AcadDimension
Dim varPickedPoint As Variant
Dim objDimStyle As AcadDimStyle
Dim strDimStyles As String
Dim strChosenDimStyle As String
Dim stg As String
On Error Resume Next
Me.hide
ThisDrawing.Utility.GetEntity objDimension, varPickedPoint, _
"Picked a dimension whose style you wish to set"
If objDimension Is Nothing Then
MsgBox "You failed to pick a dimension object"
Exit Sub
End If
stg = "Textheight"
ThisDrawing.SetVariable "dimexe", objDimension.ExtensionLineExtend
ThisDrawing.SetVariable "dimexo", objDimension.ExtensionLineOffset
ThisDrawing.SetVariable "DIMCLRD", objDimension.DimensionLineColor
ThisDrawing.SetVariable "DIMCLRE", objDimension.ExtensionLineColor
ThisDrawing.SetVariable "DIMCLRT", objDimension.color
ThisDrawing.SetVariable "Dimscale", objDimension.ScaleFactor
ThisDrawing.SendCommand "Dimscale" & vbCr
ThisDrawing.SendCommand objDimension.ScaleFactor & vbCr
ThisDrawing.SetVariable "DIMTAD", objDimension.VerticalTextPosition
ThisDrawing.SetVariable "DIMTXT", objDimension.TextHeight
ThisDrawing.DimStyles.StyleName , objDimension.TextStyle
ThisDrawing.SetVariable "DIMJUST", objDimension.TextGap
ThisDrawing.SetVariable "DIMASZ", objDimension.ArrowheadSize
ThisDrawing.SetVariable "Clayer", objDimension.Layer
Set objDimStyle = ThisDrawing.DimStyles.Add("YourNamedStyle")
objDimStyle.CopyFrom ThisDrawing
ThisDrawing.ActiveDimStyle = objDimStyle
objDimStyle.CopyFrom ThisDrawing
objDimStyle.Name = "YourNamedStyle"
'Annotation Dim
If objDimension.ScaleFactor = 0 Then
ThisDrawing.SendCommand "-dimstyle" & vbCr & "AN" & vbCr & "Y" & vbCr & "YourNamedStyle" & vbCr & "Y" & vbCr & "s" & vbCr & vbCr
Else
ThisDrawing.SendCommand "-dimstyle" & vbCr & "AN" & vbCr & "N" & vbCr & "YourNamedStyle" & vbCr & "Y" & vbCr & "s" & vbCr & vbCr
End If
ThisDrawing.SetVariable "Dimscale", objDimension.ScaleFactor
ThisDrawing.SendCommand "Dimscale" & vbCr
ThisDrawing.SendCommand objDimension.ScaleFactor & vbCr
Well, using sendcommand is entirely different than setting dimanno through code. What happens if you type DIMANNO at the command prompt? does it register as readonly?
Everyone has a Photographic memory, some just don't have film



Yes, code is preferred over sendcommand. I will look at above code to
see if I can replace the Sendcommand with code.
Thank you,



In RickyD302's code, what is the line
dbldimscale = CDbl(Right(stylename, lenstr - 3)) for?
In that code, I set the dimstyle name to "test1" and it would not get
thru that line?
Thank you

Registered forum members do not see this ad.
I'm sorry I use that to set the dimscale of the style.
I'm having the user enter CSI0 or CSI48 for the style and I'm stripping off the CSI
Bookmarks