muck 发表于 2022-7-6 17:05:41

Dim Style overrides & changing

AutoCAD VBA
 
In AutoCAD 2004 I use the following code to change my
dimstyle variables by picking the dimension.
 
In AutoCAD 2009 the following code does not do this.
I think is changes dim style overrides? What ever that
is?
 
I would like to simply change my dim variables in current
dim style. How can the following code be modified to do
this?
 
Private Sub CommandButton2_Click()
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"
 
    MsgBox objDimension.VerticalTextPosition
    'DIMTAD
    ThisDrawing.SetVariable "DIMTAD", objDimension.VerticalTextPosition
 
    MsgBox objDimension.TextHeight
    ThisDrawing.SetVariable "DIMTX", objDimension.TextHeight
 
    MsgBox objDimension.TextStyle
 
    MsgBox objDimension.TextGap
    ThisDrawing.SetVariable "DIMJUST", objDimension.TextGap
 
    MsgBox objDimension.ArrowheadSize
    ThisDrawing.SetVariable "DIMASZ", objDimension.ArrowheadSize
 
    MsgBox objDimension.ExtensionLineExtend
 
    MsgBox objDimension.ExtensionLineOffset
 
End Sub
 
Thank you,

CmdrDuh 发表于 2022-7-6 17:21:56

You want to grab the current style, and make all your changes, then update the style by reading the values.I'll post example BRB

CmdrDuh 发表于 2022-7-6 17:49:25

   Set objDimStyle = ThisDrawing.DimStyles.Add("YourNamedStyle")   objDimStyle.CopyFrom ThisDrawing   ThisDrawing.ActiveDimStyle = objDimStyleMake your changes here....................   objDimStyle.CopyFrom ThisDrawing

muck 发表于 2022-7-6 17:56:55

How do I get the Annotative text variable and the Dimstyle variable???
 
I think that is what I need to make this thing work??
Thank you,

CmdrDuh 发表于 2022-7-6 18:19:39

If your looking for a variable to make a style annotative, that is the one thing I have not been able to do.What do you mean by dimstyle var?That seems to open the dim manager
页: [1]
查看完整版本: Dim Style overrides & changing