Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-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
Apr 19, 2001
616
0
0
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
 
Replies continue below

Recommended for you

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
 
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.
 
Status
Not open for further replies.
Back
Top