User Tools

Site Tools


ig:gfx:model-configuration-and-parameters

This is an old revision of the document!


Model Configuration and Parameters

Setting Up Paths for Model.Processor

Introduction Paths

This section explains how 2D paths, used as profiles in 3D modeling, are defined and parsed. Paths are typically specified using SVG (Scalable Vector Graphics) commands, which describe movements, lines, and curves to form complex shapes. These paths are converted into a structured JSON format to be used programmatically within the IG.Model.Processor software.

Understanding SVG path commands is essential because the software interprets these commands to generate precise geometry. The following subsections detail the key SVG commands supported, their usage, and how they translate into the custom JSON format.

Understanding SVG Form

We provide a brief overview of SVG file path commands. The table below lists the individual commands used to construct paths in SVG format. This documentation summarizes the key commands relevant to their use within this software.

SVG Commands that are supported by Model.Processor

Command Name What it Does
:—: :— :—
M/m Move To Moves the pen to (x, y) without drawing a line.
L/l Line To Draws a straight line to (x, y).
H/h Horizontal Line To Draws a horizontal line to x.
V/v Vertical Line To Draws a vertical line to y.
Z/z Close Path Closes the current path by drawing to the start.

Curve Commands

Command Name What it Does
:—: :— :—
C/c Cubic Bezier Curve Draws a curve using two control points and an end point.
S/s Smooth Cubic Bezier Curve Continues a cubic curve with one control point (auto-reflects).
Q/q Quadratic Bezier Curve Uses one control point and an end point.
T/t Smooth Quadratic Curve Continues a quadratic curve (auto-reflects control point).

Arc Command

Command Name What it Does
:—: :— :—
A/a Elliptical Arc Draws an arc curve (ellipse shape) with radii, rotation, and flags.

JSON Path Commands in IG.Model.Processor\\(in millimeters)

The following commands are supported in the JSON format. Each command's uppercase form denotes absolute positioning, and the lowercase form denotes relative positioning, following the provided in this link SVG Path Data specification.

Command Description
:— :—
M xy / m xy Move To (absolute / relative)
L xy / l xy Line To (absolute / relative)
H x / h x Horizontal Line To (absolute / relative)
V y / v y Vertical Line To (absolute / relative)
Z / z, E / e Close Path (no parameters). E is a custom synonym.
C x1 y1 x2 y2 x y / c x1 y1 x2 y2 x y Cubic Bézier Curve (absolute / relative)
Q x1 y1 x y / q x1 y1 x y Quadratic Bézier Curve (absolute / relative)
A / a rx ry x-axis-rotation large-arc-flag sweep-flag x y Elliptical Arc Curve\\Parameters:\\* x, y: Ellipse radii\\* x-axis-rotation: Ellipse rotation in degrees\\* large-arc-flag: Selects the larger (1) or smaller (0) arc\\* sweep-flag: Determines arc direction (1 or 0)\\* x, y: Arc end point

Relative commands (lowercase like l, m, c) move relative to the current point. Example: l 50 0 means “draw a line 50 units over from where I am now.”

Absolute commands (uppercase like L, M, C) move to exact coordinates in the SVG canvas. Example: L 100 100 means “draw a line to exactly (100, 100).”

Both do the same kinds of things (move, curve, etc.), but relative is like “step this far from here,” and absolute is like “go exactly there.”


Parsing paths into custom JSON Format

After reading the SVG path data, each path can be converted into a structured JSON format to describe its geometry programmatically. For this purpose there is parser in development or it can be done manually or just by instructing “LLM” (Large Language Model)

The JSON object includes:

  • paths: An array of path objects. Each path object contains:
    • id: A unique identifier for the path (e.g., board).
    • path: An array of command segments that describe the path.
    • quality: An optional override of the global quality setting.

It allows this specific path to be generated with a different level of detail or resolution(subdivision),

    useful for optimizing performance or enhancing precision locally.
  • Important: It is strongly recommended to set the

