|
DigiPara Liftdesigner LDX API
|
API method: ILDXDocument5.CalculateModel
3 code examples follow.
' from Samples/Src/LDXAPIExamples/Example_LDXDocument.vb
<APIHelpAttribute(APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "", "LDXDocument~CalculateModel", "Recalculate Project")>
Public Shared Sub RecalculateProject(ldxDocument As DigiPara.LDX.LDXDocument)
If ldxDocument Is Nothing Then
MsgBox("Active document not found!")
Exit Sub
End If
' random change to data model
ldxDocument.Shafts.ActiveShaft.Car.CW += 100
' updates all calculations, sends events and then updates the current sheet
ldxDocument.CalculateModelAndBuildSheet(DigiPara.LDX.CalculateModelModes.rcmFireCalculatedEvent Or DigiPara.LDX.CalculateModelModes.rcmCalcAndReport, ldxDocument.Sheets.ActiveSheet)
End Sub
' from Samples/Src/LDXAPIExamples/Example_LDXDocument.vb
<APIHelpAttribute(APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "", "LDXDocument~CalculateModel", "Rebuild Current Sheet")>
Public Shared Sub RebuildSheet(ldxDocument As DigiPara.LDX.LDXDocument)
If ldxDocument Is Nothing Then
MsgBox("Active document not found!")
Exit Sub
End If
' random change to current frame
ldxDocument.Sheets.ActiveSheet.ActiveSheetFrame.X0 += 10
' This does not do a full calculation, but only updates the current sheet to any model or view frame changes
ldxDocument.CalculateModelAndBuildSheet(DigiPara.LDX.CalculateModelModes.rcmNone, ldxDocument.Sheets.ActiveSheet)
' Actually makes changes visible (would happen if user moves the mouse pointer over the drawing)
ldxDocument.Sheets.ActiveSheet.View.Refresh()
' Later switches to other sheets will see them rebuilt, too.
End Sub
' from Samples/Src/LDXAPIExamples/Example_LDXDocument.vb
<APIHelpAttribute(APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "", "LDXDocument~CalculateModel", "Rebuild Current Frame Only")>
Public Shared Sub RebuildSheetFrame(ldxDocument As DigiPara.LDX.LDXDocument)
If ldxDocument Is Nothing Then
MsgBox("Active document not found!")
Exit Sub
End If
' random change to current frame
ldxDocument.Sheets.ActiveSheet.ActiveSheetFrame.X0 += 10
' This marks the current sheet frame as dirty (not actually required for the above change in position)
ldxDocument.Sheets.ActiveSheet.ActiveSheetFrame.Comp.CalculateModel(DigiPara.LDX.CompCalculateModelModes.crvmNone)
' This rebuilds only the sheet frame that has been marked dirty above
ldxDocument.CalculateModelAndBuildSheet(DigiPara.LDX.CalculateModelModes.rcmKeepCleanFrames, ldxDocument.Sheets.ActiveSheet)
' Actually makes changes visible (would happen if user moves the mouse pointer over the drawing)
ldxDocument.Sheets.ActiveSheet.View.Refresh()
' If there truly was just a change to one frame, this is the quickest way to make it visible.
End Sub