I need a macro to copy Dimension as integer on the second line of Dimension text.
Something like this.
<DIM>
23.40
Assuming that the value of Dim = 23.40
Thank you very much.
I need a macro to copy Dimension as integer on the second line of Dimension text.
Something like this.
<DIM>
23.40
Assuming that the value of Dim = 23.40
Thank you very much.
You can try the following macro that i pulled together quickly. This most likely will not cover all your need but can act as a starting point for you...
You will need to select a dimension before you run the macro
' Preconditions:
' (1) Model document with dimensions is open.
' (2) Dimension is selected.
'==================== Preamble ===================='
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swDispDim As SldWorks.DisplayDimension
Dim swDim As SldWorks.Dimension
Dim vDimValArr As Variant
'==================================================''==================== MainCode ===================='
Sub main()Set swApp = Application.SldWorks
'Get active document
Set swModel = swApp.ActiveDoc'Display message and terminate if nothing is open
If swModel Is Nothing Then
MsgBox "Please open a file first.", vbOKOnly
End 'Terminate macro
End IfSet swSelMgr = swModel.SelectionManager
Set swDispDim = swSelMgr.GetSelectedObject5(1)
Set swDim = swDispDim.GetDimensionvDimValArr = swDim.GetValue3(swThisConfiguration, "")
swModel.Extension.EditDimensionProperties swTolNONE, 0, 0, "", "", True, 9, swDimArrowsSmart, True, swSLASH_ARROWHEAD, swSLASH_ARROWHEAD, "", "", True, "", vDimValArr(0), "", True, swThisConfiguration, ""
Set swModel = Nothing
End Sub
Just curious, what are you trying to achieve with this macro?
You can try the following macro that i pulled together quickly. This most likely will not cover all your need but can act as a starting point for you...
You will need to select a dimension before you run the macro
Just curious, what are you trying to achieve with this macro?