muck Posted December 3, 2008 Posted December 3, 2008 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, Quote
CmdrDuh Posted December 3, 2008 Posted December 3, 2008 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 Quote
CmdrDuh Posted December 3, 2008 Posted December 3, 2008 Set objDimStyle = ThisDrawing.DimStyles.Add("YourNamedStyle") objDimStyle.CopyFrom ThisDrawing ThisDrawing.ActiveDimStyle = objDimStyle Make your changes here.................... objDimStyle.CopyFrom ThisDrawing Quote
muck Posted December 3, 2008 Author Posted December 3, 2008 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, Quote
CmdrDuh Posted December 3, 2008 Posted December 3, 2008 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.