lmcad reference

Command-line flags, exit codes, host types, methods, functions, limits and standard-library signatures of lmcad 0.1.5, generated from the release binary (lmcad --lmcode-schema and lmcad --lmcode-signatures) and the repository README. Types in signatures are int, float, string, bool and the host or standard types named here.

Command line

CommandEffect
lmcad --versionPrints lmcad X.Y.Z. The release tag vX.Y.Z and the binary version must agree for install="github:lmctl-ai/lmcad@latest".
lmcad --lmcode-schemaPrints a compact summary: the context line, then free functions, then members grouped by type.
lmcad --lmcode-schema --jsonPrints the embedded schema bytes exactly (dsl.schema 2, name lmcad). This is the compiler input.
lmcad --lmcode-signaturesPrints the canonical signature list of the host registry, host and standard: 271 lines in 0.1.5.
lmcad --lmcode FILE [FILE ...]Runs compiled program files in argument order. Objects and scene state persist between files; locals are fresh for each file. The first failure stops execution.

With no arguments or an unknown flag the host prints its usage line and exits 2. Failures also print a JSON result between the lines LMCODE_RETURN_BEGIN and LMCODE_RETURN_END.

Exit codes

CodeMeaning
0Success; one JSON result line per completed block.
2Invalid command line. The host prints its usage line and a CLI_USAGE result (phase cli).
3Program file load failure or a block or host run failure.
4Another application failure.

Used from lmscript

FormMeaning
p = _lmcode_ cli="lmcad" install="github:lmctl-ai/lmcad@latest"; ... end _lmcode_Declares a block compiled against the schema the lmcad binary reports. install lets lmscript download the released binary when needed.
r = run_lmcode(p)Runs the block on the host and returns a result with ok and result; the repository examples print r.stderr and r.stdout on failure.
lmscript --check FILE.lmsCompiles every block against the host schema without running it.
lmctl autorun URLDownloads and runs an example .lms, fetching the released lmcad.

Context and host types

NameKindRole
sceneContext object of type SceneThe one entry point of a block.
SceneHost typeSolids, sketches, lights, cameras, renders, exports and assertions.
ShapeHost typeHandle to an OpenCASCADE solid: transforms, booleans, edge treatment, volume and bounds.
SketchHost typeStraight-segment 2D polygon to extrude or revolve.
MaterialHost typeDisplay color and Blinn-Phong surface parameters.
CameraHost typeView returned by camera and fit_camera.
LightHost typeDirectional or fill light.
AnimationHost typeAPNG writer.
KeyframesHost typeCollection read from CSV; supports len, at and for-in iteration.
KeyframeHost typeOne CSV row: time, position and color.

The schema declares no enum types.

Host functions

SignatureReturnsDescription
material()MaterialCreates a material; chain color, roughness, specular and shininess.
read_keyframes_csv(string)KeyframesReads keyframes from a CSV file path.

Scene methods

SignatureReturnsDescription
Scene.ambient(float)SceneSets the ambient light level; returns the scene for chaining.
Scene.animation(string, int, int, int)AnimationOpens an APNG writer: path, width, height, frames per second (integer 1 to 240).
Scene.assert_close(float, float, float)voidFails the run unless actual and expected agree within the tolerance: actual, expected, tolerance.
Scene.background(float, float, float)SceneSets the background color from red, green, blue components.
Scene.box(float, float, float, Material)ShapeBox solid from three dimensions and a material.
Scene.camera(float, float, float, float, float, float, float)CameraCreates an explicit camera from seven numbers (field of view, then position and target coordinates as used in the tutorial).
Scene.cylinder(float, float, Material)ShapeCylinder solid from radius, height and a material.
Scene.directional_light(float, float, float, float)LightAdds a directional light: direction x, y, z and intensity.
Scene.export_obj(string)voidWrites the scene mesh as text OBJ to the path.
Scene.export_stl(string)voidWrites the scene mesh as binary STL to the path.
Scene.extrude(Sketch, float, Material)ShapeExtrudes a closed sketch by a height into a solid.
Scene.fill_light(float, float, float, float)LightAdds a fill light: direction x, y, z and intensity.
Scene.fit_camera(float, float)CameraFits the camera to the scene: field of view and margin. Explicit look_at or clipping settings turn off automatic fitting.
Scene.render_png(string, int, int)voidRenders the scene to a PNG: path, width, height.
Scene.render_ppm(string, int, int)voidRenders the scene to an RGB PPM: path, width, height.
Scene.revolve_y(Sketch, Material)ShapeRevolves a closed sketch around the y axis into a solid.
Scene.sketch()SketchStarts an empty 2D sketch.
Scene.sphere(float, Material)ShapeSphere solid from radius and a material.
Scene.supersample(int)SceneSets n by n supersampling, n from 1 to 8; output dimensions stay unchanged.
Scene.tube_between(float, float, float, float, float, float, float, Material)ShapeSolid cylindrical segment between two 3D endpoints: x1, y1, z1, x2, y2, z2, radius, material.

