Add object
addCreate SimWorks simulation objects by kind, optionally at specified coordinates or with custom mesh data; configure them with set_property and keep the returned Name for later selection.
Instructions
Add a simulation object (SimWorks add* only; configure with set_property).
After success, the reply includes Name='...'. Record that exact name for
later select / set / delete. Do not call add again for an object that already
exists (especially port_group, mode_port, fdtd) — if select fails, use
object_action path forms instead of re-adding.
Docs: https://simworks.net/knowledge-base/Script-Commands_setting-objects
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | Object to add (SimWorks script add* commands). Structures: polygon, triangle, rectangle, circle, ellipse, sector, circular_ring, elliptic_ring, sphere, pyramid, cone, linear_waveguide, arc_waveguide, linear_taper, sidewall_linear, sidewall_arc, sidewall_bezier, 2d_rectangle, 2d_polygon, photonic_crystal, planar_solid, equation, import_nk. planar_solid: optional vertices+facets for custom mesh (addplanarsolid overloads); otherwise default rectangle. Groups: group, structure_group, assembly_group, analysis_group. library_object: addobject from built-in library (needs script_id; omit script_id to list library ids). Sources: dipole, plane, tfsf, mode_source, gaussian, import_source, port_group, mode_port, eme_port, import_generation. Monitors: power_monitor, field_monitor, time_monitor, index_monitor, eme_profile, eme_index. Solvers/mesh: fdtd, fde, fdfd, eme, rcwa, fdcharge, mesh. Creation only — configure with set_property. Positions are SI meters. port_group / eme_port / import_generation take no coordinates. mode_port needs an active port group; eme_port needs an active EME port group; import_generation needs an existing fdcharge solver. Do not re-add an existing object; remember the Name returned by add. | |
| x_pos | No | Center x in meters (SI). Omit with y/z to use API default (no-arg add*). | |
| y_pos | No | Center y in meters (SI). | |
| z_pos | No | Center z in meters (SI). | |
| facets | No | For kind=planar_solid only: face list; each face is vertex indices (1-based, right-hand rule), e.g. [[1,4,3,2],[1,5,8,4],...]. Must be paired with vertices. | |
| vertices | No | For kind=planar_solid only: Nx3 vertex matrix in meters, each row [x, y, z]. Must be paired with facets. | |
| script_id | No | For kind=library_object: library script id. Omit to list available objects. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |