Skip to main content

Module sketch3d

Module sketch3d 

Source
Expand description

The engine-native 3D SKETCH editor’s session: the solved document, its diagnostics, the interaction state (selection, hover, armed tool, working plane), screen-space picking and the overlay tessellation.

The planar sketcher (crate::sketch) lives in a plane’s (u, v) frame and hit-tests there. A 3D sketch has no such frame: its points are world points, so picking is done in SCREEN space (every point and polyline sample projected through the live camera, distances measured in pixels) and a click lands in 3D through the WORKING PLANE — one of the three world planes through the sketch’s current anchor (the last placed point) — or on model geometry under the cursor (see EngineState::sketch3d_cursor_world).

The document and the solver are the kernel’s (brep_kernel::Sketch3dDoc, brep_kernel::solve_sketch3d_doc); the feature (S3D) solves the same document on every regenerate, so what the editor shows is what the model gets.

Structs§

ApplicableConstraint
A constraint the palette can add for the current selection: the type and the ordered point ids it would take.
Sketch3dConstraint
A 3D sketch constraint, kept as a transparent map so authoring metadata (expression text, label offsets) persists exactly.
Sketch3dDiagnostics
The solver’s read-only diagnostics: the same shape the 2D sketch solver publishes (dof, rank, unknowns, equations, redundant, status, conflicting, conflictingConstraints, pointMobility, geometryMobility), so the editor’s readouts are shared.
Sketch3dDimLabel
One dimension label the app draws as editable text at a projected world anchor — the 3D sibling of crate::sketch::dimensions::DimLabel, in the same JSON shape so the app’s label pass draws both.
Sketch3dDoc
The editable 3D sketch document.
Sketch3dGeometry
A 3D sketch geometry (see the module doc for the point layouts).
Sketch3dPoint
A 3D sketch point: world coordinates plus the role flags the solver tracks.
Sketch3dSession
State for one active 3D sketch.
WorkPlane
The working plane: one of the three world planes through an anchor.

Constants§

OVERLAY_GEOMETRY
The set_overlay group names. Separate from the planar sketch’s so the two editors never clear each other’s groups.
OVERLAY_GLYPHS
Every group, for a clear.
OVERLAY_GROUPS
OVERLAY_POINTS
OVERLAY_PREVIEW
OVERLAY_WORKPLANE
SKETCH3D_CONSTRAINT_TYPES
The constraint vocabulary. Point layouts: a LINE is its two endpoints [a0, a1] (direction a1 − a0); a PLANE is [origin, normalTip] (normal normalTip − origin); an ARC is [center, start, end].
TOOLS
The draw tools the 3D editor arms (select is the neutral state, stored as None).
WORK_PLANES
The three working planes, by name.

Functions§

entity_constraint_ref
entity_geometry_ref
entity_point_ref
plane_frame_of
The frame of a reference plane [origin, normalTip].
project
Project a world point to CSS pixels, None when behind the eye.
sample_arc
The minor arc from start to end about center, sampled; None when the three points are collinear or the radius is zero.
sample_bezier
A cubic bezier chain (3n+1 controls), sampled per span.