Icon / Toolbar to Switch Units
Icon / Toolbar to Switch Units
(OP)
I've tried but cannot figure out. Is there a way to create a macro or something to make an icon that I can toggle back and forth between inches and millimeters?
Appreciate the help!
Appreciate the help!





RE: Icon / Toolbar to Switch Units
Just set the properties to the units you use most often, and then add a " (or mm) after the number when you need to use a value in the other unit.
RE: Icon / Toolbar to Switch Units
This is a CATScript which I posted in a Spanish forum:
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"
call CATIA.SystemService.ExecuteBackGroundProcessus("WScript.exe c:\SendEnter.vbs")
End Sub
Paste what is bellow in a file named SendEnter.vbs (vbs is the extension of the file)
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.sleep 200
WshShell.SendKeys "{ENTER}"
Regards
Fernando
RE: Icon / Toolbar to Switch Units
RE: Icon / Toolbar to Switch Units
I ran the script and like the way it works, however if your are not on the Tools/Options/Paramaters and Measures/Units page, it does not allow you to click ok and the switch doesnt take affect until I go to this page. Is this a glitch in Catia. Is there a way around this so I dont have to this or say ok everytime I switch units....just wondering
RE: Icon / Toolbar to Switch Units
Regards
Fernando
RE: Icon / Toolbar to Switch Units