Looking for a simple macro
Looking for a simple macro
(OP)
I'm looking for a macro that will change a decimal dimension to a rounded 64th fraction. I tried recording my own macro but it does not work.
Here is what I'm looking for, I would select one or several dimensions that are in decimal format, then run the macro and they all are updated to a rounded nearest 64th
Any suggestions
Tom
Here is what I'm looking for, I would select one or several dimensions that are in decimal format, then run the macro and they all are updated to a rounded nearest 64th
Any suggestions
Tom
Tom Malinski
Sr Design Engineer
OKay Industries
New Britain CT






RE: Looking for a simple macro
This code is very similar to code I posted fairly recently to toggle jogged ordinate dimensions. It just toggles document unit display rather than jogged ordiante.
CODE
Dim swDoc As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swDispDim As SldWorks.DisplayDimension
Dim i As Long
Sub FractionToggleMulti()
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set swSelMgr = swDoc.SelectionManager
For i = 1 To swSelMgr.GetSelectedObjectCount
If swSelMgr.GetSelectedObjectType3(i, Empty) = swSelDIMENSIONS Then
Set swDispDim = swSelMgr.GetSelectedObject6(i, Empty)
If swDispDim.GetUseDocUnits Then
swDispDim.SetUnits False, swINCHES, swFRACTION, 64, True
Else
swDispDim.SetUnits True, Empty, Empty, Empty, Empty
End If
End If
Next
'swDoc.ClearSelection2 True
'^^^Optional line - un-comment to de-select dims automatically
swDoc.GraphicsRedraw2
End Sub
RE: Looking for a simple macro
Just a reminder, right-click a dimension > properties > units. Pick fractions and enter 64 as the denominator and check "round to nearest fraction". Save this new dim as a favorite.
SW07 SP2.0
Flores
RE: Looking for a simple macro
Tom
Tom Malinski
Sr Design Engineer
OKay Industries
New Britain CT