Skip to main content
Glama

flexsim_import_shape

Assign a 3D shape file to an existing object by loading, indexing, and applying the model in one step (window backend only).

Instructions

Import a 3D shape file onto an existing object (window backend only).

Receta verificada en Commands.xml local (FlexSim 2026,
help/CommandReference/Commands.xml; usar EXACTAMENTE estos comandos y firmas):
- loadthreedobject(str file, str name)->num "Load a 3D model directly...
  recorded in Media List" (el cargador; paths con / simples).
  Ejemplo XML: loadthreedobject("c:/myshape.wrl","myshape")
- getshapeindex(str name) con DOBLE backslash obligatorio ("The file path
  name used in this command must use double backslashes as shown in the
  example"). Ejemplo XML: getshapeindex("fs3d\\Operator\\BasicOperator\\Chest.3ds");
- setobjectshapeindex(obj object, num index) + verificacion
  getobjectshapeindex(obj object). Ejemplo XML:
  setobjectshapeindex(item,getshapeindex("fs3d\\Processor.3ds"));
  ejemplo get: getobjectshapeindex(item);
- truncatemediapath(str path) para reportar como quedo referenciado
  ("If this file exists relative to the model directory, then the path
  will be truncated to be relative to the model directory").
- applyshapefactors(obj object) tras set de o.size.x/y/z ("This command
  applies all of the shape factors to the object if it has any").
  Ejemplo XML: applyshapefactors(item);

Vecinas leidas antes de escribir: flexsim_create_objects (patron
require_gui + Model.find NULL-check + Object.create/name/setLocation +
check_script_safety por script + format_error), _last_link (helpers de
verificacion por colecciones), fs_string (citado de strings via json.dumps,
que produce el \\ doble en fuente FlexScript a partir de un valor con
\ simple) y require_gui (solo ventana).

Contrato: EXITO devuelve JSON {object, file, copied, shape_name,
shape_index, assigned_index, media_ref, size} (+ "warning" solo cuando
getshapeindex difiere del idx de load). ERRORES son texto plano
"Error:/Not found:/Blocked for safety:" como el resto de tools simples
(NO {"error":...}); el exito es el unico caso JSON.

Flujo: 1) existe objeto (Model.find NULL-check). 2) si
copy_next_to_model: destino = dir(_gui_model_path o _current_model)+nombre;
si el archivo ya esta ahi, no copiar; shutil.copyfile (Python, no
FlexScript) + reporta copied:true/false. 3) loadthreedobject(abs con
slashes, shape_name) -> idx; si idx==0 -> error "no cargo (formato? ver
lagunas)" SIN seguir. 4) getshapeindex(abs con \) debe == idx (si
difiere, warning pero sigue con idx de load). 5) setobjectshapeindex +
getobjectshapeindex de vuelta == idx -> si no, error. 6) set_size_xyz
se IGNORA a propósito (o.size rompe el render de importadas; escalar
el archivo con utility/scale_stl.py).

IMPORTANTE: asignaciones por script son POR SESIÓN (verificado
2026-09-27: tras guardar+reabrir no persisten). Usar manifiesto +
flexsim_apply_shapes al abrir el modelo.

Lagunas: escala real por verificar visual; reset puede revertir
textura (shape no documentado).

Args:
    file_path: archivo existente; extension en {.skp,.fbx,.obj,.stl,.dae,
        .3ds,.wrl,.x,.blend,.usd,.jt,.igs,.stp,.step,.glb} case-insensitive.
    object: debe existir via Model.find, si no Not found.
    shape_name: default = stem sanitizado [A-Za-z0-9_].
    copy_next_to_model: default True.
    set_size_xyz: aceptado pero ignorado (ver arriba).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full behavioral burden and does so thoroughly: it documents session-only script assignments, the plain-text error format, the success JSON contract, copy behavior, verification steps, and known limitations. It also warns that set_size_xyz is intentionally ignored and why.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded, but the description is heavily overloaded with internal verification notes, command snippets, XML examples, and mixed-language commentary that do not all help an agent select or invoke the tool. Much of the implementation detail could be moved out or summarized without losing decision-relevant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity, lack of annotations, and the existence of an output schema, the description is complete enough: it covers prerequisites, flow, error modes, return contract, persistence caveats, and known gaps. An agent has what it needs to call the tool correctly and interpret outcomes.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it does: it explains file_path extensions, object existence requirements, shape_name sanitization default, copy_next_to_model default, and the intentionally ignored set_size_xyz argument. This adds meaning well beyond the bare schema types and defaults.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first sentence gives a specific verb and resource: importing a 3D shape file onto an existing object, with the window-backend scope stated up front. The description also implies the relationship to flexsim_apply_shapes for persistence, so an agent can distinguish this import action from later reapplication.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives a clear usage context (window backend only) and an explicit flow for when and how to use the tool, including the copy-next-to-model and verification steps. It also names flexsim_apply_shapes for reopening a model, but does not systematically compare all alternative shape-related siblings or state when not to use this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools