Swirlingchaos
Mechanical
- Dec 22, 2009
- 1
What i would like to have is a macro that makes my document use and measure dual dimensions, with 6 decimals on both the primary and alternate units. What i have so far makes the units work and fixes the precision on the measured units, but it does nothing for the precision on the modeled units. ie, the dimensions that you use to build the model dont go to the correct precision, but you get the correct precision in the measure tool.
Here is what im starting with, all of which works fine:
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
Part.SetUserPreferenceToggle swDetailingDualDimensions, True
Part.SetUserPreferenceToggle swDetailingShowDualDimensionUnits, True
Part.SetUserPreferenceIntegerValue swDetailingDualDimPosition, swDualDimensionsOnTop
Part.SetUserPreferenceIntegerValue swUnitsLinear, swMM
Part.SetUserPreferenceIntegerValue swUnitsLinearDecimalPlaces, 6
Part.SetUserPreferenceIntegerValue swUnitsAngularDecimalPlaces, 5
Part.SetUserPreferenceIntegerValue swUnitsDualLinear, swINCHES
Part.SetUserPreferenceIntegerValue swUnitsDualLinearDecimalPlaces, 6
End Sub
However, what i ALSO need is a way to use swDetailingLinearDimPrecision and swDetailingAltDimPrecision properly. I have tried the following lines to no avail:
boolstatus = Part.SetUserPreferenceInteger(swUserPreferenceIntegerValue_e.swDetailingAltDimPrecision, swUserPreferenceOption_e.swDetailingDimension, 6)
boolstatus = Part.SetUserPreferenceIntegerValue(swUserPreferenceIntegerValue_e.swDetailingAltDimPrecision, 6)
Part.SetUserPreferenceIntegerValue swDetailingAltDimPrecision, 6
I know that i can change the template to get my precision changed for new parts, but i want it to alter old parts too.
My machine is a 64 bit, and I am running SW 2009, SP5.0
I dont really know a lot about VBA - most of my knowledge comes from forum surfing, so most of my problem is likely a basic lack of syntax comprehension, but i have flailed away at this long enough that its time to start asking for help.
thanks!
Here is what im starting with, all of which works fine:
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
Part.SetUserPreferenceToggle swDetailingDualDimensions, True
Part.SetUserPreferenceToggle swDetailingShowDualDimensionUnits, True
Part.SetUserPreferenceIntegerValue swDetailingDualDimPosition, swDualDimensionsOnTop
Part.SetUserPreferenceIntegerValue swUnitsLinear, swMM
Part.SetUserPreferenceIntegerValue swUnitsLinearDecimalPlaces, 6
Part.SetUserPreferenceIntegerValue swUnitsAngularDecimalPlaces, 5
Part.SetUserPreferenceIntegerValue swUnitsDualLinear, swINCHES
Part.SetUserPreferenceIntegerValue swUnitsDualLinearDecimalPlaces, 6
End Sub
However, what i ALSO need is a way to use swDetailingLinearDimPrecision and swDetailingAltDimPrecision properly. I have tried the following lines to no avail:
boolstatus = Part.SetUserPreferenceInteger(swUserPreferenceIntegerValue_e.swDetailingAltDimPrecision, swUserPreferenceOption_e.swDetailingDimension, 6)
boolstatus = Part.SetUserPreferenceIntegerValue(swUserPreferenceIntegerValue_e.swDetailingAltDimPrecision, 6)
Part.SetUserPreferenceIntegerValue swDetailingAltDimPrecision, 6
I know that i can change the template to get my precision changed for new parts, but i want it to alter old parts too.
My machine is a 64 bit, and I am running SW 2009, SP5.0
I dont really know a lot about VBA - most of my knowledge comes from forum surfing, so most of my problem is likely a basic lack of syntax comprehension, but i have flailed away at this long enough that its time to start asking for help.
thanks!