place_ifc_object
Position IFC elements in a model by specifying coordinates and optional Z-axis rotation. Use this tool to place specific IFC types accurately in 3D space within a Blender-integrated environment.
Instructions
Place an IFC object at a specified location with optional rotation.
This tool allows you to create and position IFC elements in the model.
The object is placed using the specified IFC type and positioned
at the given coordinates with optional rotation around the Z axis.
Args:
type_name: Name of the IFC element type to place (must exist in the model)
x: X-coordinate in model space
y: Y-coordinate in model space
z: Z-coordinate in model space
rotation: Rotation angle in degrees around the Z axis (default: 0)
Returns:
A message with the result of the placement operation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rotation | No | ||
| type_name | Yes | ||
| x | Yes | ||
| y | Yes | ||
| z | Yes |
Implementation Reference
- tools.py:474-526 (handler)The main handler function for the 'place_ifc_object' MCP tool. It connects to Blender via socket, sends a 'place_ifc_object' command with parameters (type_name, location [x,y,z], rotation), handles the response, and returns success/error messages including object details.@mcp.tool() def place_ifc_object( type_name: str, x: float, y: float, z: float, rotation: float = 0.0, ctx: Context| None = None ) -> str: """ Place an IFC object at a specified location with optional rotation. This tool allows you to create and position IFC elements in the model. The object is placed using the specified IFC type and positioned at the given coordinates with optional rotation around the Z axis. Args: type_name: Name of the IFC element type to place (must exist in the model) x: X-coordinate in model space y: Y-coordinate in model space z: Z-coordinate in model space rotation: Rotation angle in degrees around the Z axis (default: 0) Returns: A message with the result of the placement operation """ try: # Get Blender connection blender = get_blender_connection() # Send command to place the object result = blender.send_command("place_ifc_object", { "type_name": type_name, "location": [x, y, z], "rotation": rotation }) # Check for errors if isinstance(result, dict) and "error" in result: return f"Error placing object: {result['error']}" # Format success message if isinstance(result, dict) and result.get("success"): return (f"Successfully placed '{type_name}' object at ({x}, {y}, {z}) " f"with {rotation}° rotation.\nObject name: {result.get('blender_name')}, " f"Global ID: {result.get('global_id')}") # Return the raw result as string if it's not a success or error dict return f"Placement result: {json.dumps(result, indent=2)}" except Exception as e: logger.error(f"Error placing IFC object: {str(e)}") return f"Error placing IFC object: {str(e)}"