How to use the API to modify the dimensions of the SW label to display the diameter as the diameter in the Dimension Property Manager?As shown in the picture below
VBA - Set dimension in sketch to be Diameter instead of Radius
This answers your question
Sub main()Dim swApp As SldWorks.SldWorksDim swModel As SldWorks.ModelDoc2Dim swSelMgr As SldWorks.SelectionMgrDim swDispDim As SldWorks.DisplayDimension
Set swApp = Application.SldWorksSet swModel = swApp.ActiveDocSet swSelMgr = swModel.SelectionManagerSet swDispDim = swSelMgr.GetSelectedObject6(1, -1)swDispDim.SetText swDimensionTextAll, "<MOD-DIAM><DIM>"End Sub
Hello Omkar Deshpande! I mean switch the display mode through Witness / Leader display Radius and Diameter on the left property manager
Is it possible in drawing file(SLDDRW)?When I try in drawing file, diametric variable change fails...
This macro code worked for me. Note that it only works on dimensioned circles and not projected diameters. The dimension has to be selected before the macro is run, though.
Dim swApp As SldWorks.SldWorks
Dim swModel As ModelDoc2Dim boolstatus As BooleanDim longstatus As Long, longwarnings As Long
Dim swSelMan As SelectionMgrDim displayDim As DisplayDimension
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc Set swSelMan = swModel.SelectionManager
Set displayDim = swSelMan.GetSelectedObject6(1, 0)
If displayDim.Diametric = False Then displayDim.Diametric = True Else displayDim.Diametric = False End If swModel.ForceRebuild3 False
Alternatively, you could just click one of these two buttons in the leader menu just about as quickly.
Thank you for quick response.
My problem is that I am trying to work on a CropView, but it seems impossible because of the projection diameter you mentioned...As shown in the figure below, the 'Make diametric' menu appears on the SW pop-up menu and it works well, but I asked a question because it didn't seem to work with the API.
In my opinion, the fundamental reason seems to be that the Type2 of DisplayDimension selected in the API is returned as swLinearDimension(2) instead of swRadialDimension(5).I will check more and respond when I know how to solve it.
Retrieving data ...