Changing Units Quickly
Changing Units Quickly
(OP)
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?
Thank you.
Thank you.





RE: Changing Units Quickly
In which workbench?
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
RE: Changing Units Quickly
RE: Changing Units Quickly
' ======================================================
' Purpose: Macro will toggle the current measure unit in an active CATIA session
' Usage: 1 - A CATIA session must exist
' 2 - Run macro
' Author: ferdo (Disclaimer: You use this code at your own risk)
' ======================================================
Language="VBSCRIPT"
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.000000, 3.000000
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.000000, 3.000000
oUnitsSheetSettingAtt.SaveRepositoryForUnits()
oUnitsSheetSettingAtt.CommitForUnits()
oUnitsSheetSettingAtt.Commit()
MsgBox "The Current Unit is now: " & oUnitMM
End If
CATIA.StartCommand "Options"
End Sub
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
RE: Changing Units Quickly
Another option is to type in the units along with the value. This is quick and handy, if you only have a few numbers to convert on-the-fly.
For example; if the current units are set to MM, you could type in 2in, and CATIA will convert from inches to millimeters. I'm not sure of all the unit abbreviations, but you could also use "ft" pr "cm". There are many others.