Shape methods

SignatureReturnsDescription
Shape.chamfer(float)ShapeChamfers the edges by a distance.
Shape.color(float, float, float)ShapeSets the display color from red, green, blue.
Shape.cut(Shape)ShapeBoolean difference: removes the argument shape.
Shape.fillet(float)ShapeRounds the edges by a radius.
Shape.hollow(float)ShapeShells the solid to a wall thickness.
Shape.hollow_top(float)ShapeShells the solid to a wall thickness, leaving the top open.
Shape.intersect(Shape)ShapeBoolean intersection with the argument shape.
Shape.max_x()floatBounding-box maximum x.
Shape.max_y()floatBounding-box maximum y.
Shape.max_z()floatBounding-box maximum z.
Shape.min_x()floatBounding-box minimum x.
Shape.min_y()floatBounding-box minimum y.
Shape.min_z()floatBounding-box minimum z.
Shape.mirror(string)ShapeMirrors the shape; the string selects the mirror plane or axis.
Shape.name(string)ShapeNames the shape.
Shape.position(float, float, float)ShapePlaces the shape at x, y, z.
Shape.rotate(float, float, float)ShapeRotates the shape by three angles.
Shape.scale(float, float, float)ShapeScales the shape by x, y, z factors.
Shape.translate(float, float, float)ShapeMoves the shape by dx, dy, dz.
Shape.union(Shape)ShapeBoolean union with the argument shape.
Shape.visible(bool)ShapeShows or hides the shape in renders.
Shape.volume()floatB-rep volume of the solid.

Sketch methods

SignatureReturnsDescription
Sketch.close()SketchCloses the polygon.
Sketch.point(float, float)SketchAppends a vertex x, y; segments are straight.

Material methods

SignatureReturnsDescription
Material.color(float, float, float)MaterialSets red, green, blue.
Material.roughness(float)MaterialSets roughness.
Material.shininess(float)MaterialSets Blinn-Phong shininess.
Material.specular(float)MaterialSets specular strength.

Camera methods

SignatureReturnsDescription
Camera.clipping(float, float)CameraSets near and far clipping distances.
Camera.look_at(float, float, float, float, float, float)CameraSets eye position and target from six coordinates.

Light methods

SignatureReturnsDescription
Light.intensity(float)LightSets the light intensity.

Animation methods

SignatureReturnsDescription
Animation.add_frame()AnimationRenders the current scene as the next frame.
Animation.finish()voidFinishes the file and atomically replaces the destination; an unfinished animation is discarded.

Keyframes methods

SignatureReturnsDescription
Keyframes.at(int)KeyframeKeyframe at a zero-based index.
Keyframes.len()intNumber of keyframes.

Keyframe methods

SignatureReturnsDescription
Keyframe.b()floatBlue color component.
Keyframe.g()floatGreen color component.
Keyframe.r()floatRed color component.
Keyframe.time()floatTime value of the keyframe.
Keyframe.x()floatPosition x.
Keyframe.y()floatPosition y.
Keyframe.z()floatPosition z.

Host limits

ItemLimit
Sketch coordinateswithin ±500 units
Part extent1000 units
Faces per shape2000
Edges per shape10,000
Triangles1,000,000
Supersampling1 to 8; each raster dimension times n at most 8192
Pixels per frame16,777,216
Animation frames240
Total animation frame pixels64,000,000
Animation frame rateinteger 1 through 240

Output formats

FormatProduced byNotes
PNGScene.render_pngStill images; deterministic encoding.
PPMScene.render_ppmSimple RGB raster.
APNGScene.animation, Animation.add_frame, Animation.finishLoops forever with exact rational frame delays.
STLScene.export_stlBinary triangle mesh; write-only.
OBJScene.export_objText mesh; write-only.

Standard library

lmcad 0.1.5 ships 206 standard-library signatures (the lmcode_std_v3 catalog at 206). The current lmcode_std_v3 catalog has 226 signatures, adding the REST and CLI interfaces; lmcad picks those up when it syncs and releases, and the 0.1.5 binary does not register them.

Standard functions