quality overwrite individually for the `path` parameter,

  and for `trimPath` if used, when using the **Flat Panel** model type
  with the **SOLID 1_3** specification—particularly if the path includes
  curved commands like ''C'', ''Q'', or ''A''.
  This helps prevent self-intersecting geometry when applying complex
  or thick profiles to the overall inner panel shape.

Each segment in the path array represents a single SVG path command and is structured as:

  • type: The SVG path command type (e.g., M, L, C), matching the SVG specification.
  • end: The end point of the command, given as x and y coordinates.
  • controlPoints (For curves only): For curves, this includes one or two control points as objects with x and y values. For non-curve commands, this is an empty array.

newpage

JSON Examples for Each Path Command

Each command in the JSON format is stored within the “paths” array, where each element represents a single path definition containing a “path” object. This “path” array holds the individual drawing commands, corresponding directly to SVG path operations such as M, L, C, Q, and A.

"paths": [
	{
		"id": "panel",
		"path": [
		{
			"type": "M",
			"end": { "x": 4.25, "y": -9.44 },
			"controlPoints": []
		},
		{
			"type": "A",
			"end": { "x": -7.13, "y": 0.00 },
			"controlPoints": []
		}
		]
	}
]

Move Command (M / m)

	{
		"type": "M",
		"end": {
			"x": 0,
			"y": 0
		},
		"controlPoints": []
	}

Moves the current cursor position to a given coordinate without drawing a line. The lowercase form m moves relative to the current point.

Line Command (L / l)

	{
		"type": "L",
		"end": {
			"x": 360,
			"y": 0
	      },
		"controlPoints": []
	}

Draws a straight line from the current position to the specified end coordinate. l is the relative variant.

Horizontal Line (H / h)

	{
		"type": "H",
		"end": {
			"x": 200,
			"y": 0 },
		"controlPoints": []
	}

Draws a horizontal line to a specific x position. h is the relative variant, shifting from the current position.

Vertical Line (V / v)

	{
		"type": "V",
		"end": {
			"x": 0,
			"y": 300
			},
		"controlPoints": []
	}

Draws a vertical line to the given y coordinate (absolute or relative).

Cubic Bézier Curve (C / c)

	{
		"type": "C",
		"end": {
			"x": 100,
			"y": 200
			},
		"controlPoints": [
		{ "x": 30, "y": 80 },
		{ "x": 70, "y": 150}
		]
	}

Creates a smooth curve using two control points that define tangents and curvature. The lowercase c version works with relative coordinates.

Quadratic Bézier Curve (Q / q)

	{
		"type": "Q",
		"end": {
			 "x": 100,
			 "y": 200
			 },
		"controlPoints": [
		{ "x": 50, "y": 100 }
		]
	}

Draws a single-control-point curve between the current and end positions. Simpler than the cubic variant but less flexible.

Elliptical Arc (A / a)

	{
		"type": "A",
		"end": {
			"x": 131.989,
			"y": 73.5151
			},
		"controlPoints": [],
		"arcData": {
			"radius":
			{ "isEmpty": 0,
				"x": 47.2259,
				"y": 47.2259 },
			"xAxisRotation": 0,
			"LargeArc": 0,
			"Sweep": 1
		}
	}

Draws an elliptical arc with defined radii, rotation, and directional flags. arcData contains all arc parameters:

  • radius.x, radius.y – ellipse radii in millimeters
  • xAxisRotation – rotation of the ellipse (degrees)
  • LargeArc – selects the larger (1) or smaller (0) arc
  • Sweep – direction of drawing (1 = clockwise, 0 = counterclockwise)

Close Path (Z / z) or Extended Close (E / e)

	{
		"type": "Z",
		"end": { "x": 0, "y": 0 },
		"controlPoints": []
	}

Closes the current path by connecting back to its start point. E/e acts as a supported synonym in the IG.Model.Processor.

All coordinates are expressed in millimeters. For linear commands (M, L, H, V, Z), controlPoints remain empty.


newpage

Reqirements for paths

