|
DigiPara Liftdesigner LDX API
|
API method: ILDXDocument5.OptiMode
Treename: Shaft0.Car.CD
' from Samples/Src/LDXAPIExamples/Example_LDXDocument.vb
<APIHelpAttribute(APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Shaft0.Car.CD", "LDXDocument~OptiMode", "Sloppy mode")>
Public Shared Sub SloppyMode(ldxDocument As DigiPara.LDX.LDXDocument)
If ldxDocument Is Nothing Then
MsgBox("Active document not found!")
Exit Sub
End If
With ldxDocument
If (.OptiMode And DigiPara.LDX.DocumentOptiModes.optiSloppy) <> DigiPara.LDX.DocumentOptiModes.optiSloppy Then
' Sloppy mode speeds up operations by cutting corners. All exports are guaranteed to be as correct as without sloppy mode,
' but displayed drawings and values may be out of date or simply incorrect. It is activated like this:
.OptiMode = .OptiMode Or DigiPara.LDX.DocumentOptiModes.optiSloppy
' You can fine tune which corners are cut by setting or clearing additional bits.
' This skips repeated iterations of the calculation code. Saves a lot of time and does not cause
' results that are permanently wrong; results are only expected to be wrong temporarily and then converge
' to correct values after one or two more edits.
' Still, if you can reliably produce such out of date results that correct themselves after
' additional calculation without RefModel code or XML rules, we would like to know; maybe it can be fixed.
.OptiMode = .OptiMode Or DigiPara.LDX.DocumentOptiModes.optiSloppyCalculateSingleIteration
' This skips updates to drawing updates on all but the currently active frame. The out of date frames
' are given a redish color to make that visible.
.OptiMode = .OptiMode Or DigiPara.LDX.DocumentOptiModes.optiSloppyOnlyUpdateCurrentFrame
' This one prevents saving undo states. Every user triggered undo will then go back to the state just before
' sloppy mode was activated.
.OptiMode = .OptiMode Or DigiPara.LDX.DocumentOptiModes.optiSloppySkipSaveUndo
' This deactivates execution of custom LDXRules. It is likely to cause wrong results if inputs to the rules change.
.OptiMode = .OptiMode Or DigiPara.LDX.DocumentOptiModes.optiSloppySkipXMLRules
' This deactivates execution of RefModel Client code executed in the ModelCalculating-Event.
' Very likely To cause wrong results, but also a big time saver.
.OptiMode = .OptiMode Or DigiPara.LDX.DocumentOptiModes.optiSloppySkipClient
MsgBox("Sloppy mode fully activated. Change things, see if you can notice anything.")
Else
' deactivate sloppy mode again. The individual control bits can stay on, they only take effect in sloppy mode.
.OptiMode = .OptiMode And Not DigiPara.LDX.DocumentOptiModes.optiSloppy
MsgBox("Sloppy mode deactivated.")
End If
' make change known to UI.
.CalculateModel(DigiPara.LDX.CalculateModelModes.rcmFireCalculatedEvent)
End With
End Sub