GroupSignatureReturns
Collectionsfloat_list()FloatList
Collectionsfloat_map()FloatMap
Collectionsfloat_pq()FloatPQ
Collectionsfloat_queue()FloatQueue
Collectionsfloat_stack()FloatStack
Collectionsint_list()IntList
Collectionsint_map()IntMap
Collectionsint_pq()IntPQ
Collectionsint_queue()IntQueue
Collectionsint_stack()IntStack
Collectionsstr_list()StrList
Collectionsstr_map()StrMap
Collectionsstr_pq()StrPQ
Collectionsstr_queue()StrQueue
Collectionsstr_stack()StrStack
Filesfile_append(string, string)void
Filesfile_exists(string)bool
Filesfile_lines(string)StrList
Filesfile_read(string)string
Filesfile_write(string, string)void
JSON and templatesjson_parse(string)Json
JSON and templatestemplate_render(string, Json)string
Mathmath_abs(float)float
Mathmath_abs(int)int
Mathmath_ceil(float)float
Mathmath_ceil(int)int
Mathmath_floor(float)float
Mathmath_floor(int)int
Mathmath_max(float, float)float
Mathmath_max(int, int)int
Mathmath_min(float, float)float
Mathmath_min(int, int)int
Mathmath_pow(float, float)float
Mathmath_pow(int, int)int
Mathmath_round(float)float
Mathmath_round(int)int
Mathmath_sqrt(float)float
Mathmath_sqrt(int)int
Return valueslmcode_return_null()void
Return valueslmcode_return_put(string, FloatList)void
Return valueslmcode_return_put(string, FloatMap)void
Return valueslmcode_return_put(string, IntList)void
Return valueslmcode_return_put(string, IntMap)void
Return valueslmcode_return_put(string, Json)void
Return valueslmcode_return_put(string, StrList)void
Return valueslmcode_return_put(string, StrMap)void
Return valueslmcode_return_put(string, bool)void
Return valueslmcode_return_put(string, float)void
Return valueslmcode_return_put(string, int)void
Return valueslmcode_return_put(string, string)void
Return valueslmcode_return_put_null(string)void
Return valueslmcode_return_set(FloatList)void
Return valueslmcode_return_set(FloatMap)void
Return valueslmcode_return_set(IntList)void
Return valueslmcode_return_set(IntMap)void
Return valueslmcode_return_set(Json)void
Return valueslmcode_return_set(StrList)void
Return valueslmcode_return_set(StrMap)void
Return valueslmcode_return_set(bool)void
Return valueslmcode_return_set(float)void
Return valueslmcode_return_set(int)void
Return valueslmcode_return_set(string)void
Stringsstr_base64_decode(string)string
Stringsstr_base64_encode(string)string
Stringsstr_contains(string, string)bool
Stringsstr_ends_with(string, string)bool
Stringsstr_find(string, string)int
Stringsstr_hex_decode(string)string
Stringsstr_hex_encode(string)string
Stringsstr_is_float(string)bool
Stringsstr_is_int(string)bool
Stringsstr_len(string)int
Stringsstr_lower(string)string
Stringsstr_match(string, string)bool
Stringsstr_repeat(string, int)string
Stringsstr_replace(string, string, string)string
Stringsstr_split(string, string)StrList
Stringsstr_starts_with(string, string)bool
Stringsstr_substr(string, int, int)string
Stringsstr_to_float(string)float
Stringsstr_to_int(string)int
Stringsstr_trim(string)string
Stringsstr_upper(string)string

Standard types and methods

