347 lines
17 KiB
JSON
347 lines
17 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://cdsl.local/schema/cad.cdsl.llm.v1",
|
|
"title": "CDSL semantic document",
|
|
"description": "Complete self-contained CDSL. Runtime-supported operations can be rebuilt by the local CDSL-only engine; deferred operations are retained for future engine implementations.",
|
|
"type": "object",
|
|
"properties": {
|
|
"schema": {"const": "cad.cdsl.llm.v1"},
|
|
"schema_version": {"type": "string"},
|
|
"kind": {"type": "string", "minLength": 1},
|
|
"part_id": {"type": "string", "pattern": "^[A-Za-z0-9_-]{3,80}$"},
|
|
"meta": {"type": "object"},
|
|
"geometry": {
|
|
"type": "object",
|
|
"properties": {
|
|
"sketches": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/sketch"}}
|
|
},
|
|
"required": ["sketches"],
|
|
"additionalProperties": false
|
|
},
|
|
"features": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/feature"}}
|
|
},
|
|
"required": ["schema", "geometry", "features"],
|
|
"additionalProperties": false,
|
|
"$defs": {
|
|
"number": {"type": "number"},
|
|
"positive": {"type": "number", "exclusiveMinimum": 0},
|
|
"positiveInteger": {"type": "integer", "minimum": 1},
|
|
"point2": {"type": "array", "items": {"$ref": "#/$defs/number"}, "minItems": 2, "maxItems": 2},
|
|
"point3": {"type": "array", "items": {"$ref": "#/$defs/number"}, "minItems": 3, "maxItems": 3},
|
|
"circleItem": {
|
|
"type": "object",
|
|
"properties": {"center": {"$ref": "#/$defs/point2"}, "radius_mm": {"$ref": "#/$defs/positive"}},
|
|
"required": ["radius_mm"],
|
|
"additionalProperties": false
|
|
},
|
|
"workplane": {
|
|
"type": "object",
|
|
"properties": {
|
|
"origin_mm": {"$ref": "#/$defs/point3"},
|
|
"x_dir": {"$ref": "#/$defs/point3"},
|
|
"y_dir": {"$ref": "#/$defs/point3"},
|
|
"normal": {"$ref": "#/$defs/point3"}
|
|
},
|
|
"required": ["origin_mm", "x_dir", "normal"],
|
|
"additionalProperties": false
|
|
},
|
|
"hostFace": {
|
|
"type": "object",
|
|
"properties": {
|
|
"frame": {
|
|
"type": "object",
|
|
"properties": {
|
|
"origin_mm": {"$ref": "#/$defs/point3"},
|
|
"x_dir": {"$ref": "#/$defs/point3"},
|
|
"y_dir": {"$ref": "#/$defs/point3"},
|
|
"normal": {"$ref": "#/$defs/point3"}
|
|
},
|
|
"required": ["origin_mm", "x_dir", "y_dir", "normal"],
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"required": ["frame"],
|
|
"additionalProperties": false
|
|
},
|
|
"holePosition": {
|
|
"type": "object",
|
|
"properties": {"mm": {"$ref": "#/$defs/point3"}},
|
|
"required": ["mm"],
|
|
"additionalProperties": false
|
|
},
|
|
"axis": {
|
|
"type": "object",
|
|
"properties": {"origin_mm": {"$ref": "#/$defs/point3"}, "direction": {"$ref": "#/$defs/point3"}, "selector": {"$ref": "#/$defs/selectorRef"}, "unresolved": {"type": "string", "minLength": 1}},
|
|
"anyOf": [{"required": ["origin_mm", "direction"]}, {"required": ["selector"]}, {"required": ["unresolved"]}],
|
|
"additionalProperties": false
|
|
},
|
|
"endCondition": {
|
|
"type": "object",
|
|
"properties": {
|
|
"type": {"type": "string", "minLength": 1},
|
|
"solidworks_code": {"type": "integer"},
|
|
"reference": {"$ref": "#/$defs/selectorRef"}
|
|
},
|
|
"required": ["type", "solidworks_code"],
|
|
"additionalProperties": false
|
|
},
|
|
"selectorOrUnresolved": {
|
|
"oneOf": [
|
|
{"$ref": "#/$defs/selectorRef"},
|
|
{"type": "object", "properties": {"unresolved": {"type": "string", "minLength": 1}}, "required": ["unresolved"], "additionalProperties": false}
|
|
]
|
|
},
|
|
"extrudeParams": {
|
|
"type": "object",
|
|
"properties": {"distance_mm": {"$ref": "#/$defs/number"}, "reverse": {"type": "boolean"}, "reverse_distance_mm": {"$ref": "#/$defs/number"}, "end_condition": {"$ref": "#/$defs/endCondition"}, "reverse_end_condition": {"$ref": "#/$defs/endCondition"}, "draft": {"type": "object"}},
|
|
"required": ["distance_mm"],
|
|
"additionalProperties": false
|
|
},
|
|
"revolveParams": {
|
|
"type": "object",
|
|
"properties": {"angle_deg": {"type": "number", "minimum": 0, "maximum": 360}, "axis": {"$ref": "#/$defs/axis"}, "reverse": {"type": "boolean"}, "end_condition": {"$ref": "#/$defs/endCondition"}},
|
|
"required": ["angle_deg", "axis"],
|
|
"additionalProperties": false
|
|
},
|
|
"sphereParams": {
|
|
"type": "object",
|
|
"properties": {
|
|
"radius_mm": {"$ref": "#/$defs/positive"},
|
|
"center_mm": {"$ref": "#/$defs/point3"}
|
|
},
|
|
"required": ["radius_mm", "center_mm"],
|
|
"additionalProperties": false
|
|
},
|
|
"holeBaseParams": {
|
|
"type": "object",
|
|
"properties": {
|
|
"diameter_mm": {"$ref": "#/$defs/positive"},
|
|
"depth_mm": {"$ref": "#/$defs/positive"},
|
|
"positions": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/holePosition"}},
|
|
"host_face": {"$ref": "#/$defs/hostFace"},
|
|
"drill_angle_rad": {"type": "number", "exclusiveMinimum": 0, "exclusiveMaximum": 3.141592653589793}
|
|
},
|
|
"required": ["diameter_mm", "depth_mm", "positions"]
|
|
},
|
|
"holeBlindParams": {
|
|
"type": "object",
|
|
"properties": {
|
|
"diameter_mm": {"$ref": "#/$defs/positive"},
|
|
"depth_mm": {"$ref": "#/$defs/positive"},
|
|
"positions": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/holePosition"}},
|
|
"host_face": {"$ref": "#/$defs/hostFace"},
|
|
"drill_angle_rad": {"type": "number", "exclusiveMinimum": 0, "exclusiveMaximum": 3.141592653589793}
|
|
},
|
|
"required": ["diameter_mm", "depth_mm", "positions"],
|
|
"additionalProperties": false
|
|
},
|
|
"holeCountersinkParams": {
|
|
"allOf": [
|
|
{"$ref": "#/$defs/holeBaseParams"},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"diameter_mm": {"$ref": "#/$defs/positive"}, "depth_mm": {"$ref": "#/$defs/positive"},
|
|
"positions": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/holePosition"}},
|
|
"host_face": {"$ref": "#/$defs/hostFace"}, "drill_angle_rad": {"type": "number", "exclusiveMinimum": 0, "exclusiveMaximum": 3.141592653589793},
|
|
"countersink_diameter_mm": {"$ref": "#/$defs/positive"},
|
|
"countersink_angle_rad": {"type": "number", "exclusiveMinimum": 0, "exclusiveMaximum": 3.141592653589793}
|
|
},
|
|
"required": ["diameter_mm", "depth_mm", "positions", "countersink_diameter_mm", "countersink_angle_rad"],
|
|
"additionalProperties": false
|
|
}
|
|
]
|
|
},
|
|
"holeCounterboreParams": {
|
|
"allOf": [
|
|
{"$ref": "#/$defs/holeBaseParams"},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"diameter_mm": {"$ref": "#/$defs/positive"}, "depth_mm": {"$ref": "#/$defs/positive"},
|
|
"positions": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/holePosition"}},
|
|
"host_face": {"$ref": "#/$defs/hostFace"}, "drill_angle_rad": {"type": "number", "exclusiveMinimum": 0, "exclusiveMaximum": 3.141592653589793},
|
|
"counterbore_diameter_mm": {"$ref": "#/$defs/positive"},
|
|
"counterbore_depth_mm": {"$ref": "#/$defs/positive"}
|
|
},
|
|
"required": ["diameter_mm", "depth_mm", "positions", "counterbore_diameter_mm", "counterbore_depth_mm"],
|
|
"additionalProperties": false
|
|
}
|
|
]
|
|
},
|
|
"filletParams": {
|
|
"type": "object",
|
|
"properties": {"radius_mm": {"type": "number", "minimum": 0}, "tangent_propagation": {"type": "boolean"}},
|
|
"required": ["radius_mm"],
|
|
"additionalProperties": false
|
|
},
|
|
"chamferParams": {
|
|
"type": "object",
|
|
"properties": {"distance_mm": {"type": "number", "minimum": 0}, "distance_2_mm": {"type": "number", "minimum": 0}, "angle_rad": {"type": "number", "minimum": 0, "maximum": 3.141592653589793}},
|
|
"required": ["distance_mm"],
|
|
"additionalProperties": false
|
|
},
|
|
"linearPatternParams": {
|
|
"type": "object",
|
|
"properties": {
|
|
"source_feature_ids": {"type": "array", "items": {"type": "string", "pattern": "^[A-Za-z0-9_-]{1,80}$"}},
|
|
"direction_1": {"$ref": "#/$defs/point3"},
|
|
"spacing_1_mm": {"type": "number", "minimum": 0},
|
|
"pattern_count_1": {"type": "integer", "minimum": 1},
|
|
"direction_2": {"$ref": "#/$defs/point3"},
|
|
"spacing_2_mm": {"type": "number", "minimum": 0},
|
|
"pattern_count_2": {"type": "integer", "minimum": 1}
|
|
},
|
|
"required": ["source_feature_ids", "direction_1", "spacing_1_mm", "pattern_count_1"],
|
|
"additionalProperties": false
|
|
},
|
|
"mirrorPatternParams": {
|
|
"type": "object",
|
|
"properties": {
|
|
"source_feature_ids": {"type": "array", "items": {"type": "string", "pattern": "^[A-Za-z0-9_-]{1,80}$"}},
|
|
"mirror_plane": {"$ref": "#/$defs/selectorOrUnresolved"}
|
|
},
|
|
"required": ["source_feature_ids", "mirror_plane"],
|
|
"additionalProperties": false
|
|
},
|
|
"referencePlaneParams": {
|
|
"type": "object",
|
|
"properties": {
|
|
"plane": {"oneOf": [{"$ref": "#/$defs/workplane"}, {"type": "object", "properties": {"unresolved": {"type": "string", "minLength": 1}}, "required": ["unresolved"], "additionalProperties": false}]},
|
|
"references": {"type": "array", "items": {"$ref": "#/$defs/selectorRef"}},
|
|
"derived_from_sketch_id": {"type": "string", "pattern": "^[A-Za-z0-9_-]{1,80}$"},
|
|
"derived_from_feature_id": {"type": "string", "pattern": "^[A-Za-z0-9_-]{1,80}$"},
|
|
"plane_inference": {"enum": ["solidworks_origin_plane_order", "parent_reference_plane"]},
|
|
"offset_mm": {"type": "number"},
|
|
"angle_rad": {"type": "number"},
|
|
"reverse": {"type": "boolean"},
|
|
"solidworks_type": {"type": "integer"}
|
|
},
|
|
"required": ["plane"],
|
|
"additionalProperties": false
|
|
},
|
|
"referenceAxisParams": {
|
|
"type": "object",
|
|
"properties": {"axis": {"$ref": "#/$defs/axis"}},
|
|
"required": ["axis"],
|
|
"additionalProperties": false
|
|
},
|
|
"holeWizardParams": {
|
|
"type": "object",
|
|
"properties": {
|
|
"hole_type": {"type": "string", "minLength": 1},
|
|
"diameter_mm": {"type": "number", "minimum": 0},
|
|
"depth_mm": {"type": "number", "minimum": 0},
|
|
"end_condition": {"$ref": "#/$defs/endCondition"},
|
|
"positions": {"type": "array", "items": {"$ref": "#/$defs/holePosition"}},
|
|
"host_face": {"$ref": "#/$defs/selectorRef"},
|
|
"thread": {"type": "object"},
|
|
"countersink": {"type": "object"},
|
|
"counterbore": {"type": "object"}
|
|
},
|
|
"required": ["hole_type", "diameter_mm", "depth_mm", "end_condition"],
|
|
"additionalProperties": false
|
|
},
|
|
"selectorRef": {
|
|
"type": "object",
|
|
"properties": {
|
|
"kind": {"enum": ["face", "edge", "axis", "plane", "feature", "vertex", "body"]},
|
|
"stable_id": {"type": "string", "minLength": 1},
|
|
"owner_feature_id": {"type": "string", "pattern": "^[A-Za-z0-9_-]{1,80}$"},
|
|
"geometry": {"type": "object"},
|
|
"source": {"enum": ["solidworks", "inferred_from_step"]},
|
|
"confidence": {"type": "number", "minimum": 0, "maximum": 1}
|
|
},
|
|
"required": ["kind", "stable_id", "source", "confidence"],
|
|
"additionalProperties": false
|
|
},
|
|
"analyticSegment": {
|
|
"type": "object",
|
|
"properties": {
|
|
"type": {"enum": ["line", "arc", "circle"]},
|
|
"start": {"$ref": "#/$defs/point2"},
|
|
"end": {"$ref": "#/$defs/point2"},
|
|
"center": {"$ref": "#/$defs/point2"},
|
|
"radius_mm": {"$ref": "#/$defs/positive"},
|
|
"clockwise": {"type": "boolean"}
|
|
},
|
|
"required": ["type"],
|
|
"allOf": [
|
|
{"if": {"properties": {"type": {"const": "line"}}}, "then": {"required": ["start", "end"]}},
|
|
{"if": {"properties": {"type": {"const": "arc"}}}, "then": {"required": ["start", "end", "center", "radius_mm"]}},
|
|
{"if": {"properties": {"type": {"const": "circle"}}}, "then": {"required": ["center", "radius_mm"]}}
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
"analyticContour": {
|
|
"type": "object",
|
|
"properties": {
|
|
"role": {"enum": ["outer", "inner", "open", "unknown"]},
|
|
"closed": {"type": "boolean"},
|
|
"segments": {"type": "array", "items": {"$ref": "#/$defs/analyticSegment"}}
|
|
},
|
|
"required": ["role", "closed", "segments"],
|
|
"additionalProperties": false
|
|
},
|
|
"analyticProfile": {
|
|
"type": "object",
|
|
"properties": {
|
|
"type": {"const": "analytic_contours"},
|
|
"contours": {"type": "array", "items": {"$ref": "#/$defs/analyticContour"}},
|
|
"construction": {"type": "array", "items": {"$ref": "#/$defs/analyticSegment"}}
|
|
},
|
|
"required": ["type", "contours"],
|
|
"additionalProperties": false
|
|
},
|
|
"feature_atomic_ids": {"enum": ["extrude_add_blind", "extrude_add_two_sided", "extrude_cut_blind", "revolve_add", "revolve_cut", "hole_blind", "hole_countersink", "hole_counterbore", "sphere_add", "fillet", "chamfer", "pattern_linear", "pattern_mirror", "reference_plane", "reference_axis", "hole_wizard"]},
|
|
"feature": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {"type": "string", "pattern": "^[A-Za-z0-9_-]{1,80}$"},
|
|
"name": {"type": "string"},
|
|
"atomic_id": {"$ref": "#/$defs/feature_atomic_ids"},
|
|
"depends_on": {"type": "array", "items": {"type": "string", "pattern": "^[A-Za-z0-9_-]{1,80}$"}},
|
|
"sketch_id": {"type": "string", "pattern": "^[A-Za-z0-9_-]{1,80}$"},
|
|
"params": {"type": "object"},
|
|
"execution_status": {"enum": ["supported", "deferred"]},
|
|
"selectors": {"type": "array", "items": {"$ref": "#/$defs/selectorRef"}},
|
|
"unresolved": {"type": "array", "items": {"type": "string", "minLength": 1}}
|
|
},
|
|
"required": ["id", "atomic_id", "depends_on", "params"],
|
|
"additionalProperties": false,
|
|
"allOf": [
|
|
{"if": {"properties": {"atomic_id": {"const": "extrude_add_blind"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/extrudeParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "extrude_add_two_sided"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/extrudeParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "extrude_cut_blind"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/extrudeParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "revolve_add"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/revolveParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "revolve_cut"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/revolveParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "sphere_add"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/sphereParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "hole_blind"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/holeBlindParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "hole_countersink"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/holeCountersinkParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "hole_counterbore"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/holeCounterboreParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "fillet"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/filletParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "chamfer"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/chamferParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "pattern_linear"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/linearPatternParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "pattern_mirror"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/mirrorPatternParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "reference_plane"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/referencePlaneParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "reference_axis"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/referenceAxisParams"}}}},
|
|
{"if": {"properties": {"atomic_id": {"const": "hole_wizard"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/holeWizardParams"}}}}
|
|
]
|
|
},
|
|
"profile_type": {"enum": ["circle", "polygon", "analytic_contours"]},
|
|
"profile": {
|
|
"oneOf": [
|
|
{"type": "object", "properties": {"type": {"const": "circle"}, "center": {"$ref": "#/$defs/point2"}, "radius_mm": {"$ref": "#/$defs/positive"}}, "required": ["type", "radius_mm"], "additionalProperties": false},
|
|
{"type": "object", "properties": {"type": {"const": "polygon"}, "vertices": {"type": "array", "minItems": 3, "items": {"$ref": "#/$defs/point2"}}}, "required": ["type", "vertices"], "additionalProperties": false},
|
|
{"$ref": "#/$defs/analyticProfile"}
|
|
]
|
|
},
|
|
"sketch": {
|
|
"type": "object",
|
|
"properties": {"id": {"type": "string", "pattern": "^[A-Za-z0-9_-]{1,80}$"}, "name": {"type": "string"}, "workplane": {"$ref": "#/$defs/workplane"}, "profile": {"$ref": "#/$defs/profile"}, "role": {"enum": ["profile", "reference"]}, "attachment": {"$ref": "#/$defs/selectorRef"}, "profile_from": {"type": "string", "pattern": "^[A-Za-z0-9_-]{1,80}$"}},
|
|
"required": ["id", "workplane", "profile"],
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
}
|