Hello, I have written a CATSCRIPT that will change the unit parameter LENGTH from INCH to MILLIMETER (or vice-versa). This change happens when a button is selected on the user's toolbar. The button will save the user some time since he/she doesn't have to access TOOLS->OPTIONS each time to change this parameter. Even though the change actually takes effect, CATIA doesn't think that anything has happened. When I go to verify the change in TOOLS->OPTIONS->PARAMETERS AND MEASURES->UNITS I can see it has taken place, but, it is not until I hit the 'OK' button on that panel that CATIA recognizes it.
Does anyone have an idea on what I can do in my code to provide the same authorization as the 'OK' button? Is there an "update" that I am missing?
Below is a copy of the VBSCRIPT I am using:
Any information or assistance that you can provide would be appreciated.
Thanks in advance.
Does anyone have an idea on what I can do in my code to provide the same authorization as the 'OK' button? Is there an "update" that I am missing?
Below is a copy of the VBSCRIPT I am using:
Code:
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()
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()
MsgBox "The Current Unit is now: " & oUnitMM
End If
End Sub
Any information or assistance that you can provide would be appreciated.
Thanks in advance.