×
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

CHANGING UNITS QUICKLY

CHANGING UNITS QUICKLY

CHANGING UNITS QUICKLY

(OP)
thread560-328286: Changing Units Quickly

Hi Ferdo,

Below is the CATScript, given by you to toggle between the units,

Sub CATMain()

Dim oSettingControllers As SettingControllers
Set oSettingControllers = CATIA.SettingControllers
Dim oUnitsSheetSettingAtt As SettingController
Set oUnitsSheetSettingAtt = oSettingControllers.Item("CATLieUnitsSheetSettingCtrl")
Dim oMagnitude As String
oMagnitude = "LENGTH"
Dim oUnit As String
oUnit = ""
Dim oGetDecimal As Double
Dim oGetExpo As Double
oUnitsSheetSettingAtt.GetMagnitudeValues oMagnitude, oUnit, oGetDecimal, oGetExpo

If (oUnit = "Inch") Then
Dim oUnitInch As String
oUnitInch = "Millimeter"
oUnitsSheetSettingAtt.SetMagnitudeValues oMagnitude, oUnitInch, 6#, 3#
oUnitsSheetSettingAtt.SaveRepositoryForUnits()
oUnitsSheetSettingAtt.CommitForUnits()
oUnitsSheetSettingAtt.Commit()
MsgBox "The Current Unit is now: " & oUnitInch
End If

If (oUnit = "Millimeter") Then
Dim oUnitMM As String
oUnitMM = "Inch"
oUnitsSheetSettingAtt.SetMagnitudeValues oMagnitude, oUnitMM, 6#, 3#
oUnitsSheetSettingAtt.SaveRepositoryForUnits()
oUnitsSheetSettingAtt.CommitForUnits()
oUnitsSheetSettingAtt.Commit()
MsgBox "The Current Unit is now: " & oUnitMM
End If

CATIA.StartCommand "Options"

End Sub

I am getting a error trying to run it, please see attachment.

Please help.

Thanks for your time.

RE: CHANGING UNITS QUICKLY

Error:
Remove all brackets. If function doesn't take any arguments, You don't have to type brackets (in next step I'll show You how to call Subroutine with brackets)

Warning:
1.change all dash symbols (#) to proper values, e.g. 3.00000
probably You're using built-in VBA editor, it replace all strings, that are not given in brackets
to run CATIA's built-in SubRoutine replace lines as follow (it's an example, type Yours values)

CODE -->

Call oUnitsSheetSettingAtt.SetMagnitudeValues(oMagnitude, oUnitInch, 6.000, 3.000) 

LukaszSz. Poland, Warsaw University of Technology, Faculty of Power and Aeronautical Engineering : MEchanical Engineering. BsC - 2013

RE: CHANGING UNITS QUICKLY

(OP)
Hi LukaszSz,

Thanks for your time.
I implemented the changes you mentioned, the programme is running but with no desired results.

In first attachment: after running script. (I gave OK)
In second attchment: Window which pop up after giving ok.

Units still remains same. :(
Please help.

Thanks in advance

RE: CHANGING UNITS QUICKLY

Pradeep, which units are you trying to change? the 3D working units (CATPart), or the drawing dimension units? How do you know the units are still the same?

RE: CHANGING UNITS QUICKLY

(OP)


Hi Ferdo,

I have done the settings shown by you in above snap.
Please see the attchment. The dimension was in "inch", after running the macro the dimension still remains "inch".

Hi Jackk,

I am trying to change the units in drawing.

Thanks
Pradeep

RE: CHANGING UNITS QUICKLY

I think your script is changing the drawing units that effect measures and geometry creation/modification, but does NOT drawing dimensions.

To change dimension units, change the dimension Numeric Display from NUM.DINC (or whatever you're using) to NUM.DIMM. Here's the steps to convert all dimensions interactively:
a. use EDIT + SEARCH to search and select all dimensions
b. select NUM.DIMM from the Numeric Display list in the top menu

RE: CHANGING UNITS QUICKLY

I didn't realize we were dealing with Dual Dimensions in this thread. It is indeed possible and easy to manualy (interactively) change the units of dual dimensions, however it requires changing the dimension properties after selecting all dimensions.

a. use EDIT + SEARCH to search and select all dimensions
b. right-click on one of the highlighted dimensions and choose PROPERTIES
c. go the the VALUE tab, and select the Show Dual Value option
d. set the Description for the Main value (NUM.DIMM for millimeter units)
e. set the Descrittion for the Dual value (NUM.DINC for inch units)
f. OK

In a previous post you said you did not get the desired results with a script, but now you say you do have a script that will do it without any hassle ???

RE: CHANGING UNITS QUICKLY

Hi,

Jackk, you are right, is nowhere specified that we are dealing with dual dimensions.

Also , in the reference thread question was

Quote (JMorton)


Hello is there a way in CATIA where you can create a button that allows you to change quickly between metric and US units without having to go through the tools menu and options to change it every time?

The script is doing exactly what was the original question in the reference thread, I completely agree with your observations (and CATIA methods by the way), star for this.

metipradeep, next time, it would be great to see what you tried in order to give you a better answer.

Regards
Fernando

https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...

RE: CHANGING UNITS QUICKLY

Yes, I do agree with you jack.
metipradeep has nowhere mentioned that he is trying to change units for dual dimensions.
so, this is indeed refers to just what the script does.

Regards,
Maddy

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