TypeSignatureReturns
FloatListFloatList.add(float)FloatList
FloatListFloatList.at(int)float
FloatListFloatList.clear()FloatList
FloatListFloatList.contains(float)bool
FloatListFloatList.index_of(float)int
FloatListFloatList.len()int
FloatListFloatList.set(int, float)FloatList
FloatMapFloatMap.clear()FloatMap
FloatMapFloatMap.get(string)float
FloatMapFloatMap.get_or(string, float)float
FloatMapFloatMap.has(string)bool
FloatMapFloatMap.key_at(int)string
FloatMapFloatMap.keys()StrList
FloatMapFloatMap.len()int
FloatMapFloatMap.remove(string)bool
FloatMapFloatMap.set(string, float)FloatMap
FloatMapFloatMap.values()FloatList
FloatPQFloatPQ.clear()FloatPQ
FloatPQFloatPQ.empty()bool
FloatPQFloatPQ.len()int
FloatPQFloatPQ.peek()float
FloatPQFloatPQ.pop()float
FloatPQFloatPQ.push(float, float)FloatPQ
FloatQueueFloatQueue.at(int)float
FloatQueueFloatQueue.clear()FloatQueue
FloatQueueFloatQueue.empty()bool
FloatQueueFloatQueue.len()int
FloatQueueFloatQueue.peek()float
FloatQueueFloatQueue.pop()float
FloatQueueFloatQueue.push(float)FloatQueue
FloatStackFloatStack.at(int)float
FloatStackFloatStack.clear()FloatStack
FloatStackFloatStack.empty()bool
FloatStackFloatStack.len()int
FloatStackFloatStack.peek()float
FloatStackFloatStack.pop()float
FloatStackFloatStack.push(float)FloatStack
IntListIntList.add(int)IntList
IntListIntList.at(int)int
IntListIntList.clear()IntList
IntListIntList.contains(int)bool
IntListIntList.index_of(int)int
IntListIntList.len()int
IntListIntList.set(int, int)IntList
IntMapIntMap.clear()IntMap
IntMapIntMap.get(string)int
IntMapIntMap.get_or(string, int)int
IntMapIntMap.has(string)bool
IntMapIntMap.key_at(int)string
IntMapIntMap.keys()StrList
IntMapIntMap.len()int
IntMapIntMap.remove(string)bool
IntMapIntMap.set(string, int)IntMap
IntMapIntMap.values()IntList
IntPQIntPQ.clear()IntPQ
IntPQIntPQ.empty()bool
IntPQIntPQ.len()int
IntPQIntPQ.peek()int
IntPQIntPQ.pop()int
IntPQIntPQ.push(int, float)IntPQ
IntQueueIntQueue.at(int)int
IntQueueIntQueue.clear()IntQueue
IntQueueIntQueue.empty()bool
IntQueueIntQueue.len()int
IntQueueIntQueue.peek()int
IntQueueIntQueue.pop()int
IntQueueIntQueue.push(int)IntQueue
IntStackIntStack.at(int)int
IntStackIntStack.clear()IntStack
IntStackIntStack.empty()bool
IntStackIntStack.len()int
IntStackIntStack.peek()int
IntStackIntStack.pop()int
IntStackIntStack.push(int)IntStack
JsonJson.as_bool()bool
JsonJson.as_float()float
JsonJson.as_int()int
JsonJson.as_string()string
JsonJson.at(int)Json
JsonJson.get(string)Json
JsonJson.has(string)bool
JsonJson.keys()StrList
JsonJson.kind()string
JsonJson.len()int
JsonJson.to_json()string
StrListStrList.add(string)StrList
StrListStrList.at(int)string
StrListStrList.clear()StrList
StrListStrList.contains(string)bool
StrListStrList.index_of(string)int
StrListStrList.join(string)string
StrListStrList.len()int
StrListStrList.set(int, string)StrList
StrMapStrMap.clear()StrMap
StrMapStrMap.get(string)string
StrMapStrMap.get_or(string, string)string
StrMapStrMap.has(string)bool
StrMapStrMap.key_at(int)string
StrMapStrMap.keys()StrList
StrMapStrMap.len()int
StrMapStrMap.remove(string)bool
StrMapStrMap.set(string, string)StrMap
StrMapStrMap.values()StrList
StrPQStrPQ.clear()StrPQ
StrPQStrPQ.empty()bool
StrPQStrPQ.len()int
StrPQStrPQ.peek()string
StrPQStrPQ.pop()string
StrPQStrPQ.push(string, float)StrPQ
StrQueueStrQueue.at(int)string
StrQueueStrQueue.clear()StrQueue
StrQueueStrQueue.empty()bool
StrQueueStrQueue.len()int
StrQueueStrQueue.peek()string
StrQueueStrQueue.pop()string
StrQueueStrQueue.push(string)StrQueue
StrStackStrStack.at(int)string
StrStackStrStack.clear()StrStack
StrStackStrStack.empty()bool
StrStackStrStack.len()int
StrStackStrStack.peek()string
StrStackStrStack.pop()string
StrStackStrStack.push(string)StrStack

Standard REST and CLI interfaces

These belong to the current 226-signature lmcode_std_v3 catalog. They are not registered by lmcad 0.1.5 (lmcad --lmcode-signatures lists none of them), so blocks for this release cannot call them; the table records what arrives when lmcad syncs to the current catalog.

ItemKindStatus in lmcad 0.1.5
RestGetStandard interfaceNot available
RestPostStandard interfaceNot available
RestPutStandard interfaceNot available
RestDeleteStandard interfaceNot available
RestPatchStandard interfaceNot available
RestHeadStandard interfaceNot available
RestOptionsStandard interfaceNot available
RestHandlerStandard interfaceNot available
CliCommandStandard interfaceNot available
CliOptionStandard interfaceNot available
rest_config(string, string) -> voidStandard functionNot available
rest_route(string, string, string) -> voidStandard functionNot available
rest_serve() -> voidStandard functionNot available
rest_stop() -> voidStandard functionNot available
rest_cli(StrList) -> stringStandard functionNot available
RestExchange (15 methods)Standard typeNot available