I couldnt find this in API help. Im trying to create a button that will change a selected dimension properties to include parenthesis.
Anyone know the code?
I couldnt find this in API help. Im trying to create a button that will change a selected dimension properties to include parenthesis.
Anyone know the code?
Try this under Annotation object, Dispaly Dimensions
DisplayDimension::ShowParenthesis Description
This property gets or sets whether the dimension is displayed with parenthesis around the text.
Syntax (OLE Automation) show = DisplayDimension.ShowParenthesis (VB Get property) DisplayDimension.ShowParenthesis= show (VB Set property)
Vizach
SW M> I couldnt find this in API help. Im trying to create a button that
I cant seem to get this to work.
a. I want to click on a pre existing dimension, and click a button to add parenthesis
and
b. Click on a button to create a dimension with parenthesis.
This will allow me to change existing dimensions, and add new ones.
I figure the DisplayDimension.ShowParenthesis=show would be true for A, but I get a error when running the code.
Dim swApp As Object Dim Part As Object Dim boolstatus As Boolean Dim longstatus As Long, longwarnings As Long Dim FeatureData As Object Dim Feature As Object Dim Component As Object Dim swDispDim As SldWorks.DisplayDimension Dim swDraw As SldWorks.DrawingDoc Dim swAnn As SldWorks.Annotation Dim swSelMgr As SldWorks.SelectionMgr
Sub main()
Set swApp = Application.SldWorks Set Part = swApp.ActiveDoc Set swDraw = Part Set swSelMgr = Part.SelectionManager Set swDispDim = swSelMgr.GetSelectedObject5(1)
Set Dimension = swDispDim.GetDimension
swDispDim.ShowParenthesis = True
Part.ClearSelection2 True End Sub
This will set the dimension display to parenthesis on. You will need to place an error trap if someone does not select anything. The second part about placing a dimension is easy. No need to discuss here.
Good Luck!
That code works great. Im still learning how to write code. Im trying the second macro, that will create a dimension with parenthesis, but im having some trouble.
I recorded a macro when creating a dimension, but it will only run on a preselected edge. What Im trying to get is a "Smart Dimension" that has parenthesis automatically.
Do you want all your dimensions to have parenthesis, or just specific ones?
Just specific ones. The macro above works great for changing existing dimensions. We changed our standards to make specific dimensions referenced, so as we bring up old drawings, we have to update those dimensions. That macro will help with that. The other macro will help when creating new dimensions that need parenthesis. I know you can set your template to set dimensions as referenced automatically, but thats not what we want.
PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.