Skip to main content

ModelCenter APIs 2026 R1 SP03

createAndInitComponent

Last update: 30.07.2026

abstract fun createAndInitComponent(serverPath: String, name: String, parentName: String, initString: String, xPos: Long, yPos: Long): Component

Creates a new component and initializes it from string data. IMPORTANT NOTE: This method can only be invoked on plugins which support IComponentPlugin.fromString(). Furthermore, it should only be used when you know EXACTLY the format that is expected by the component's fromString() method. It is designed to be used from plugins in third-party software which need to initialize a matching component to connect to that software in the model. Ideally, both the plugin for the third-party software and the ModelCenter component WILL SHARE THE SAME CODEBASE, so you can generate the configuration string from the same code which you will use to process it later. Mismatch between formats will almost certainly cause this method to fail.

Return

the component created

Parameters

serverPath the server path, e.g. "mcre:\localhost\block"
name the name for the new component
parentName the parent component
initString the initialization string for the component (see above) if initString is NULL, behavior is identical to createComponent()
xPos the x position
yPos the y position

Throws

ModelCenterException

Connect with Ansys