|
DigiPara Liftdesigner LDX API
|
API method: ILDXDocument5.UNIT_MODE
Treename: LDXDocument.
' from Samples/Src/LDXAPIExamples/Example_LDXDocument.vb
<APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXApp}, "LDXDocument.", "LDXDocument~UNIT_MODE", "[0000] Change project units")>
Public Shared Sub ChangeProjectUnits(ldxApplication As DigiPara.LDX.LDXApplication)
If ldxApplication.ActiveDocument Is Nothing Then
MsgBox("Active document not found!")
Exit Sub
End If
With ldxApplication.ActiveDocument
' Clear old unit settings
.UNIT_MODE = .UNIT_MODE And Not (DigiPara.LDX.DocUnitModes.dumDisplayMetric Or DigiPara.LDX.DocUnitModes.dumDisplayImperial Or DigiPara.LDX.DocUnitModes.dumUsePrototypeDimensionSettings Or DigiPara.LDX.DocUnitModes.dumMeter)
If MsgBox("Do you want to use imperial units? (Default is metric)", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
' Display units in imperial
.UNIT_MODE = .UNIT_MODE Or DigiPara.LDX.DocUnitModes.dumDisplayImperial
' Change rounding to 1 inch
.RoundingImperial = 1
' Show inches and feet
.UNIT_MODE = .UNIT_MODE And Not (DigiPara.LDX.DocUnitModes.dumNoZeroInch Or DigiPara.LDX.DocUnitModes.dumNoZeroFeet)
Else
' Display units in metric
.UNIT_MODE = .UNIT_MODE Or DigiPara.LDX.DocUnitModes.dumDisplayMetric
' Change unit length to meters
.UNIT_MODE = .UNIT_MODE Or DigiPara.LDX.DocUnitModes.dumMeter
' Change rounding to 10 mm
.RoundingMetric = 10
End If
End With
End Sub