×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

API to Set Dual Units

API to Set Dual Units

API to Set Dual Units

(OP)
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

RE: API to Set Dual Units

Go to tools, options, document properties, dimensions, precision. It's in there.

RE: API to Set Dual Units

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.

"Customer satisfaction, while theoretically possible, is neither guaranteed nor statistically likely.--E.L. Kersten
http://www.EsoxRepublic.com

RE: API to Set Dual Units

(OP)
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

RE: API to Set Dual Units

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.

RE: API to Set Dual Units

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.

RE: API to Set Dual Units

(OP)
Currently running SW2004 sp5.0

Ken

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources