muck Posted December 2, 2008 Posted December 2, 2008 Software usage: AutoCAD 2000 to 09. Is it possible to modify this code to get the dim arrow head size, variable exe & exo & dim color. Private Sub CommandButton2_Click() Dim objDimension As AcadDimension Dim varPickedPoint As Variant Dim objDimStyle As AcadDimStyle Dim strDimStyles As String Dim strChosenDimStyle 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 MsgBox objDimension.TextHeight MsgBox objDimension.TextStyle ' MsgBox objDimension.VerticalTextPosition MsgBox objDimension.TextGap End Sub Quote
CmdrDuh Posted December 2, 2008 Posted December 2, 2008 yes this is possible, do you need help making it work? add this MsgBox objDimension.ArrowheadSize MsgBox objDimension.ExtensionLineExtend MsgBox objDimension.ExtensionLineOffset Quote
CmdrDuh Posted December 2, 2008 Posted December 2, 2008 If you pause your IDE, you can look in the Locals window and see all the info your looking for. I paused and highlighted ArrowHeadSize for you in the pic Quote
muck Posted December 3, 2008 Author Posted December 3, 2008 Now that I have all my variables from my choose dimension. How can I use these variables to change my current dim Style?? How could I make a new dimstyle with these variables. Oh yes, Where do I find and pause my IDE window. Thank you, Quote
CmdrDuh Posted December 3, 2008 Posted December 3, 2008 your IDE is the window where you wrote your code. To pause your code, click to the left of the line you want to pause. A red dot should show up. Quote
borgunit Posted December 3, 2008 Posted December 3, 2008 Dimension overrides are a bit tricky but this code I use helps me often.. Public Sub ChgDimStyleSettings() '------------------------------------------------------------------------------ 'Will set a dimstyle current and effect an override 'The current settings are then copied into the named set from 'the drawing (which will catch the overrides .. copying from an 'existing dimstyle will not catch overrides). After changing 'dimstyle, each dim using style is moved a bit, then returned, 'to force update. Update doesn't catch dimstyle changes. '------------------------------------------------------------------------------ Dim acDimStyles As AcadDimStyles Dim acDimStyle As AcadDimStyle Dim objEnt As AcadEntity Dim vNewVal As Variant Dim iVal As Integer Dim iDS As Integer Dim ssDim As AcadSelectionSet Dim sSS As String Dim iCd(0) As Integer Dim vVal(0) As Variant Dim vCds As Variant Dim vVals As Variant Dim dPt0(2) As Double Dim dPt1(2) As Double ''''''''''''''''''''''''''''''''''''''' For iDS = 0 To 2 dPt0(iDS) = 0# dPt1(iDS) = 0# Next iDS dPt1(0) = 1# Set acDimStyles = ThisDrawing.DimStyles sSS = "DIMUPDATE" 'make sure selset name is not in use .. done here since loop each add is deleted For Each ssDim In ThisDrawing.SelectionSets If ssDim.Name = sSS Then ssDim.Delete Next ssDim '------------------------------------------------------------------------------ 'Set each Dimstyle Current '------------------------------------------------------------------------------ For iDS = 0 To acDimStyles.Count - 1 ThisDrawing.ActiveDimStyle = acDimStyles(iDS) '-------------------------------------------------------------------------- 'CUSTOM settings here '-------------------------------------------------------------------------- 'vNewVal = Chr(34) 'make sure alt dims use " as suffix vNewVal = "STANDARD_ISO" '-------------------------------------------------------------------------- 'CUSTOMIZE HERE >>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<< '-------------------------------------------------------------------------- ThisDrawing.SetVariable "DIMTXSTY", vNewVal 'establish override acDimStyles(iDS).CopyFrom ThisDrawing '-------------------------------------------------------------------------- 'Update associated dims '-------------------------------------------------------------------------- iCd(0) = 3 Set ssDim = ThisDrawing.SelectionSets.Add(sSS) vVal(0) = acDimStyles(iDS).Name vCds = iCd: vVals = vVal ssDim.Select acSelectionSetAll, , , vCds, vVals '-------------------------------------------------------------------------- 'Update doesn't .. must actually 'touch' the dims '-------------------------------------------------------------------------- For Each objEnt In ssDim objEnt.Move dPt0, dPt1 objEnt.Move dPt1, dPt0 Next objEnt ssDim.Delete Next iDS ThisDrawing.Regen acActiveViewport 'Check the setting ''' For iDS = 0 To acDimStyles.Count - 1 ''' Set acDimStyle = acDimStyles(iDS) ''' ThisDrawing.ActiveDimStyle = acDimStyle ''' iVal = ThisDrawing.GetVariable("DIMCLRT") ''' If iVal <> vNewVal Then MsgBox "Text Color is " & iVal ''' Next iDS Set acDimStyle = Nothing Set acDimStyles = Nothing Set ssDim = Nothing End Sub Quote
muck Posted December 3, 2008 Author Posted December 3, 2008 Pausing the IDE for the local windows works well. Seems like in both Visual Basic or VBA I seem to look for variables. I usually end up searching google. What about the object browser. Would that help also? I am still looking for the annotative dim variable and how it relates to dimscale. Any Info on that? Thank you, Quote
CmdrDuh Posted December 3, 2008 Posted December 3, 2008 are you looking for the scale value of Annotation or how to set a style to be annotative? The first is in CANNOSCALE, the second cant be done Quote
muck Posted December 5, 2008 Author Posted December 5, 2008 Is there a autocad variable for Dim Text Rotation? I found the object variable in AutoCAD VBA object but I can't find the autocad dim variable to set dim text rotation. Does anyone know what that autocad variable is? thank you, Quote
CmdrDuh Posted December 5, 2008 Posted December 5, 2008 I cant find that in autocad, just horz or aligned with the dim line 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.