An updated board_clean_closed.svg file has been uploaded to the repository. This file serves as a reference and replaces the earlier board_clean.svg version, now explicitly including the Z command (close path) to ensure mathematical correctness. The following requirements apply:

  • The plane must be defined as a closed 2D shape.
  • A valid polygon is expressed as:

$v_0, v_1, v_{n-1}, v_n = v_0$

  where ''v0'' to ''vn'' are the vertices of the polygon, and ''vn'' should coincide with ''v0'' to close the loop.
* The polygon must be **non-self-intersecting**.
* The first and last vertices must **coincide** (''vn'' = ''v0'').
* Profiles or bevels are typically constructed from connected path segments (lines, curves, etc.) that **return to the start point to form a closed loop**.
* **Important Note**: Paths that are open (e.g., ''M 0 0 L 100 0 L 100 50 M 50 100'')—meaning they lack a closing command (''Z'')—may be not valid for extrusion and cannot form a prism without an automatic closure, which supported by this software, but only if last point coincide with the firts one. IG.Model.Processor will attempt to close such path, but generally it is wrong definition. Such cases should be avoided to ensure precise geometry. IG.Model.Processor may attempt to close such paths, but behavior in this cases may be unpredictable.

[]

Now that you know commands, you can have a look at the JSON sample on the next page. Don't forget that there are also sample files that are using the same profile as on page profiles (The page reference has been converted to an italicized placeholder as the target page is unknown).


newpage

Small full example of JSON Path with commands:

{
	{
		"paths": [
		{
			"id": "board",
			"path": [
			{
				"type": "M",
				"end": {
					"x": 8.233,
					"y": 2.403
				},
				"controlPoints": []
			},
			{
				"type": "l",
				"end": {
					"x": -0.005,
					"y": -2.223
				},
				"controlPoints": []
			},
			{
				"type": "c",
				"end": {
					"x": 0.056,
					"y": 0.600
				},
				"controlPoints": [
				{
					"x": 0.044,
					"y": 0.202
				},
				{
					"x": 0.120,
					"y": 0.392
				}
				]
			},
			{
				"type": "E",
				"end": {},
				"controlPoints": []
			}
			]
		}
		]
	}
 

Parsing Logic:

  1. The SVG path string is tokenized into commands and coordinate values.
  2. Each command is mapped into a JSON object:
    1. M, L, H, V, etc. are stored with their corresponding end point.
    2. Curve commands (C,Q,) store their end point along with controlPoints.
  3. The command E command marks the end of the path sequence in the JSON format, alternatively you can command Z (command E is a custom addition, not part of standard SVG).

Important Notes:

  1. All coordinates are kept in millimeters the same units as the original SVG as samples. If your SVG file is deifferent units a converter should be used!
  2. The JSON format simplifies parsing later in your system because each command is fully expanded into its components.
  3. h, H — Horizontal lines: only the x value is required; the y value is ignored.
  4. v, V — Vertical lines: only the y value is required; the x value is ignored.

Including the unused coordinate does not cause errors, but it may be omitted for clarity.

Referencing Path Definitions via the ''profile'' Parameter

Each entry in the frame array must specify which path definition to use for that board. This is done by setting the profile field to the id of one of the objects in the top-level paths array.

  • In the paths array, each object has an id (e.g. board) and a corresponding path sequence.
  • Within each frame entry, the profile key is a string that must exactly match one of these id values.
  • At runtime, the processor looks up the path definition whose id equals the profile string and applies that geometry to the board.

Example:

"paths": [
	{
		"id": "board",
		"path": [ … ]
	}
],
"frame": [
	{
		"board": "1",
		"position": { "x": 0, "y": 0 },
		"profile": "board",      // ← references the path with id = "board"
		"uv": { "rotation": 90 }
	},
	…
]

In this example, the frame entry for board = “1” uses the path whose id is “board”. Changing “profile” to another valid “id” will substitute a different shape definition for that board.

ig/gfx/model-configuration-and-parameters.1761737919.txt.gz · Last modified: 2025/10/29 12:38 by ig_ii