GUI API (experimental)
OMFrontend.GUI_API is an API for graphical model editors: load a model, read its diagram (components, placements, connections), edit placements and connections as text patches of the source, save, and compile or simulate through delegates. It is experimental.
Types
OMFrontend.GUI_API.SourceSpan — Type
SourceSpanByte offsets and one-based line/column positions for a source range.
OMFrontend.GUI_API.TextPatch — Type
TextPatchReplacement text for a source range, expressed in byte offsets.
OMFrontend.GUI_API.ValidationResult — Type
ValidationResultResult of validating a loaded Modelica session.
OMFrontend.GUI_API.OperationResult — Type
OperationResultResult of a mutating diagram/model operation.
OMFrontend.GUI_API.SaveResult — Type
SaveResultPath and byte count returned after saving a model session.
OMFrontend.GUI_API.DiagramNode — Type
DiagramNodeDiagram or icon placement data for one component declaration.
OMFrontend.GUI_API.DiagramConnection — Type
DiagramConnectionDiagram connection data extracted from a connect(...) equation.
OMFrontend.GUI_API.DiagramModel — Type
DiagramModelCoordinate system, component nodes, and connections for one class view.
OMFrontend.GUI_API.ModelSession — Type
ModelSessionParsed Modelica source plus indexes used by the GUI editing API.
Functions
OMFrontend.GUI_API.setExecutionDelegates! — Function
setExecutionDelegates!(; compileModel = nothing, simulateModel = nothing, exportFlatModelica = nothing)Register callbacks used by compileModel, simulateModel, and exportFlatModelica. Each callback receives (classPath, tempPath; kwargs...).
OMFrontend.GUI_API.loadModel — Function
loadModel(path::String) -> ModelSessionLoad, parse, and index a Modelica source file for GUI inspection and editing.
OMFrontend.GUI_API.validateModel — Function
validateModel(session::ModelSession, classPath::String) -> ValidationResultReturn the current validation result for classPath in a loaded session.
OMFrontend.GUI_API.getDiagram — Function
getDiagram(session::ModelSession, classPath::String; view = :Diagram) -> DiagramModelExtract component placements and connections for the requested class view. Use view = :Icon to read icon placements instead of diagram placements.
OMFrontend.GUI_API.updateComponentPlacement — Function
updateComponentPlacement(session::ModelSession, componentPath::String, placementPatch) -> OperationResultMerge placementPatch into a component's Placement annotation and update the session source text.
OMFrontend.GUI_API.createConnection — Function
createConnection(session::ModelSession, fromConnector::String, toConnector::String; classPath = nothing, linePatch = nothing) -> OperationResultInsert a connect(...) equation and optional Line annotation into the owning class.
OMFrontend.GUI_API.updateConnectionAnnotation — Function
updateConnectionAnnotation(session::ModelSession, connectionId::String, linePatch) -> OperationResultMerge linePatch into an existing connection's Line annotation.
OMFrontend.GUI_API.deleteConnection — Function
deleteConnection(session::ModelSession, connectionId::String) -> OperationResultRemove a connection equation from the loaded session.
OMFrontend.GUI_API.saveModel — Function
saveModel(session::ModelSession; targetPath = nothing) -> SaveResultWrite the current session source text to disk.
OMFrontend.GUI_API.compileModel — Function
compileModel(session::ModelSession, classPath::String; kwargs...)Call the registered compile delegate for classPath.
OMFrontend.GUI_API.simulateModel — Function
simulateModel(session::ModelSession, classPath::String; kwargs...)Call the registered simulate delegate for classPath.
OMFrontend.GUI_API.exportFlatModelica — Function
exportFlatModelica(session::ModelSession, classPath::String; kwargs...)Call the registered flat-Modelica export delegate for classPath.
Index
OMFrontend.GUI_API.DiagramConnectionOMFrontend.GUI_API.DiagramModelOMFrontend.GUI_API.DiagramNodeOMFrontend.GUI_API.ModelSessionOMFrontend.GUI_API.OperationResultOMFrontend.GUI_API.SaveResultOMFrontend.GUI_API.SourceSpanOMFrontend.GUI_API.TextPatchOMFrontend.GUI_API.ValidationResultOMFrontend.GUI_API.compileModelOMFrontend.GUI_API.createConnectionOMFrontend.GUI_API.deleteConnectionOMFrontend.GUI_API.exportFlatModelicaOMFrontend.GUI_API.getDiagramOMFrontend.GUI_API.loadModelOMFrontend.GUI_API.saveModelOMFrontend.GUI_API.setExecutionDelegates!OMFrontend.GUI_API.simulateModelOMFrontend.GUI_API.updateComponentPlacementOMFrontend.GUI_API.updateConnectionAnnotationOMFrontend.GUI_API.validateModel