Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

API to Set Dual Units

Status
Not open for further replies.

brengine

Mechanical
Joined
Apr 19, 2001
Messages
616
Location
US
I know how to toggle Dual Disply of units on and off, but I can't figure out how to set the dual units (i.e. inch/mm, precision, tolerance)

Thanks,
Ken
 
Go to tools, options, document properties, dimensions, precision. It's in there.
 
ModelDoc2::SetUserPreferenceIntegerValues

Set values for:
swDetailingLinearDimPrecision - Integer value for precision.
swDetailingLinearTolPrecision - Integer value for precision.
swDetailingAltLinearDimPrecision - Integer value for precision.
swDetailingAltLinearTolPrecision - Integer value for precision.
swDetailingAngularDimPrecision - Integer value for precision.
swDetailingAngularTolPrecision - Integer value for precision.


[bat]"Customer satisfaction, while theoretically possible, is neither guaranteed nor statistically likely.[bat]--E.L. Kersten
 
TheTick,
Here's a snip of the code I am using, but it doesn't seem to be working:

Code:
If (Part.GetUserPreferenceIntegerValue(swUnitsLinear) = swINCHES) Then
  'Set to Metric
  Part.SetUserPreferenceIntegerValue swUnitsLinear, swMM
  Part.SetUserPreferenceToggle swDetailingDualDimensions, True
  Part.SetUserPreferenceIntegerValue swDetailingLinearDimPrecision, 2
  Part.SetUserPreferenceIntegerValue swDetailingLinearTolPrecision, 2
  Part.SetUserPreferenceIntegerValue swDetailingAltLinearDimPrecision, 3
  Part.SetUserPreferenceIntegerValue swDetailingAltLinearTolPrecision, 3
  swApp.SendMsgToUser "Conversion to Metric made successfully"
Else
  'Set to Inch
  Part.SetUserPreferenceIntegerValue swUnitsLinear, swINCHES
  Part.SetUserPreferenceToggle swDetailingDualDimensions, False
  Part.SetUserPreferenceIntegerValue swDetailingLinearDimPrecision, 3
  Part.SetUserPreferenceIntegerValue swDetailingLinearTolPrecision, 3
  Part.SetUserPreferenceIntegerValue swDetailingAltLinearDimPrecision, 2
  Part.SetUserPreferenceIntegerValue swDetailingAltLinearTolPrecision, 2
  swApp.SendMsgToUser "Conversion to Imperial made successfully"
End If

None of the "alt" values change. Am I missing something?

Thanks,
Ken
 
Where's the clue I missed? Ah yes, the subject line. That's both feet in my mouth today, so I'd better sit down.
 
What version are you using? At one point there was a bug in which the precision of the dual units did not update when the value was changed through the options dialog. I think the primary dimension precision value was being used for both the primary units and the dual units. This was fixed in SWX2004 SP4, but it would prevent even properly written code from updating the drawing. If you are using a previous version update your service pack and then recheck the results.
 
Currently running SW2004 sp5.0

Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top