G-code Load Mesh Model
Get a real STL into the graph — with transforms and a preview, no slicer needed
- mesh
- preview
- mesh_info_json
- summary
Everything in the G-code lane that isn't a pure generator (a vase, a heightmap plate) needs an actual 3D model to work on. That's what this node is for: it loads an .stl or .obj from disk, applies placement transforms, and hands you a ready-to-use MKR_GCODE_MESH plus a rendered preview so you can see what you loaded without leaving ComfyUI.
What it does
The whole config lives in one settings_json string (the pack's style - every G-code node talks JSON). The two defaults that matter for a first load:
center_xy: true- recenters the model on the XY plane. Almost always what you want, because STLs come in at arbitrary coordinates.bed_align: true- drops the mesh down so the lowest point sits at Z=0, i.e. on the virtual bed. Turn this off only if your model is already pre-positioned.
From there you get the usual transform toolbox: scale, rotate_x/y/z_deg, translate_x/y/z_mm, and a neat one, target_longest_mm, which rescales the model so its longest axis is exactly that size - handy when you need "fits in a 100 mm box" without doing the math yourself. preview_view picks isometric or top for the rendered preview, and preview_size sets the preview resolution.
What's inside
The node parses the mesh file into a triangle payload - vertices, faces, bounds, and a triangle count - wrapped as the MKR_GCODE_MESH type. That's what MKRGCodeExternalSlicer slices and what MKRGCodePreview can render as a wireframe. The bounds are also what MKRGCodePlanAnalyzer uses to judge bed usage, so a properly bed-aligned mesh makes the whole downstream analysis honest.
Outputs
mesh(MKR_GCODE_MESH) - the triangle payload, the star of the show.preview(IMAGE) - a rendered look at the mesh so you can confirm orientation before you slice.mesh_info_json- source path, triangle count, bounds, metadata, warnings.summary- one line: filename, triangles, and height in mm.
Wiring it up
The classic pipeline:
MKRGCodeLoadMeshModel → MKRGCodeExternalSlicer → MKRGCodePreview → MKRGCodeExport
Load the model, slice it with a real slicer, preview the resulting toolpath, and export the .gcode. You can also skip the slicer entirely and just send the mesh straight to MKRGCodePreview for a wireframe check.
Installing it
Part of the pack, so it installs with everything else:
# ComfyUI Manager: search "MKRShift Nodes", install, restart.
# or:
cd ComfyUI/custom_nodes
git clone https://github.com/criskb/MKRShift_Nodes
# restart ComfyUI
No extra dependencies. The mesh parsing is pure Python; no numpy-stl, no trimesh, no model downloads.
Where people get burned
The one thing that trips everyone up: model_path is a server-side filesystem path, not an upload. ComfyUI is a web UI but runs a local server, and this node reads the file from that machine's disk. If you're running ComfyUI on a remote box or in Docker, the file has to live there (or be in a mounted volume). A missing or mistyped path doesn't crash - the node returns a warning and an empty mesh, and anything downstream quietly does nothing or errors on the missing triangles. So check summary and mesh_info_json after a load; a nonzero triangle count is your confirmation the file actually parsed.
Also note the file-based nature means STL/OBJ only - no STEP, no 3MF. For CAD formats you'd convert first. For what it covers (the two classic FDM mesh formats), it's solid.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| settings_json | STRING | {"model_path":"","center_xy":true,"bed_align":true,"scale":1.0,"target_longest_mm":0.0,"rotate_x_deg":0.0,"rotate_y_deg":0.0,"rotate_z_deg":0.0,"translate_x_mm":0.0,"translate_y_mm":0.0,"translate_z_mm":0.0,"preview_view":"isometric","preview_size":768} | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| mesh | MKR_GCODE_MESH | — |
| preview | IMAGE | — |
| mesh_info_json | STRING | — |
| summary | STRING | — |