pub struct BrepKernel { /* private fields */ }Expand description
The B-Rep modeling kernel.
Owns all topological state. JavaScript holds this reference and invokes methods to create, transform, and query geometry.
Implementations§
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn assembly_new(&mut self, name: &str) -> u32
pub fn assembly_new(&mut self, name: &str) -> u32
Create a new empty assembly. Returns an assembly index.
Sourcepub fn assembly_add_root(
&mut self,
assembly: u32,
name: &str,
solid: u32,
matrix: Vec<f64>,
) -> Result<u32, JsError>
pub fn assembly_add_root( &mut self, assembly: u32, name: &str, solid: u32, matrix: Vec<f64>, ) -> Result<u32, JsError>
Add a root component to an assembly.
Returns the component ID.
Sourcepub fn assembly_add_child(
&mut self,
assembly: u32,
parent: u32,
name: &str,
solid: u32,
matrix: Vec<f64>,
) -> Result<u32, JsError>
pub fn assembly_add_child( &mut self, assembly: u32, parent: u32, name: &str, solid: u32, matrix: Vec<f64>, ) -> Result<u32, JsError>
Add a child component to a parent in an assembly.
Returns the component ID.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn execute_batch(&mut self, json: &str) -> String
pub fn execute_batch(&mut self, json: &str) -> String
Execute a batch of operations, crossing the JS/WASM boundary once.
Accepts a JSON string containing an array of operation objects:
[
{"op": "makeBox", "args": {"width": 2.0, "height": 2.0, "depth": 2.0}},
{"op": "fuse", "args": {"solidA": 0, "solidB": 1}},
{"op": "volume", "args": {"solid": 2, "deflection": 0.1}}
]Returns a JSON string with an array of results:
[
{"ok": 0},
{"ok": 2},
{"error": "invalid solid id"}
]Operations are executed sequentially; an error in one does not prevent execution of subsequent operations.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn fuse(&mut self, a: u32, b: u32) -> Result<u32, JsError>
pub fn fuse(&mut self, a: u32, b: u32) -> Result<u32, JsError>
Fuse (union) two solids into one.
Returns a new solid handle (u32).
§Errors
Returns an error if either solid handle is invalid or the operation produces an empty or non-manifold result.
Sourcepub fn cut(&mut self, a: u32, b: u32) -> Result<u32, JsError>
pub fn cut(&mut self, a: u32, b: u32) -> Result<u32, JsError>
Cut (subtract) solid b from solid a.
Returns a new solid handle (u32).
§Errors
Returns an error if either solid handle is invalid or the operation produces an empty or non-manifold result.
Sourcepub fn fuse_with_options(
&mut self,
a: u32,
b: u32,
simplify: bool,
) -> Result<u32, JsError>
pub fn fuse_with_options( &mut self, a: u32, b: u32, simplify: bool, ) -> Result<u32, JsError>
Fuse (union) two solids with post-processing options.
simplify merges co-surface face fragments after the boolean
(the BooleanOptions.simplify request from brepjs).
§Errors
Returns an error if either solid handle is invalid or the operation produces an empty or non-manifold result.
Sourcepub fn cut_with_options(
&mut self,
a: u32,
b: u32,
simplify: bool,
) -> Result<u32, JsError>
pub fn cut_with_options( &mut self, a: u32, b: u32, simplify: bool, ) -> Result<u32, JsError>
Cut (subtract) solid b from solid a with post-processing options.
§Errors
Returns an error if either solid handle is invalid or the operation produces an empty or non-manifold result.
Sourcepub fn intersect_with_options(
&mut self,
a: u32,
b: u32,
simplify: bool,
) -> Result<u32, JsError>
pub fn intersect_with_options( &mut self, a: u32, b: u32, simplify: bool, ) -> Result<u32, JsError>
Intersect two solids with post-processing options.
§Errors
Returns an error if either solid handle is invalid or the operation produces an empty or non-manifold result.
Sourcepub fn mesh_fallback_count(&self) -> f64
pub fn mesh_fallback_count(&self) -> f64
Number of boolean operations that have used the mesh (co-refinement) fallback since module load.
The counter is process-wide: it is shared across all BrepKernel
instances in the same wasm module and never resets. Snapshot it
before an operation chain and compare after — a relative check, so
the shared scope does not matter to single-threaded callers. If it
grew, the chain contains at least one approximate result (analytic
surface types lost, watertightness not guaranteed), and an export
pipeline can refuse the output.
Sourcepub fn detect_coincident_faces(&self, a: u32, b: u32) -> Result<String, JsError>
pub fn detect_coincident_faces(&self, a: u32, b: u32) -> Result<String, JsError>
Detect surface-level coincident face pairs between two solids without performing a boolean operation.
Useful for warning users about same-domain configurations
(face stacks, coaxial cylinders, concentric spheres) before a
boolean. Returns a JSON array string of objects:
[{"faceA": <u32>, "faceB": <u32>, "sameOrientation": <bool>, "aabbOverlap": <bool>}, ...].
sameOrientation is true when the surface normals point the
same way at corresponding parametric points (e.g., two coplanar
faces with the same +z normal). aabbOverlap filters pairs
that are same-domain on the surface but geometrically disjoint.
§Errors
Returns an error if either solid handle is invalid or any face / edge / vertex lookup fails internally.
Sourcepub fn fuse_all(&mut self, solid_handles: Vec<u32>) -> Result<u32, JsError>
pub fn fuse_all(&mut self, solid_handles: Vec<u32>) -> Result<u32, JsError>
Fuse (union) many solids into one in a single call.
Faster than a left-fold over fuse: overlapping solids are reduced
pairwise in a balanced tree while disjoint groups are merged directly
without a boolean.
Returns a new solid handle (u32).
§Errors
Returns an error if any solid handle is invalid, the list is empty, or a boolean operation produces an empty or non-manifold result.
Sourcepub fn intersect_solids(&mut self, a: u32, b: u32) -> Result<u32, JsError>
pub fn intersect_solids(&mut self, a: u32, b: u32) -> Result<u32, JsError>
Intersect two solids, keeping only their common volume.
Returns a new solid handle (u32).
§Errors
Returns an error if either solid handle is invalid or the operation produces an empty result.
Sourcepub fn fuse_with_evolution(
&mut self,
a: u32,
b: u32,
) -> Result<JsValue, JsError>
pub fn fuse_with_evolution( &mut self, a: u32, b: u32, ) -> Result<JsValue, JsError>
Fuse (union) two solids and return evolution tracking data.
Returns a JSON string: {"solid": <u32>, "evolution": {...}}.
§Errors
Returns an error if either solid handle is invalid or the operation produces an empty or non-manifold result.
Sourcepub fn cut_with_evolution(&mut self, a: u32, b: u32) -> Result<JsValue, JsError>
pub fn cut_with_evolution(&mut self, a: u32, b: u32) -> Result<JsValue, JsError>
Cut (subtract) solid b from solid a and return evolution tracking data.
Returns a JSON string: {"solid": <u32>, "evolution": {...}}.
§Errors
Returns an error if either solid handle is invalid or the operation produces an empty or non-manifold result.
Sourcepub fn intersect_with_evolution(
&mut self,
a: u32,
b: u32,
) -> Result<JsValue, JsError>
pub fn intersect_with_evolution( &mut self, a: u32, b: u32, ) -> Result<JsValue, JsError>
Intersect two solids and return evolution tracking data.
Returns a JSON string: {"solid": <u32>, "evolution": {...}}.
§Errors
Returns an error if either solid handle is invalid or the operation produces an empty result.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn compound_cut(
&mut self,
target: u32,
tool_ids: &[u32],
) -> Result<u32, JsError>
pub fn compound_cut( &mut self, target: u32, tool_ids: &[u32], ) -> Result<u32, JsError>
Cut a target solid by multiple tool solids in a single pass.
This is more efficient than sequential cut() calls when many tools
are applied to the same target — it avoids re-processing unchanged
faces at each step.
tool_ids is a JS Uint32Array or array of solid handles.
§Errors
Returns an error if any handle is invalid or the operation fails.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn checkpoint(&mut self) -> u32
pub fn checkpoint(&mut self) -> u32
Save a snapshot of the current kernel state.
Returns a checkpoint ID (zero-based index) that can be passed to
restore or discardCheckpoint.
The snapshot is a clone of all topology, assembly, and sketch state. Existing entity handles remain valid after restore.
Sourcepub fn restore(&mut self, checkpoint_id: u32) -> Result<(), JsError>
pub fn restore(&mut self, checkpoint_id: u32) -> Result<(), JsError>
Restore the kernel to a previously saved checkpoint.
All state created after the checkpoint is discarded. The checkpoint itself (and any earlier checkpoints) remain valid for future restores. Checkpoints created after this one are discarded.
§Errors
Returns an error if checkpoint_id does not refer to a valid checkpoint.
Sourcepub fn discard_checkpoint(&mut self, checkpoint_id: u32) -> Result<(), JsError>
pub fn discard_checkpoint(&mut self, checkpoint_id: u32) -> Result<(), JsError>
Discard a checkpoint and all checkpoints after it, freeing their memory.
§Errors
Returns an error if checkpoint_id does not refer to a valid checkpoint.
Sourcepub fn checkpoint_count(&self) -> u32
pub fn checkpoint_count(&self) -> u32
Returns the number of saved checkpoints.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn sew_faces(
&mut self,
face_handles: Vec<u32>,
tolerance: f64,
) -> Result<u32, JsError>
pub fn sew_faces( &mut self, face_handles: Vec<u32>, tolerance: f64, ) -> Result<u32, JsError>
Sew loose faces into a connected solid.
face_handles is an array of face handles. Returns a solid handle.
§Errors
Returns an error if fewer than 2 faces or sewing fails.
Sourcepub fn make_solid_from_faces(
&mut self,
face_handles: Vec<u32>,
) -> Result<u32, JsError>
pub fn make_solid_from_faces( &mut self, face_handles: Vec<u32>, ) -> Result<u32, JsError>
Create a solid from a set of faces by sewing them together.
Alias for sewFaces with a default tolerance. This is the equivalent
of sewing faces into a closed shell and building a solid.
Sourcepub fn remove_holes_from_face(&mut self, face: u32) -> Result<u32, JsError>
pub fn remove_holes_from_face(&mut self, face: u32) -> Result<u32, JsError>
Remove all holes from a face, returning a new face with only the outer wire.
Sourcepub fn weld_shells_and_faces(
&mut self,
face_handles: Vec<u32>,
tolerance: f64,
) -> Result<u32, JsError>
pub fn weld_shells_and_faces( &mut self, face_handles: Vec<u32>, tolerance: f64, ) -> Result<u32, JsError>
Weld shells and faces into a single solid by sewing.
Accepts an array of face handles from potentially different shells. Sews all faces together into a single solid.
Sourcepub fn unify_faces(&mut self, solid: u32) -> Result<u32, JsError>
pub fn unify_faces(&mut self, solid: u32) -> Result<u32, JsError>
Unify adjacent faces that lie on the same geometric surface.
Merges co-surface face fragments (produced by boolean operations) back into single faces, reducing face count and improving topology. Returns the number of faces removed.
Sourcepub fn convert_to_bspline(&mut self, solid: u32) -> Result<u32, JsError>
pub fn convert_to_bspline(&mut self, solid: u32) -> Result<u32, JsError>
Convert all analytic geometry in a solid to NURBS representation.
Replaces planes, cylinders, cones, spheres, tori with NURBS surfaces and lines, circles, ellipses with NURBS curves. NURBS surfaces and curves already in the model are left untouched. Returns the number of entities converted.
Converts every analytic surface and curve to a NURBS representation. Stored pcurves are dropped during conversion — callers that depend on pcurves should recompute them afterwards.
§Errors
Returns an error if the solid handle is invalid or conversion fails.
Sourcepub fn convert_to_elementary(&mut self, solid: u32) -> Result<u32, JsError>
pub fn convert_to_elementary(&mut self, solid: u32) -> Result<u32, JsError>
Recognize and replace NURBS faces and edges with their analytic (elementary) forms wherever possible (Plane/Cylinder/Sphere/ Cone/Torus surfaces; Line/Circle/Ellipse edges).
Inverse of convertToBspline: useful after STEP/IGES import
to recover analytic types from B-spline-only exports.
Returns the total number of faces and edges converted.
§Errors
Returns an error if topology lookups fail.
Sourcepub fn heal_solid(&mut self, solid: u32) -> Result<u32, JsError>
pub fn heal_solid(&mut self, solid: u32) -> Result<u32, JsError>
Heal a solid topology.
Returns the number of issues fixed.
Sourcepub fn repair_solid(&mut self, solid: u32) -> Result<u32, JsError>
pub fn repair_solid(&mut self, solid: u32) -> Result<u32, JsError>
Validate, heal, and re-validate a solid in one pass.
Returns the number of remaining validation errors after repair. A return value of 0 means the solid is valid after repair.
§Errors
Returns an error if the solid handle is invalid.
Sourcepub fn remove_degenerate_edges(
&mut self,
solid: u32,
tolerance: f64,
) -> Result<u32, JsError>
pub fn remove_degenerate_edges( &mut self, solid: u32, tolerance: f64, ) -> Result<u32, JsError>
Remove degenerate (zero-length) edges from a solid.
Returns the number of edges removed.
Sourcepub fn fix_face_orientations(&mut self, solid: u32) -> Result<u32, JsError>
pub fn fix_face_orientations(&mut self, solid: u32) -> Result<u32, JsError>
Fix face orientations to ensure consistent outward normals.
Returns the number of faces fixed.
Sourcepub fn defeature(
&mut self,
solid: u32,
face_handles: Vec<u32>,
) -> Result<u32, JsError>
pub fn defeature( &mut self, solid: u32, face_handles: Vec<u32>, ) -> Result<u32, JsError>
Remove specified faces from a solid (defeaturing).
face_handles is an array of face handles to remove.
Returns a new solid handle.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn export_3mf(
&self,
solid: u32,
deflection: f64,
) -> Result<Vec<u8>, JsError>
pub fn export_3mf( &self, solid: u32, deflection: f64, ) -> Result<Vec<u8>, JsError>
Export a solid to 3MF format (ZIP archive as bytes).
Returns a Uint8Array in JavaScript containing the .3mf file.
§Errors
Returns an error if the solid handle is invalid or export fails.
Sourcepub fn export_stl(
&self,
solid: u32,
deflection: f64,
) -> Result<Vec<u8>, JsError>
pub fn export_stl( &self, solid: u32, deflection: f64, ) -> Result<Vec<u8>, JsError>
Export a solid to binary STL format.
Returns a Uint8Array containing the .stl file.
§Errors
Returns an error if the solid handle is invalid or export fails.
Sourcepub fn export_stl_ascii(
&self,
solid: u32,
deflection: f64,
) -> Result<Vec<u8>, JsError>
pub fn export_stl_ascii( &self, solid: u32, deflection: f64, ) -> Result<Vec<u8>, JsError>
Export a solid to STL ASCII format.
Returns the ASCII STL as UTF-8 bytes.
§Errors
Returns an error if the solid handle is invalid or export fails.
Sourcepub fn export_obj(
&self,
solid: u32,
deflection: f64,
) -> Result<Vec<u8>, JsError>
pub fn export_obj( &self, solid: u32, deflection: f64, ) -> Result<Vec<u8>, JsError>
Export a solid to OBJ format (UTF-8 string as bytes).
§Errors
Returns an error if the solid handle is invalid or tessellation fails.
Sourcepub fn export_glb(
&self,
solid: u32,
deflection: f64,
) -> Result<Vec<u8>, JsError>
pub fn export_glb( &self, solid: u32, deflection: f64, ) -> Result<Vec<u8>, JsError>
Export a solid to glTF binary (.glb) format.
§Errors
Returns an error if the solid handle is invalid or tessellation fails.
Sourcepub fn export_ply(
&self,
solid: u32,
deflection: f64,
) -> Result<Vec<u8>, JsError>
pub fn export_ply( &self, solid: u32, deflection: f64, ) -> Result<Vec<u8>, JsError>
Export a solid to PLY format (binary little-endian).
§Errors
Returns an error if the solid handle is invalid or tessellation fails.
Sourcepub fn import_obj(&mut self, data: &[u8]) -> Result<u32, JsError>
pub fn import_obj(&mut self, data: &[u8]) -> Result<u32, JsError>
Import an OBJ file and return a solid handle.
§Errors
Returns an error if the file is malformed or mesh import fails.
Sourcepub fn import_glb(&mut self, data: &[u8]) -> Result<u32, JsError>
pub fn import_glb(&mut self, data: &[u8]) -> Result<u32, JsError>
Import a GLB (glTF binary) file and return a solid handle.
§Errors
Returns an error if the file is malformed or mesh import fails.
Sourcepub fn import_stl(&mut self, data: &[u8]) -> Result<u32, JsError>
pub fn import_stl(&mut self, data: &[u8]) -> Result<u32, JsError>
Import an STL file (binary or ASCII) and return a solid handle.
The mesh triangles are converted to planar B-Rep faces with vertex merging.
§Errors
Returns an error if the STL data is malformed or empty.
Sourcepub fn import_3mf(&mut self, data: &[u8]) -> Result<Vec<u32>, JsError>
pub fn import_3mf(&mut self, data: &[u8]) -> Result<Vec<u32>, JsError>
Import a 3MF file and return solid handles.
Returns handles for each object found in the 3MF archive.
§Errors
Returns an error if the 3MF data is malformed.
Sourcepub fn import_indexed_mesh(
&mut self,
positions: &[f64],
indices: &[u32],
) -> Result<u32, JsError>
pub fn import_indexed_mesh( &mut self, positions: &[f64], indices: &[u32], ) -> Result<u32, JsError>
Import a triangle mesh from flat vertex/index arrays.
positions is a flat [x0,y0,z0, x1,y1,z1, ...] array.
indices is a flat [i0,i1,i2, i3,i4,i5, ...] array of triangle
vertex indices. Returns a solid handle.
§Errors
Returns an error if the arrays are malformed or mesh import fails.
Sourcepub fn export_step(&self, solid: u32) -> Result<Vec<u8>, JsError>
pub fn export_step(&self, solid: u32) -> Result<Vec<u8>, JsError>
Export a solid to STEP AP203 format.
Returns the STEP file as a UTF-8 encoded byte vector.
§Errors
Returns an error if the solid handle is invalid or export fails.
Sourcepub fn import_step(&mut self, data: &[u8]) -> Result<Vec<u32>, JsError>
pub fn import_step(&mut self, data: &[u8]) -> Result<Vec<u32>, JsError>
Import a STEP file and return solid handles.
Returns handles for each solid found in the STEP file.
§Errors
Returns an error if the STEP data is malformed.
Sourcepub fn export_iges(&self, solid: u32) -> Result<Vec<u8>, JsError>
pub fn export_iges(&self, solid: u32) -> Result<Vec<u8>, JsError>
Export a solid to IGES format.
Returns the IGES file as a UTF-8 encoded byte vector.
§Errors
Returns an error if the solid handle is invalid or export fails.
Sourcepub fn import_iges(&mut self, data: &[u8]) -> Result<Vec<u32>, JsError>
pub fn import_iges(&mut self, data: &[u8]) -> Result<Vec<u32>, JsError>
Import an IGES file and return solid handles.
§Errors
Returns an error if the IGES data is malformed.
Sourcepub fn serialize_solid(&self, solid: u32) -> Result<Vec<u8>, JsError>
pub fn serialize_solid(&self, solid: u32) -> Result<Vec<u8>, JsError>
Serialize a solid’s complete in-memory topology sub-arena to bytes.
Captures every vertex, edge, wire, face, shell reachable from the solid with byte-exact f64 values (no geometry re-derivation or tolerance normalization). Unlike STEP/IGES export, this preserves the kernel’s exact in-memory state — intended for capturing live operands and replaying them in a native Rust harness to reproduce sub-ULP-sensitive boolean behavior.
Returns a Uint8Array consumable by brepkit_io::arena_io::deserialize_solid.
§Errors
Returns an error if the solid handle is invalid or serialization fails.
Sourcepub fn deserialize_solid(&mut self, data: &[u8]) -> Result<u32, JsError>
pub fn deserialize_solid(&mut self, data: &[u8]) -> Result<u32, JsError>
Reconstruct a solid from a buffer produced by Self::serialize_solid.
§Errors
Returns an error if the buffer is malformed or reconstruction fails.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn bounding_box(&self, solid: u32) -> Result<Vec<f64>, JsError>
pub fn bounding_box(&self, solid: u32) -> Result<Vec<f64>, JsError>
Compute the axis-aligned bounding box of a solid.
Returns [min_x, min_y, min_z, max_x, max_y, max_z].
§Errors
Returns an error if the solid handle is invalid or has no vertices.
Sourcepub fn volume(&self, solid: u32, deflection: f64) -> Result<f64, JsError>
pub fn volume(&self, solid: u32, deflection: f64) -> Result<f64, JsError>
Compute the volume of a solid.
§Errors
Returns an error if the solid handle is invalid or tessellation fails.
Sourcepub fn surface_area(&self, solid: u32, deflection: f64) -> Result<f64, JsError>
pub fn surface_area(&self, solid: u32, deflection: f64) -> Result<f64, JsError>
Compute the total surface area of a solid.
§Errors
Returns an error if the solid handle is invalid or tessellation fails.
Sourcepub fn face_area(&self, face: u32, deflection: f64) -> Result<f64, JsError>
pub fn face_area(&self, face: u32, deflection: f64) -> Result<f64, JsError>
Compute the area of a single face.
§Errors
Returns an error if the face handle is invalid or tessellation fails.
Sourcepub fn center_of_mass(
&self,
solid: u32,
deflection: f64,
) -> Result<Vec<f64>, JsError>
pub fn center_of_mass( &self, solid: u32, deflection: f64, ) -> Result<Vec<f64>, JsError>
Compute the center of mass of a solid (uniform density).
Returns [x, y, z].
§Errors
Returns an error if the solid has zero volume or tessellation fails.
Sourcepub fn classify_point(
&self,
solid: u32,
x: f64,
y: f64,
z: f64,
tolerance: f64,
) -> Result<String, JsError>
pub fn classify_point( &self, solid: u32, x: f64, y: f64, z: f64, tolerance: f64, ) -> Result<String, JsError>
Classify a point relative to a solid: inside, outside, or on boundary.
Returns "inside", "outside", or "boundary".
§Errors
Returns an error if the solid handle is invalid.
Sourcepub fn validate_solid(&self, solid: u32) -> Result<u32, JsError>
pub fn validate_solid(&self, solid: u32) -> Result<u32, JsError>
Validate a solid, returning the number of errors found.
Returns 0 if the solid is valid.
§Errors
Returns an error if the solid handle is invalid.
Sourcepub fn validate_solid_relaxed(&self, solid: u32) -> Result<u32, JsError>
pub fn validate_solid_relaxed(&self, solid: u32) -> Result<u32, JsError>
Validate a solid with relaxed checks suitable for assembled geometry.
Operations like boolean, fillet, and shell produce geometrically correct shapes that may not have fully manifold topology (faces from different operations may not share edges). This validation skips Euler characteristic, boundary edge, non-manifold edge, and shell connectivity checks.
Returns 0 if the solid passes all structural checks.
§Errors
Returns an error if the solid handle is invalid.
Sourcepub fn validate_solid_with_options(
&self,
solid: u32,
tolerance_scale: f64,
) -> Result<u32, JsError>
pub fn validate_solid_with_options( &self, solid: u32, tolerance_scale: f64, ) -> Result<u32, JsError>
Validate a solid with configurable tolerance scaling.
tolerance_scale multiplies geometric tolerances used for the
face-normal and face-area checks. Use 10.0 to reduce false
positives on NURBS faces from fillet/shell operations.
Returns 0 if the solid is valid.
§Errors
Returns an error if the solid handle is invalid.
Sourcepub fn point_to_solid_distance(
&self,
px: f64,
py: f64,
pz: f64,
solid: u32,
) -> Result<Vec<f64>, JsError>
pub fn point_to_solid_distance( &self, px: f64, py: f64, pz: f64, solid: u32, ) -> Result<Vec<f64>, JsError>
Compute minimum distance from a point to a solid.
Returns [distance, closest_x, closest_y, closest_z].
§Errors
Returns an error if the solid handle is invalid.
Sourcepub fn solid_to_solid_distance(
&self,
a: u32,
b: u32,
) -> Result<Vec<f64>, JsError>
pub fn solid_to_solid_distance( &self, a: u32, b: u32, ) -> Result<Vec<f64>, JsError>
Compute minimum distance between two solids.
Returns [distance, point_a_x, point_a_y, point_a_z, point_b_x, point_b_y, point_b_z].
§Errors
Returns an error if either solid handle is invalid.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn interpolate_points(
&mut self,
coords: Vec<f64>,
degree: u32,
) -> Result<u32, JsError>
pub fn interpolate_points( &mut self, coords: Vec<f64>, degree: u32, ) -> Result<u32, JsError>
Interpolate a NURBS curve through points and create an edge.
Uses chord-length parameterization with the given degree.
Returns an edge handle (u32).
Sourcepub fn approximate_curve(
&mut self,
coords: Vec<f64>,
degree: u32,
num_control_points: u32,
) -> Result<u32, JsError>
pub fn approximate_curve( &mut self, coords: Vec<f64>, degree: u32, num_control_points: u32, ) -> Result<u32, JsError>
Approximate a curve through points (least-squares).
Returns an edge handle.
Sourcepub fn approximate_curve_lspia(
&mut self,
coords: Vec<f64>,
degree: u32,
num_control_points: u32,
tolerance: f64,
max_iterations: u32,
) -> Result<u32, JsError>
pub fn approximate_curve_lspia( &mut self, coords: Vec<f64>, degree: u32, num_control_points: u32, tolerance: f64, max_iterations: u32, ) -> Result<u32, JsError>
Approximate a curve through points using LSPIA (progressive iteration).
Returns an edge handle.
Sourcepub fn interpolate_surface(
&mut self,
coords: Vec<f64>,
rows: u32,
cols: u32,
degree_u: u32,
degree_v: u32,
) -> Result<u32, JsError>
pub fn interpolate_surface( &mut self, coords: Vec<f64>, rows: u32, cols: u32, degree_u: u32, degree_v: u32, ) -> Result<u32, JsError>
Interpolate a grid of points into a NURBS surface.
coords is a flat array [x,y,z, ...] of rows * cols points.
Returns a face handle.
Sourcepub fn approximate_surface_lspia(
&mut self,
coords: Vec<f64>,
rows: u32,
cols: u32,
degree_u: u32,
degree_v: u32,
num_cps_u: u32,
num_cps_v: u32,
tolerance: f64,
max_iterations: u32,
) -> Result<u32, JsError>
pub fn approximate_surface_lspia( &mut self, coords: Vec<f64>, rows: u32, cols: u32, degree_u: u32, degree_v: u32, num_cps_u: u32, num_cps_v: u32, tolerance: f64, max_iterations: u32, ) -> Result<u32, JsError>
Approximate a grid of points into a NURBS surface using LSPIA.
Returns a face handle.
Sourcepub fn curve_knot_insert(
&mut self,
edge: u32,
knot: f64,
times: u32,
) -> Result<u32, JsError>
pub fn curve_knot_insert( &mut self, edge: u32, knot: f64, times: u32, ) -> Result<u32, JsError>
Insert a knot into an edge’s NURBS curve.
Returns a new edge handle with the refined curve.
Sourcepub fn curve_knot_remove(
&mut self,
edge: u32,
knot: f64,
tolerance: f64,
) -> Result<u32, JsError>
pub fn curve_knot_remove( &mut self, edge: u32, knot: f64, tolerance: f64, ) -> Result<u32, JsError>
Remove a knot from an edge’s NURBS curve.
Returns a new edge handle with the simplified curve.
Sourcepub fn curve_split(&mut self, edge: u32, u: f64) -> Result<Vec<u32>, JsError>
pub fn curve_split(&mut self, edge: u32, u: f64) -> Result<Vec<u32>, JsError>
Split an edge’s NURBS curve at a parameter value.
Returns two edge handles as [u32; 2].
Sourcepub fn curve_degree_elevate(
&mut self,
edge: u32,
elevate_by: u32,
) -> Result<u32, JsError>
pub fn curve_degree_elevate( &mut self, edge: u32, elevate_by: u32, ) -> Result<u32, JsError>
Elevate the degree of an edge’s NURBS curve.
Returns a new edge handle.
Sourcepub fn get_nurbs_curve_data(&self, edge: u32) -> Result<String, JsError>
pub fn get_nurbs_curve_data(&self, edge: u32) -> Result<String, JsError>
Read-only canonical NURBS data for the curve underlying an edge.
Analytic curves (line, circle, ellipse) are converted to their exact
NURBS form. Returns a JSON string with degree, controlPoints,
weights, the flat knots vector, compressed distinctKnots /
multiplicities, rational, closed / periodic, and domain.
Sourcepub fn get_nurbs_surface_data(&self, face: u32) -> Result<String, JsError>
pub fn get_nurbs_surface_data(&self, face: u32) -> Result<String, JsError>
Read-only canonical NURBS data for the surface underlying a face.
Analytic surfaces are converted to NURBS (planes/cylinders exact;
cones/spheres/tori via the exact rational forms). Returns a JSON
string with degreeU/degreeV, the row-major controlPoints grid,
the matching weights grid, flat knotsU/knotsV, compressed
distinct-knots/multiplicities per direction, rational,
periodicU/periodicV, and domainU/domainV.
Sourcepub fn get_nurbs_surface_data_parity(
&self,
face: u32,
) -> Result<String, JsError>
pub fn get_nurbs_surface_data_parity( &self, face: u32, ) -> Result<String, JsError>
Type-gated read-only B-Spline/NURBS surface data for a face.
Unlike getNurbsSurfaceData, this never converts analytic surfaces:
faces backed by a plane, cylinder, cone, sphere, or torus return the
JSON literal null. Only intrinsically free-form (B-Spline/NURBS) faces
yield a record with degreeU/degreeV, nbPolesU/nbPolesV, the
row-major poles grid (u-major, v-minor) with the matching weights
grid, distinct knotsU/knotsV paired with multiplicitiesU/
multiplicitiesV, isPeriodicU/isPeriodicV, and isRational.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn section_solid(
&mut self,
solid: u32,
px: f64,
py: f64,
pz: f64,
nx: f64,
ny: f64,
nz: f64,
) -> Result<Vec<u32>, JsError>
pub fn section_solid( &mut self, solid: u32, px: f64, py: f64, pz: f64, nx: f64, ny: f64, nz: f64, ) -> Result<Vec<u32>, JsError>
Section a solid with a plane, returning cross-section face handles.
Returns an array of face handles (u32[]).
§Errors
Returns an error if the solid handle is invalid or the plane doesn’t intersect the solid.
Sourcepub fn loft_faces(&mut self, faces: Vec<u32>) -> Result<u32, JsError>
pub fn loft_faces(&mut self, faces: Vec<u32>) -> Result<u32, JsError>
Loft two or more profile faces into a solid.
Takes an array of face handles. Returns a solid handle (u32).
§Errors
Returns an error if fewer than 2 faces or profiles have different vertex counts.
Sourcepub fn loft_smooth_faces(&mut self, faces: Vec<u32>) -> Result<u32, JsError>
pub fn loft_smooth_faces(&mut self, faces: Vec<u32>) -> Result<u32, JsError>
Loft profiles with smooth NURBS interpolation.
Like loft(), but produces smooth NURBS side surfaces for 3+
profiles instead of piecewise-planar quads. The surfaces
interpolate through all intermediate profiles with C1+ continuity.
Returns a solid handle (u32).
§Errors
Returns an error if fewer than 2 profiles are given, profiles have different vertex counts, or surface fitting fails.
Sourcepub fn loft_with_options(
&mut self,
faces: Vec<u32>,
options: &str,
) -> Result<u32, JsError>
pub fn loft_with_options( &mut self, faces: Vec<u32>, options: &str, ) -> Result<u32, JsError>
Loft profiles with options for start/end points and ruled mode.
options is a JSON string with optional fields:
startPoint: [x, y, z]— apex point before first profileendPoint: [x, y, z]— apex point after last profileruled: bool— true for ruled (linear) surfaces (default), false for smooth
Sourcepub fn shell_solid(
&mut self,
solid: u32,
thickness: f64,
open_faces: Vec<u32>,
) -> Result<u32, JsError>
pub fn shell_solid( &mut self, solid: u32, thickness: f64, open_faces: Vec<u32>, ) -> Result<u32, JsError>
Hollow a solid with uniform wall thickness.
open_faces is an array of face handles to remove (creating openings).
Returns a solid handle (u32).
§Errors
Returns an error if thickness is non-positive or the solid is invalid.
Sourcepub fn chamfer_solid(
&mut self,
solid: u32,
edge_handles: Vec<u32>,
distance: f64,
) -> Result<u32, JsError>
pub fn chamfer_solid( &mut self, solid: u32, edge_handles: Vec<u32>, distance: f64, ) -> Result<u32, JsError>
Chamfer edges of a solid.
edge_handles is an array of edge handles. Returns a solid handle.
§Errors
Returns an error if distance is non-positive or edges are invalid.
Sourcepub fn fillet_solid(
&mut self,
solid: u32,
edge_handles: Vec<u32>,
radius: f64,
) -> Result<u32, JsError>
pub fn fillet_solid( &mut self, solid: u32, edge_handles: Vec<u32>, radius: f64, ) -> Result<u32, JsError>
Fillet (round) edges of a solid.
edge_handles is an array of edge handles. Returns a solid handle.
§Errors
Returns an error if radius is non-positive or edges are invalid.
Sourcepub fn fillet_with_evolution(
&mut self,
solid: u32,
edge_handles: Vec<u32>,
radius: f64,
) -> Result<JsValue, JsError>
pub fn fillet_with_evolution( &mut self, solid: u32, edge_handles: Vec<u32>, radius: f64, ) -> Result<JsValue, JsError>
Apply a constant-radius fillet and return face-evolution tracking data.
Returns a JSON string {"solid": <u32>, "evolution": {modified, generated, deleted}} — the same shape as fuseWithEvolution. Blend
faces appear under generated and surviving faces under modified.
Provenance is matched geometrically (face normal + centroid), so it is
unaffected by how the fillet renumbers faces.
§Errors
Returns an error if a handle is invalid, the radius is non-positive, or the fillet fails.
Sourcepub fn extrude_face(
&mut self,
face: u32,
dir_x: f64,
dir_y: f64,
dir_z: f64,
distance: f64,
) -> Result<u32, JsError>
pub fn extrude_face( &mut self, face: u32, dir_x: f64, dir_y: f64, dir_z: f64, distance: f64, ) -> Result<u32, JsError>
Extrude a planar face along a direction vector to create a solid.
Returns a solid handle (u32).
§Errors
Returns an error if the face handle is invalid or the extrusion fails.
Sourcepub fn revolve_face(
&mut self,
face: u32,
ox: f64,
oy: f64,
oz: f64,
dx: f64,
dy: f64,
dz: f64,
angle_degrees: f64,
) -> Result<u32, JsError>
pub fn revolve_face( &mut self, face: u32, ox: f64, oy: f64, oz: f64, dx: f64, dy: f64, dz: f64, angle_degrees: f64, ) -> Result<u32, JsError>
Revolve a planar face around an axis to create a solid of revolution.
The axis is defined by an origin point (ox, oy, oz) and a direction
(dx, dy, dz). The angle is in degrees and must be in (0, 360].
Returns a solid handle (u32).
§Errors
Returns an error if any input is non-finite, the face handle is invalid, or the revolve operation fails.
Sourcepub fn sweep_face(
&mut self,
face: u32,
path_degree: u32,
path_knots: Vec<f64>,
path_control_points: Vec<f64>,
path_weights: Vec<f64>,
) -> Result<u32, JsError>
pub fn sweep_face( &mut self, face: u32, path_degree: u32, path_knots: Vec<f64>, path_control_points: Vec<f64>, path_weights: Vec<f64>, ) -> Result<u32, JsError>
Sweep a planar face along a NURBS curve path to create a solid.
The path is specified as flat arrays for JS interop:
path_degree— polynomial degree of the path curvepath_knots— knot vectorpath_control_points— flat[x,y,z, ...]control point coordinatespath_weights— per-control-point weights
Returns a solid handle (u32).
§Errors
Returns an error if the face handle is invalid, the NURBS arrays have inconsistent lengths, or the sweep operation fails.
Sourcepub fn multi_section_sweep(
&mut self,
face_handles: Vec<u32>,
params: Vec<f64>,
spine_degree: u32,
spine_knots: Vec<f64>,
spine_control_points: Vec<f64>,
spine_weights: Vec<f64>,
ruled: bool,
) -> Result<u32, JsError>
pub fn multi_section_sweep( &mut self, face_handles: Vec<u32>, params: Vec<f64>, spine_degree: u32, spine_knots: Vec<f64>, spine_control_points: Vec<f64>, spine_weights: Vec<f64>, ruled: bool, ) -> Result<u32, JsError>
Sweep through multiple section profiles along a spine, lofting the rotation-minimizing-frame-placed profiles.
face_handles and params are parallel arrays: each planar profile and
its parameter in [0, 1] along the spine (given as raw NURBS data).
ruled selects ruled (planar bands) vs smooth (NURBS) lofted sides.
Returns a solid handle (u32).
§Errors
Returns an error for fewer than two sections, mismatched array lengths, a non-finite or out-of-range value, a non-planar profile, or loft failure.
Sourcepub fn sweep_smooth_face(
&mut self,
face: u32,
path_degree: u32,
path_knots: Vec<f64>,
path_control_points: Vec<f64>,
path_weights: Vec<f64>,
) -> Result<u32, JsError>
pub fn sweep_smooth_face( &mut self, face: u32, path_degree: u32, path_knots: Vec<f64>, path_control_points: Vec<f64>, path_weights: Vec<f64>, ) -> Result<u32, JsError>
Sweep a face along a path with smooth NURBS side surfaces.
Like sweep(), but produces a single NURBS surface per edge strip
instead of multiple flat quads, giving smooth geometry that
tessellates to arbitrary quality.
Returns a solid handle (u32).
§Errors
Returns an error if the face or path is invalid, or surface fitting fails.
Sourcepub fn offset_face(
&mut self,
face: u32,
distance: f64,
samples: u32,
) -> Result<u32, JsError>
pub fn offset_face( &mut self, face: u32, distance: f64, samples: u32, ) -> Result<u32, JsError>
Offset a face by a distance along its surface normal.
Returns the new offset face handle.
§Errors
Returns an error if the face handle is invalid or the operation fails.
Sourcepub fn helical_sweep(
&mut self,
profile: u32,
axis_origin_x: f64,
axis_origin_y: f64,
axis_origin_z: f64,
axis_dir_x: f64,
axis_dir_y: f64,
axis_dir_z: f64,
radius: f64,
pitch: f64,
turns: f64,
) -> Result<u32, JsError>
pub fn helical_sweep( &mut self, profile: u32, axis_origin_x: f64, axis_origin_y: f64, axis_origin_z: f64, axis_dir_x: f64, axis_dir_y: f64, axis_dir_z: f64, radius: f64, pitch: f64, turns: f64, ) -> Result<u32, JsError>
Create a helical sweep of a profile face.
Sweeps the profile along a helix defined by axis, radius, pitch, and number of turns. Used for generating thread geometry.
§Errors
Returns an error if parameters are invalid or the sweep fails.
Sourcepub fn split_solid(
&mut self,
solid: u32,
px: f64,
py: f64,
pz: f64,
nx: f64,
ny: f64,
nz: f64,
) -> Result<Vec<u32>, JsError>
pub fn split_solid( &mut self, solid: u32, px: f64, py: f64, pz: f64, nx: f64, ny: f64, nz: f64, ) -> Result<Vec<u32>, JsError>
Split a solid into two halves along a plane.
Returns [positive_solid_handle, negative_solid_handle].
§Errors
Returns an error if the plane doesn’t intersect the solid.
Sourcepub fn draft_solid(
&mut self,
solid: u32,
face_handles: Vec<u32>,
pull_x: f64,
pull_y: f64,
pull_z: f64,
neutral_x: f64,
neutral_y: f64,
neutral_z: f64,
angle_degrees: f64,
) -> Result<u32, JsError>
pub fn draft_solid( &mut self, solid: u32, face_handles: Vec<u32>, pull_x: f64, pull_y: f64, pull_z: f64, neutral_x: f64, neutral_y: f64, neutral_z: f64, angle_degrees: f64, ) -> Result<u32, JsError>
Apply draft angle to faces of a solid.
face_handles is an array of face handles to draft.
Returns a solid handle.
§Errors
Returns an error if angle is zero or faces are invalid.
Sourcepub fn pipe_solid(
&mut self,
face: u32,
path_degree: u32,
path_knots: Vec<f64>,
path_control_points: Vec<f64>,
path_weights: Vec<f64>,
) -> Result<u32, JsError>
pub fn pipe_solid( &mut self, face: u32, path_degree: u32, path_knots: Vec<f64>, path_control_points: Vec<f64>, path_weights: Vec<f64>, ) -> Result<u32, JsError>
Pipe sweep: sweep a profile along a NURBS path (no guide).
Returns a solid handle.
§Errors
Returns an error if the face or path is invalid.
Sourcepub fn sweep_along_edges(
&mut self,
face: u32,
edge_handles: Vec<u32>,
) -> Result<u32, JsError>
pub fn sweep_along_edges( &mut self, face: u32, edge_handles: Vec<u32>, ) -> Result<u32, JsError>
Sweep a face along a path defined by a chain of edges.
A closed planar chain of lines and tangent arcs with an all-line perpendicular profile is swept analytically (exact plane / cylinder / cone faces); anything else falls back to fitting an interpolating NURBS curve through sampled chain points and sweeping along that.
Returns a solid handle (u32).
§Errors
Returns an error if fewer than 2 edges or the fit fails.
Sourcepub fn offset_solid(
&mut self,
solid: u32,
distance: f64,
) -> Result<u32, JsError>
pub fn offset_solid( &mut self, solid: u32, distance: f64, ) -> Result<u32, JsError>
Offset (shell) a solid by a distance.
Returns a new solid handle.
§Errors
Returns an error if the distance is zero or the solid is invalid.
Sourcepub fn offset_solid_v2(
&mut self,
solid: u32,
distance: f64,
) -> Result<u32, JsError>
pub fn offset_solid_v2( &mut self, solid: u32, distance: f64, ) -> Result<u32, JsError>
Offset all faces of a solid outward or inward (V2 pipeline).
Uses the new brepkit-offset engine with intersection-based joints.
§Errors
Returns an error if the distance is not finite or the solid is invalid.
Sourcepub fn thicken_face(
&mut self,
face: u32,
thickness: f64,
) -> Result<u32, JsError>
pub fn thicken_face( &mut self, face: u32, thickness: f64, ) -> Result<u32, JsError>
Thicken a face into a solid by offsetting it by the given distance.
Creates a solid from a face by extruding it along its normal by
thickness. Positive values offset outward, negative inward.
§Errors
Returns an error if the face handle is invalid or thickness is zero.
Sourcepub fn fillet_variable(
&mut self,
solid: u32,
json: &str,
) -> Result<u32, JsError>
pub fn fillet_variable( &mut self, solid: u32, json: &str, ) -> Result<u32, JsError>
Apply variable-radius fillets to edges.
json is a JSON string: [{"edge": u32, "law": "constant"|"linear"|"scurve", "start": f64, "end": f64}]
Also accepts brepjs-style fields: startRadius/endRadius as aliases for start/end.
When law is omitted and startRadius != endRadius, the law auto-detects as "linear".
Returns a new solid handle.
Sourcepub fn sweep_with_options(
&mut self,
profile: u32,
path_edge: u32,
contact_mode: &str,
scale_values: Vec<f64>,
segments: u32,
corner_mode: &str,
) -> Result<u32, JsError>
pub fn sweep_with_options( &mut self, profile: u32, path_edge: u32, contact_mode: &str, scale_values: Vec<f64>, segments: u32, corner_mode: &str, ) -> Result<u32, JsError>
Sweep a face along a NURBS path with advanced options.
contact_mode: “rmf” (default), “fixed”, or “constantNormal:x,y,z”
scale_values: flat [t0,s0,t1,s1,...] pairs for piecewise-linear scale law.
corner_mode: “smooth” (default), “miter”, or “round”
Returns a solid handle.
Sourcepub fn guided_sweep(
&mut self,
face: u32,
spine_degree: u32,
spine_knots: Vec<f64>,
spine_control_points: Vec<f64>,
spine_weights: Vec<f64>,
aux_degree: u32,
aux_knots: Vec<f64>,
aux_control_points: Vec<f64>,
aux_weights: Vec<f64>,
) -> Result<u32, JsError>
pub fn guided_sweep( &mut self, face: u32, spine_degree: u32, spine_knots: Vec<f64>, spine_control_points: Vec<f64>, spine_weights: Vec<f64>, aux_degree: u32, aux_knots: Vec<f64>, aux_control_points: Vec<f64>, aux_weights: Vec<f64>, ) -> Result<u32, JsError>
Guided (two-rail) sweep: sweep face along a spine, orienting the
profile so its up-vector tracks an auxiliary spine.
The spine and auxiliary spine are each passed as raw NURBS data
(degree, knots, flat control_points, weights). Returns a solid
handle (u32).
§Errors
Returns an error for a non-finite or malformed curve, a non-planar profile, or a degenerate path.
Sourcepub fn minkowski_sum(
&mut self,
solid_a: u32,
solid_b: u32,
) -> Result<u32, JsError>
pub fn minkowski_sum( &mut self, solid_a: u32, solid_b: u32, ) -> Result<u32, JsError>
Convex Minkowski sum of two solids (A ⊕ B).
Returns the convex hull of all pairwise vertex sums — exact for convex
polytopes (boxes, or a tessellated-sphere rolling tool), a convex
over-approximation otherwise. Returns a solid handle (u32).
§Errors
Returns an error if either handle is invalid, either solid is empty, or the summed points are degenerate so no hull can be built.
Sourcepub fn project_edges(
&self,
solid: u32,
origin_x: f64,
origin_y: f64,
origin_z: f64,
dir_x: f64,
dir_y: f64,
dir_z: f64,
x_axis_x: f64,
x_axis_y: f64,
x_axis_z: f64,
hidden_lines: bool,
deflection: f64,
) -> Result<JsValue, JsError>
pub fn project_edges( &self, solid: u32, origin_x: f64, origin_y: f64, origin_z: f64, dir_x: f64, dir_y: f64, dir_z: f64, x_axis_x: f64, x_axis_y: f64, x_axis_z: f64, hidden_lines: bool, deflection: f64, ) -> Result<JsValue, JsError>
Project a solid’s edges onto a view plane with hidden-line removal.
Viewed along dir (orthographic) through origin, with in-plane x-axis
x_axis. Returns a JSON string {"visible": [[x,y,…]], "hidden": [[…]]}
— flat 2D polylines in view coordinates. hidden_lines = false drops the
hidden set. Occlusion is an exact point-in-solid test.
§Errors
Returns an error for an invalid handle, a non-positive deflection, or a
degenerate dir/x_axis.
Sourcepub fn classify_point_winding(
&self,
solid: u32,
x: f64,
y: f64,
z: f64,
tolerance: f64,
) -> Result<String, JsError>
pub fn classify_point_winding( &self, solid: u32, x: f64, y: f64, z: f64, tolerance: f64, ) -> Result<String, JsError>
Classify a point relative to a solid using generalized winding numbers.
Returns “inside”, “outside”, or “boundary”.
Sourcepub fn classify_point_robust(
&self,
solid: u32,
x: f64,
y: f64,
z: f64,
tolerance: f64,
) -> Result<String, JsError>
pub fn classify_point_robust( &self, solid: u32, x: f64, y: f64, z: f64, tolerance: f64, ) -> Result<String, JsError>
Classify a point using robust dual-method (winding + ray casting).
Returns “inside”, “outside”, or “boundary”.
Sourcepub fn fill_coons_patch(
&mut self,
boundary_coords: Vec<f64>,
curve_lengths: Vec<u32>,
) -> Result<u32, JsError>
pub fn fill_coons_patch( &mut self, boundary_coords: Vec<f64>, curve_lengths: Vec<u32>, ) -> Result<u32, JsError>
Fill a 4-sided boundary with a Coons patch surface.
boundary_coords is flat [x,y,z, ...] for all 4 curves concatenated.
curve_lengths is [n0, n1, n2, n3] — number of points per curve.
Returns a face handle.
Sourcepub fn untrim_face(
&mut self,
face: u32,
samples_per_curve: u32,
interior_samples: u32,
) -> Result<u32, JsError>
pub fn untrim_face( &mut self, face: u32, samples_per_curve: u32, interior_samples: u32, ) -> Result<u32, JsError>
Untrim a NURBS face by fitting a new surface to the trimmed region.
Returns a new face handle.
Sourcepub fn offset_wire(&mut self, face: u32, distance: f64) -> Result<u32, JsError>
pub fn offset_wire(&mut self, face: u32, distance: f64) -> Result<u32, JsError>
Offset a wire on a planar face.
Returns a new wire handle.
Sourcepub fn offset_wire_with_join_type(
&mut self,
face: u32,
distance: f64,
join_type: &str,
) -> Result<u32, JsError>
pub fn offset_wire_with_join_type( &mut self, face: u32, distance: f64, join_type: &str, ) -> Result<u32, JsError>
Offset a wire on a planar face with a specific join type.
join_type must be one of "intersection", "arc", or "chamfer".
Returns a new wire handle.
§Errors
Returns an error if the face handle is invalid, the join type string is unrecognized, or the offset operation fails.
Sourcepub fn offset_wire_2d_with_join(
&mut self,
wire: u32,
distance: f64,
join_type: &str,
) -> Result<u32, JsError>
pub fn offset_wire_2d_with_join( &mut self, wire: u32, distance: f64, join_type: &str, ) -> Result<u32, JsError>
Offset a planar wire directly by a distance with a specific join type.
Builds a planar face from the wire internally, then offsets it with
the requested corner join. This is the wire-based counterpart to
offset_wire_with_join_type,
which requires a face handle. Consumers that only hold a wire (such
as 2D sketch offsets) can route a join type through this entry point
without first constructing a face.
join_type must be one of "intersection", "arc", or "chamfer".
Returns a new wire handle.
§Errors
Returns an error if the wire handle is invalid, the wire is not planar, the join type string is unrecognized, or the offset operation fails.
Sourcepub fn get_shape_orientation(&self, _id: u32) -> String
pub fn get_shape_orientation(&self, _id: u32) -> String
Get the orientation of a shape.
Returns "forward" for all faces (brepkit faces don’t have an
independent orientation flag; the normal direction is canonical).
Sourcepub fn reverse_shape(&mut self, id: u32) -> Result<u32, JsError>
pub fn reverse_shape(&mut self, id: u32) -> Result<u32, JsError>
Reverse the orientation of a face or edge.
For faces: creates a new face with negated plane normal. For edges: creates a new edge with swapped start/end vertices. Returns the handle of the new reversed shape.
§Errors
Returns an error if the handle is neither a valid face nor edge.
Sourcepub fn fillet_v2(
&mut self,
solid: u32,
edge_handles: Vec<u32>,
radius: f64,
) -> Result<u32, JsError>
pub fn fillet_v2( &mut self, solid: u32, edge_handles: Vec<u32>, radius: f64, ) -> Result<u32, JsError>
Fillet edges using the v2 walking-based blend engine.
Returns a new solid handle.
§Errors
Returns an error if the solid or edge handles are invalid, or the blend computation fails.
Sourcepub fn chamfer_v2(
&mut self,
solid: u32,
edge_handles: Vec<u32>,
d1: f64,
d2: f64,
) -> Result<u32, JsError>
pub fn chamfer_v2( &mut self, solid: u32, edge_handles: Vec<u32>, d1: f64, d2: f64, ) -> Result<u32, JsError>
Chamfer edges with two distances using the v2 blend engine.
Returns a new solid handle.
§Errors
Returns an error if the solid or edge handles are invalid, or the blend computation fails.
Sourcepub fn chamfer_distance_angle(
&mut self,
solid: u32,
edge_handles: Vec<u32>,
distance: f64,
angle: f64,
) -> Result<u32, JsError>
pub fn chamfer_distance_angle( &mut self, solid: u32, edge_handles: Vec<u32>, distance: f64, angle: f64, ) -> Result<u32, JsError>
Chamfer edges with distance and angle using the v2 blend engine.
Returns a new solid handle.
§Errors
Returns an error if the solid or edge handles are invalid, or the blend computation fails.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn offset_polygon_2d(
&self,
coords: Vec<f64>,
distance: f64,
tolerance: f64,
) -> Result<Vec<f64>, JsError>
pub fn offset_polygon_2d( &self, coords: Vec<f64>, distance: f64, tolerance: f64, ) -> Result<Vec<f64>, JsError>
Offset a 2D polygon by a signed distance.
coords is a flat array [x,y, x,y, ...] of 2D points.
Returns a flat array of offset polygon coordinates.
Sourcepub fn point_in_polygon_2d(
&self,
polygon_coords: Vec<f64>,
px: f64,
py: f64,
) -> Result<bool, JsError>
pub fn point_in_polygon_2d( &self, polygon_coords: Vec<f64>, px: f64, py: f64, ) -> Result<bool, JsError>
Test if a 2D point is inside a closed polygon.
polygon_coords is a flat array [x,y, x,y, ...].
Returns true if the point is inside the polygon (winding number test).
Sourcepub fn polygons_intersect_2d(
&self,
coords_a: Vec<f64>,
coords_b: Vec<f64>,
) -> Result<bool, JsError>
pub fn polygons_intersect_2d( &self, coords_a: Vec<f64>, coords_b: Vec<f64>, ) -> Result<bool, JsError>
Test if two 2D polygons intersect (overlap).
Both polygons are flat arrays [x,y, x,y, ...].
Returns true if any vertex of one polygon is inside the other
or if any edges cross.
Sourcepub fn intersect_polygons_2d(
&self,
coords_a: Vec<f64>,
coords_b: Vec<f64>,
) -> Result<Vec<f64>, JsError>
pub fn intersect_polygons_2d( &self, coords_a: Vec<f64>, coords_b: Vec<f64>, ) -> Result<Vec<f64>, JsError>
Compute the boolean intersection of two 2D polygons.
Both polygons are flat arrays [x,y, x,y, ...].
Returns a flat array of the intersection polygon coordinates,
or an empty array if they don’t intersect.
Uses the Sutherland-Hodgman algorithm (convex clipper).
Sourcepub fn common_segment_2d(
&self,
coords_a: Vec<f64>,
coords_b: Vec<f64>,
) -> Result<Vec<f64>, JsError>
pub fn common_segment_2d( &self, coords_a: Vec<f64>, coords_b: Vec<f64>, ) -> Result<Vec<f64>, JsError>
Find common (shared) edges between two adjacent 2D polygons.
Both polygons are flat arrays [x,y, x,y, ...].
Returns a flat array of common segment endpoints [x1,y1, x2,y2, ...],
or an empty array if no common segments exist.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn make_box_solid(
&mut self,
dx: f64,
dy: f64,
dz: f64,
) -> Result<u32, JsError>
pub fn make_box_solid( &mut self, dx: f64, dy: f64, dz: f64, ) -> Result<u32, JsError>
Create a box solid with the given dimensions, centered at the origin.
Returns a solid handle (u32).
§Errors
Returns an error if any dimension is non-positive or non-finite.
Sourcepub fn make_cylinder_solid(
&mut self,
radius: f64,
height: f64,
) -> Result<u32, JsError>
pub fn make_cylinder_solid( &mut self, radius: f64, height: f64, ) -> Result<u32, JsError>
Create a cylinder solid centered at the origin, axis along +Z.
Returns a solid handle (u32).
§Errors
Returns an error if radius or height is non-positive.
Sourcepub fn make_sphere_solid(
&mut self,
radius: f64,
segments: u32,
) -> Result<u32, JsError>
pub fn make_sphere_solid( &mut self, radius: f64, segments: u32, ) -> Result<u32, JsError>
Create a sphere solid centered at the origin.
Returns a solid handle (u32).
§Errors
Returns an error if radius is non-positive or segments < 4.
Sourcepub fn make_cone_solid(
&mut self,
bottom_radius: f64,
top_radius: f64,
height: f64,
) -> Result<u32, JsError>
pub fn make_cone_solid( &mut self, bottom_radius: f64, top_radius: f64, height: f64, ) -> Result<u32, JsError>
Create a cone or frustum solid centered at the origin, axis along +Z.
Returns a solid handle (u32).
§Errors
Returns an error if height is non-positive or both radii are zero.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn get_solid_faces(&self, solid: u32) -> Result<Vec<u32>, JsError>
pub fn get_solid_faces(&self, solid: u32) -> Result<Vec<u32>, JsError>
Get all face handles of a solid.
Returns an array of face handles (u32[]).
§Errors
Returns an error if the solid handle is invalid.
Sourcepub fn get_solid_edges(&self, solid: u32) -> Result<Vec<u32>, JsError>
pub fn get_solid_edges(&self, solid: u32) -> Result<Vec<u32>, JsError>
Get all edge handles of a solid.
Returns an array of unique edge handles (u32[]).
§Errors
Returns an error if the solid handle is invalid.
Sourcepub fn get_solid_vertices(&self, solid: u32) -> Result<Vec<u32>, JsError>
pub fn get_solid_vertices(&self, solid: u32) -> Result<Vec<u32>, JsError>
Get all vertex handles of a solid.
Returns an array of unique vertex handles (u32[]).
§Errors
Returns an error if the solid handle is invalid.
Sourcepub fn get_solid_shells(&self, solid: u32) -> Result<Vec<u32>, JsError>
pub fn get_solid_shells(&self, solid: u32) -> Result<Vec<u32>, JsError>
Get all shell handles of a solid.
Returns the outer shell first, followed by any inner void shells
(cavities produced by shell/hollow operations or boolean cuts).
A simple solid such as a box reports exactly one shell.
§Errors
Returns an error if the solid handle is invalid.
Sourcepub fn get_edge_vertices(&self, edge: u32) -> Result<Vec<f64>, JsError>
pub fn get_edge_vertices(&self, edge: u32) -> Result<Vec<f64>, JsError>
Get the vertex positions of an edge.
Returns [start_x, start_y, start_z, end_x, end_y, end_z].
§Errors
Returns an error if the edge handle is invalid.
Sourcepub fn get_edge_vertex_handles(&self, edge: u32) -> Result<Vec<u32>, JsError>
pub fn get_edge_vertex_handles(&self, edge: u32) -> Result<Vec<u32>, JsError>
Get the vertex handles (not positions) of an edge.
Returns [start_vertex_handle, end_vertex_handle].
§Errors
Returns an error if the edge handle is invalid.
Sourcepub fn get_vertex_position(&self, vertex: u32) -> Result<Vec<f64>, JsError>
pub fn get_vertex_position(&self, vertex: u32) -> Result<Vec<f64>, JsError>
Get the position of a vertex.
Returns [x, y, z].
§Errors
Returns an error if the vertex handle is invalid.
Sourcepub fn to_brep(&self, solid: u32) -> Result<JsValue, JsError>
pub fn to_brep(&self, solid: u32) -> Result<JsValue, JsError>
Export a solid as a BREP string (STEP format).
Returns a STEP-formatted string containing the solid’s B-Rep data.
Use fromBREP to reconstruct the solid from this string.
§Errors
Returns an error if the solid handle is invalid.
Sourcepub fn to_brep_json(&self, solid: u32) -> Result<JsValue, JsError>
pub fn to_brep_json(&self, solid: u32) -> Result<JsValue, JsError>
Export a solid as a JSON-encoded BREP representation.
Returns a JSON string with vertices, edges (with curve parameters), and faces (with surface parameters). This is a brepkit-specific format that preserves all analytic geometry types.
Sourcepub fn from_brep(&mut self, data: &str) -> Result<u32, JsError>
pub fn from_brep(&mut self, data: &str) -> Result<u32, JsError>
Reconstruct a solid from a BREP string.
Accepts both STEP format (from toBREP) and JSON format (from
toBrepJson). Auto-detects the format: strings starting with {
are parsed as JSON, otherwise as STEP.
Only single-solid STEP files are supported. Multi-solid files will return only the first solid.
§Errors
Returns an error if the data is invalid or reconstruction fails.
Sourcepub fn get_face_normal(&self, face: u32) -> Result<Vec<f64>, JsError>
pub fn get_face_normal(&self, face: u32) -> Result<Vec<f64>, JsError>
Get the face normal of a planar face.
Returns [nx, ny, nz].
§Errors
Returns an error if the face is invalid or NURBS.
Sourcepub fn get_entity_counts(&self, solid: u32) -> Result<Vec<u32>, JsError>
pub fn get_entity_counts(&self, solid: u32) -> Result<Vec<u32>, JsError>
Get entity counts of a solid: [faces, edges, vertices].
§Errors
Returns an error if the solid handle is invalid.
Sourcepub fn get_face_edges(&self, face: u32) -> Result<Vec<u32>, JsError>
pub fn get_face_edges(&self, face: u32) -> Result<Vec<u32>, JsError>
Get the edge handles of a face.
Returns an array of edge handles (u32[]).
Sourcepub fn get_face_vertices(&self, face: u32) -> Result<Vec<u32>, JsError>
pub fn get_face_vertices(&self, face: u32) -> Result<Vec<u32>, JsError>
Get the vertex handles of a face.
Returns an array of vertex handles (u32[]).
Sourcepub fn get_face_outer_wire(&self, face: u32) -> Result<u32, JsError>
pub fn get_face_outer_wire(&self, face: u32) -> Result<u32, JsError>
Get the outer wire handle of a face.
Returns a wire handle (u32).
Sourcepub fn get_face_wires(&self, face: u32) -> Result<Vec<u32>, JsError>
pub fn get_face_wires(&self, face: u32) -> Result<Vec<u32>, JsError>
Get all wires of a face (outer wire first, then inner/hole wires).
§Errors
Returns an error if the face handle is invalid.
Sourcepub fn get_surface_type(&self, face: u32) -> Result<String, JsError>
pub fn get_surface_type(&self, face: u32) -> Result<String, JsError>
Get the surface type of a face.
Returns one of: "plane", "cylinder", "cone", "sphere",
"torus", "bspline".
For NURBS surfaces that exactly represent analytic shapes, this
returns the underlying analytic type (e.g. "sphere" for a NURBS
sphere patch).
Sourcepub fn get_edge_curve_type(&self, edge: u32) -> Result<String, JsError>
pub fn get_edge_curve_type(&self, edge: u32) -> Result<String, JsError>
Get the curve type of an edge.
Returns "LINE", "BSPLINE_CURVE", "CIRCLE", or "ELLIPSE".
For NURBS curves that exactly represent analytic curves, this
returns the underlying analytic type (e.g. "CIRCLE" for a
rational NURBS circle).
Sourcepub fn get_edge_curve_parameters(&self, edge: u32) -> Result<Vec<f64>, JsError>
pub fn get_edge_curve_parameters(&self, edge: u32) -> Result<Vec<f64>, JsError>
Get the parameter domain of an edge curve.
Returns [t_start, t_end].
For line edges: [0.0, length].
For NURBS edges: knot domain.
Sourcepub fn evaluate_edge_curve(
&self,
edge: u32,
t: f64,
) -> Result<Vec<f64>, JsError>
pub fn evaluate_edge_curve( &self, edge: u32, t: f64, ) -> Result<Vec<f64>, JsError>
Evaluate a point on an edge curve at parameter t.
Returns [x, y, z].
Sourcepub fn evaluate_edge_curve_d1(
&self,
edge: u32,
t: f64,
) -> Result<Vec<f64>, JsError>
pub fn evaluate_edge_curve_d1( &self, edge: u32, t: f64, ) -> Result<Vec<f64>, JsError>
Evaluate a point and tangent on an edge curve at parameter t.
Returns [px, py, pz, tx, ty, tz].
Sourcepub fn measure_curvature_at_edge(
&self,
edge: u32,
t: f64,
) -> Result<Vec<f64>, JsError>
pub fn measure_curvature_at_edge( &self, edge: u32, t: f64, ) -> Result<Vec<f64>, JsError>
Measure curvature of an edge curve at parameter t.
Returns [curvature, tangent_x, tangent_y, tangent_z, normal_x, normal_y, normal_z].
Curvature is 1/radius. For lines, curvature is 0.
Sourcepub fn evaluate_surface_normal(
&self,
face: u32,
u: f64,
v: f64,
) -> Result<Vec<f64>, JsError>
pub fn evaluate_surface_normal( &self, face: u32, u: f64, v: f64, ) -> Result<Vec<f64>, JsError>
Evaluate a surface normal at (u, v) on a face.
Returns [nx, ny, nz].
Sourcepub fn evaluate_surface(
&self,
face: u32,
u: f64,
v: f64,
) -> Result<Vec<f64>, JsError>
pub fn evaluate_surface( &self, face: u32, u: f64, v: f64, ) -> Result<Vec<f64>, JsError>
Evaluate a point on a face surface at (u, v).
Returns [x, y, z].
Sourcepub fn measure_curvature_at_surface(
&self,
face: u32,
u: f64,
v: f64,
) -> Result<Vec<f64>, JsError>
pub fn measure_curvature_at_surface( &self, face: u32, u: f64, v: f64, ) -> Result<Vec<f64>, JsError>
Measure principal curvatures at (u, v) on a face surface.
Returns [k1, k2, d1x, d1y, d1z, d2x, d2y, d2z] where k1/k2 are
principal curvatures and d1/d2 are the corresponding direction vectors.
Sourcepub fn tessellate_edge(
&self,
edge: u32,
num_points: u32,
) -> Result<Vec<f64>, JsError>
pub fn tessellate_edge( &self, edge: u32, num_points: u32, ) -> Result<Vec<f64>, JsError>
Tessellate an edge curve into polyline segments.
For line edges, returns just start and end points.
For NURBS edges, samples at num_points along the curve.
Returns flattened [x, y, z, x, y, z, ...] array.
Sourcepub fn is_edge_forward_in_wire(
&self,
edge: u32,
wire: u32,
) -> Result<bool, JsError>
pub fn is_edge_forward_in_wire( &self, edge: u32, wire: u32, ) -> Result<bool, JsError>
Check if an edge is forward-oriented in a given wire.
Returns true if the edge is forward in the wire, false if reversed.
Sourcepub fn get_surface_domain(&self, face: u32) -> Result<Vec<f64>, JsError>
pub fn get_surface_domain(&self, face: u32) -> Result<Vec<f64>, JsError>
Get the UV parameter domain of a face’s surface.
Returns [u_min, u_max, v_min, v_max].
Sourcepub fn project_point_on_surface(
&self,
face: u32,
px: f64,
py: f64,
pz: f64,
) -> Result<Vec<f64>, JsError>
pub fn project_point_on_surface( &self, face: u32, px: f64, py: f64, pz: f64, ) -> Result<Vec<f64>, JsError>
Project a 3D point onto a face surface using Newton iteration.
Returns [u, v, px, py, pz, distance].
Sourcepub fn add_holes_to_face(
&mut self,
face: u32,
hole_wire_handles: Vec<u32>,
) -> Result<u32, JsError>
pub fn add_holes_to_face( &mut self, face: u32, hole_wire_handles: Vec<u32>, ) -> Result<u32, JsError>
Add hole wires to an existing face, creating a new face with the same surface but additional inner wires.
Returns a new face handle (u32).
Sourcepub fn get_edge_nurbs_data(&self, edge: u32) -> Result<JsValue, JsError>
pub fn get_edge_nurbs_data(&self, edge: u32) -> Result<JsValue, JsError>
Build an edge’s NURBS curve data for JS consumption.
Returns null for line edges, or a JSON string with
{degree, knots, controlPoints, weights} for NURBS edges.
Sourcepub fn edge_to_face_map(&self, solid: u32) -> Result<String, JsError>
pub fn edge_to_face_map(&self, solid: u32) -> Result<String, JsError>
Get the edge-to-face adjacency map for a solid.
Returns a JSON string: {"edgeId": [faceId, ...], ...}.
Get edges shared between two faces.
Returns an array of edge handles.
Sourcepub fn adjacent_faces(&self, solid: u32, face: u32) -> Result<Vec<u32>, JsError>
pub fn adjacent_faces(&self, solid: u32, face: u32) -> Result<Vec<u32>, JsError>
Get faces adjacent to a given face within a solid.
Returns an array of face handles.
Sourcepub fn face_wires(&self, face: u32) -> Result<Vec<u32>, JsError>
pub fn face_wires(&self, face: u32) -> Result<Vec<u32>, JsError>
Get the wires (outer + inner) of a face.
Returns an array of wire handles.
Sourcepub fn get_compound_solids(&self, compound: u32) -> Result<Vec<u32>, JsError>
pub fn get_compound_solids(&self, compound: u32) -> Result<Vec<u32>, JsError>
Get the solid handles within a compound.
Returns an array of solid handles (u32[]).
§Errors
Returns an error if the compound handle is invalid.
Sourcepub fn get_shell_faces(&self, shell: u32) -> Result<Vec<u32>, JsError>
pub fn get_shell_faces(&self, shell: u32) -> Result<Vec<u32>, JsError>
Get the face handles of a shell.
Returns an array of face handles (u32[]).
§Errors
Returns an error if the shell handle is invalid.
Sourcepub fn get_wire_edges(&self, wire: u32) -> Result<Vec<u32>, JsError>
pub fn get_wire_edges(&self, wire: u32) -> Result<Vec<u32>, JsError>
Get the edge handles of a wire.
Returns an array of unique edge handles (u32[]).
§Errors
Returns an error if the wire handle is invalid.
Sourcepub fn is_wire_closed(&self, wire: u32) -> Result<bool, JsError>
pub fn is_wire_closed(&self, wire: u32) -> Result<bool, JsError>
Check whether a wire is closed (last edge connects back to first).
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn make_rectangle(
&mut self,
width: f64,
height: f64,
) -> Result<u32, JsError>
pub fn make_rectangle( &mut self, width: f64, height: f64, ) -> Result<u32, JsError>
Create a rectangular face on the XY plane centered at the origin.
Returns a face handle (u32).
§Errors
Returns an error if width or height is non-positive, NaN,
or infinite, or if the face geometry cannot be constructed.
Sourcepub fn make_polygon(&mut self, coords: Vec<f64>) -> Result<u32, JsError>
pub fn make_polygon(&mut self, coords: Vec<f64>) -> Result<u32, JsError>
Create a polygonal face from flat coordinate triples [x,y,z, ...].
Requires at least 3 points (9 f64 values).
Returns a face handle (u32).
§Errors
Returns an error if coords length is not a multiple of 3,
fewer than 3 points are provided, or the face normal is degenerate.
Sourcepub fn make_circle(
&mut self,
radius: f64,
segments: u32,
) -> Result<u32, JsError>
pub fn make_circle( &mut self, radius: f64, segments: u32, ) -> Result<u32, JsError>
Create a circular polygon approximation on the XY plane.
The circle is centered at the origin with the given radius,
approximated by segments straight edges.
Returns a face handle (u32).
§Errors
Returns an error if fewer than 3 segments are specified.
Sourcepub fn make_vertex(&mut self, x: f64, y: f64, z: f64) -> Result<u32, JsError>
pub fn make_vertex(&mut self, x: f64, y: f64, z: f64) -> Result<u32, JsError>
Create a vertex at the given position.
Returns a vertex handle (u32).
Sourcepub fn make_line_edge(
&mut self,
x1: f64,
y1: f64,
z1: f64,
x2: f64,
y2: f64,
z2: f64,
) -> Result<u32, JsError>
pub fn make_line_edge( &mut self, x1: f64, y1: f64, z1: f64, x2: f64, y2: f64, z2: f64, ) -> Result<u32, JsError>
Create a straight-line edge between two points.
Returns an edge handle (u32).
Sourcepub fn make_circle_edge(
&mut self,
cx: f64,
cy: f64,
cz: f64,
nx: f64,
ny: f64,
nz: f64,
radius: f64,
) -> Result<u32, JsError>
pub fn make_circle_edge( &mut self, cx: f64, cy: f64, cz: f64, nx: f64, ny: f64, nz: f64, radius: f64, ) -> Result<u32, JsError>
Create a closed circular edge with true Circle curve geometry.
Unlike makeCircle (which returns a polygon face approximation),
this creates a single closed edge with an EdgeCurve::Circle
backing curve and parameter domain [0, 2π]. The start and end
vertex are shared at the seam point circle.evaluate(0.0).
Returns an edge handle (u32).
§Errors
Returns an error if any coordinate is NaN/infinite, radius is
non-positive, or the normal vector is zero.
Sourcepub fn make_ellipse_edge(
&mut self,
cx: f64,
cy: f64,
cz: f64,
nx: f64,
ny: f64,
nz: f64,
semi_major: f64,
semi_minor: f64,
) -> Result<u32, JsError>
pub fn make_ellipse_edge( &mut self, cx: f64, cy: f64, cz: f64, nx: f64, ny: f64, nz: f64, semi_major: f64, semi_minor: f64, ) -> Result<u32, JsError>
Create a closed elliptical edge with true Ellipse curve geometry.
Creates a single closed edge with an EdgeCurve::Ellipse backing
curve and parameter domain [0, 2π]. The start and end vertex are
shared at the seam point ellipse.evaluate(0.0).
Returns an edge handle (u32).
§Errors
Returns an error if any coordinate is NaN/infinite, either
semi-axis is non-positive, semi_minor exceeds semi_major, or
the normal vector is zero.
Sourcepub fn make_circle_edge_with_ref(
&mut self,
cx: f64,
cy: f64,
cz: f64,
nx: f64,
ny: f64,
nz: f64,
radius: f64,
rx: f64,
ry: f64,
rz: f64,
) -> Result<u32, JsError>
pub fn make_circle_edge_with_ref( &mut self, cx: f64, cy: f64, cz: f64, nx: f64, ny: f64, nz: f64, radius: f64, rx: f64, ry: f64, rz: f64, ) -> Result<u32, JsError>
Create a closed circular edge with a caller-supplied reference x-direction.
Like makeCircleEdge, but ref_dir = (rx, ry, rz)
is projected onto the plane perpendicular to the normal to fix the
circle’s u_axis — which controls the seam vertex position at
circle.evaluate(0.0). Use when downstream code (PCurve computation,
extrusion frame) depends on a specific seam placement.
ref_dir must be non-zero (rejected at this boundary) and ideally
not parallel to the normal — Frame3::from_normal_and_ref falls
back to an arbitrary perpendicular when the projection of ref_dir
onto the plane is degenerate, defeating the purpose of this call.
Returns an edge handle (u32).
§Errors
Returns an error if any coordinate is NaN/infinite, radius is
non-positive, or the normal vector or ref_dir is zero.
Sourcepub fn make_ellipse_edge_with_ref(
&mut self,
cx: f64,
cy: f64,
cz: f64,
nx: f64,
ny: f64,
nz: f64,
semi_major: f64,
semi_minor: f64,
rx: f64,
ry: f64,
rz: f64,
) -> Result<u32, JsError>
pub fn make_ellipse_edge_with_ref( &mut self, cx: f64, cy: f64, cz: f64, nx: f64, ny: f64, nz: f64, semi_major: f64, semi_minor: f64, rx: f64, ry: f64, rz: f64, ) -> Result<u32, JsError>
Create a closed elliptical edge with a caller-supplied reference major-axis.
Like makeEllipseEdge, but ref_dir = (rx, ry, rz)
is projected onto the plane perpendicular to the normal to fix the
ellipse’s major-axis direction (u_axis, carrying semi_major).
Use this when the caller has an intended major-axis orientation —
otherwise the default-frame variant chooses an arbitrary
perpendicular, which can cause adapters to fall back to NURBS
approximations to preserve their requested orientation.
ref_dir must be non-zero (rejected at this boundary) and ideally
not parallel to the normal — Frame3::from_normal_and_ref falls
back to an arbitrary perpendicular when the projection of ref_dir
onto the plane is degenerate, defeating the purpose of this call.
Returns an edge handle (u32).
§Errors
Returns an error if any coordinate is NaN/infinite, either
semi-axis is non-positive, semi_minor exceeds semi_major, or
the normal vector or ref_dir is zero.
Sourcepub fn make_circle_arc_3d(
&mut self,
start_x: f64,
start_y: f64,
start_z: f64,
end_x: f64,
end_y: f64,
end_z: f64,
center_x: f64,
center_y: f64,
center_z: f64,
axis_x: f64,
axis_y: f64,
axis_z: f64,
) -> Result<u32, JsError>
pub fn make_circle_arc_3d( &mut self, start_x: f64, start_y: f64, start_z: f64, end_x: f64, end_y: f64, end_z: f64, center_x: f64, center_y: f64, center_z: f64, axis_x: f64, axis_y: f64, axis_z: f64, ) -> Result<u32, JsError>
Create a circular arc edge between two points.
The arc lies on a circle with the given center, normal axis, and
radius derived from |start − center|. The arc goes from start
to end counter-clockwise when viewed along the normal.
Returns an edge handle (u32).
Sourcepub fn make_ellipse_arc_3d(
&mut self,
start_x: f64,
start_y: f64,
start_z: f64,
end_x: f64,
end_y: f64,
end_z: f64,
center_x: f64,
center_y: f64,
center_z: f64,
axis_x: f64,
axis_y: f64,
axis_z: f64,
ref_x: f64,
ref_y: f64,
ref_z: f64,
semi_major: f64,
semi_minor: f64,
) -> Result<u32, JsError>
pub fn make_ellipse_arc_3d( &mut self, start_x: f64, start_y: f64, start_z: f64, end_x: f64, end_y: f64, end_z: f64, center_x: f64, center_y: f64, center_z: f64, axis_x: f64, axis_y: f64, axis_z: f64, ref_x: f64, ref_y: f64, ref_z: f64, semi_major: f64, semi_minor: f64, ) -> Result<u32, JsError>
Create a trimmed elliptical arc edge.
The ellipse is defined by center, axis (plane normal), the
ref major-axis direction, and semi_major/semi_minor. The
start/end points trim it to the CCW arc between them (they must
lie on the ellipse). Produces an EdgeCurve::Ellipse edge — not a
NURBS approximation — so it reports CIRCLE/ELLIPSE-class geometry.
Returns an edge handle (u32).
§Errors
Returns an error if any coordinate is NaN/infinite, a semi-axis is
non-positive, semi_minor exceeds semi_major, or axis/ref is
a zero vector.
Sourcepub fn make_nurbs_edge(
&mut self,
start_x: f64,
start_y: f64,
start_z: f64,
end_x: f64,
end_y: f64,
end_z: f64,
degree: u32,
knots: Vec<f64>,
control_points: Vec<f64>,
weights: Vec<f64>,
) -> Result<u32, JsError>
pub fn make_nurbs_edge( &mut self, start_x: f64, start_y: f64, start_z: f64, end_x: f64, end_y: f64, end_z: f64, degree: u32, knots: Vec<f64>, control_points: Vec<f64>, weights: Vec<f64>, ) -> Result<u32, JsError>
Create a NURBS curve edge.
Returns an edge handle (u32).
Sourcepub fn make_tangent_arc_3d(
&mut self,
start_x: f64,
start_y: f64,
start_z: f64,
tangent_x: f64,
tangent_y: f64,
tangent_z: f64,
end_x: f64,
end_y: f64,
end_z: f64,
) -> Result<u32, JsError>
pub fn make_tangent_arc_3d( &mut self, start_x: f64, start_y: f64, start_z: f64, tangent_x: f64, tangent_y: f64, tangent_z: f64, end_x: f64, end_y: f64, end_z: f64, ) -> Result<u32, JsError>
Create a circular arc edge defined by start point, tangent direction at start, and end point.
If the tangent is parallel to the start→end chord (collinear), falls back to a straight line edge.
Returns an edge handle (u32).
Sourcepub fn lift_curve2d_to_plane(
&mut self,
curve_type: u32,
curve_params: Vec<f64>,
origin_x: f64,
origin_y: f64,
origin_z: f64,
x_axis_x: f64,
x_axis_y: f64,
x_axis_z: f64,
normal_x: f64,
normal_y: f64,
normal_z: f64,
t_start: f64,
t_end: f64,
) -> Result<u32, JsError>
pub fn lift_curve2d_to_plane( &mut self, curve_type: u32, curve_params: Vec<f64>, origin_x: f64, origin_y: f64, origin_z: f64, x_axis_x: f64, x_axis_y: f64, x_axis_z: f64, normal_x: f64, normal_y: f64, normal_z: f64, t_start: f64, t_end: f64, ) -> Result<u32, JsError>
Lift a 2D curve onto a 3D plane, producing an edge.
curve_type: 0 = Line, 1 = Circle, 2 = Ellipse, 3 = NURBS.
curve_params layout varies by type (see docs).
The plane is defined by an origin, x-axis, and normal.
t_start/t_end specify the parameter range on the 2D curve.
Returns an edge handle (u32).
Sourcepub fn make_wire(
&mut self,
edge_handles: Vec<u32>,
closed: bool,
) -> Result<u32, JsError>
pub fn make_wire( &mut self, edge_handles: Vec<u32>, closed: bool, ) -> Result<u32, JsError>
Create a closed wire from an ordered array of edge handles.
Returns a wire handle (u32).
Sourcepub fn make_face_from_wire(&mut self, wire: u32) -> Result<u32, JsError>
pub fn make_face_from_wire(&mut self, wire: u32) -> Result<u32, JsError>
Create a face from a wire.
Samples the wire’s edges and attaches a planar surface only if the
geometry lies within tolerance of a single plane; otherwise a
non-planar surface is attached, so getSurfaceType never reports
"plane" for a non-coplanar wire.
Returns a face handle (u32).
Sourcepub fn make_planar_face_from_wire(&mut self, wire: u32) -> Result<u32, JsError>
pub fn make_planar_face_from_wire(&mut self, wire: u32) -> Result<u32, JsError>
Create a strictly planar face from a wire.
Fails with a “wire is not planar” error if the wire’s geometry does not lie within tolerance of a single plane. Use this for planar-only construction intent (probing whether a wire is planar).
Returns a face handle (u32).
Sourcepub fn solid_from_shell(&mut self, shell: u32) -> Result<u32, JsError>
pub fn solid_from_shell(&mut self, shell: u32) -> Result<u32, JsError>
Create a solid from a shell.
Returns a solid handle (u32).
Sourcepub fn make_compound(&mut self, solid_handles: Vec<u32>) -> Result<u32, JsError>
pub fn make_compound(&mut self, solid_handles: Vec<u32>) -> Result<u32, JsError>
Create a compound from multiple solid handles.
Returns a compound handle (stored as u32).
Sourcepub fn convex_hull(&mut self, coords: Vec<f64>) -> Result<u32, JsError>
pub fn convex_hull(&mut self, coords: Vec<f64>) -> Result<u32, JsError>
Build a convex hull solid from a point cloud.
Uses the Quickhull algorithm for 3D point sets.
Returns a solid handle (u32).
§Errors
Returns an error if fewer than 4 non-coplanar points are provided.
Sourcepub fn make_polygon_wire(&mut self, coords: Vec<f64>) -> Result<u32, JsError>
pub fn make_polygon_wire(&mut self, coords: Vec<f64>) -> Result<u32, JsError>
Create a closed polygon wire from flat coordinates.
Returns a wire handle.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn sketch_new(&mut self) -> u32
pub fn sketch_new(&mut self) -> u32
Create a new empty sketch. Returns a sketch index.
Sourcepub fn sketch_add_point(
&mut self,
sketch: u32,
x: f64,
y: f64,
fixed: bool,
) -> Result<u32, JsError>
pub fn sketch_add_point( &mut self, sketch: u32, x: f64, y: f64, fixed: bool, ) -> Result<u32, JsError>
Add a point to a sketch. Returns the point index.
Sourcepub fn sketch_add_arc(
&mut self,
sketch: u32,
center_idx: u32,
start_idx: u32,
end_idx: u32,
) -> Result<u32, JsError>
pub fn sketch_add_arc( &mut self, sketch: u32, center_idx: u32, start_idx: u32, end_idx: u32, ) -> Result<u32, JsError>
Add an arc to a sketch (defined by center, start, end point indices). Returns the arc index.
Sourcepub fn sketch_add_circle(
&mut self,
sketch: u32,
center_idx: u32,
radius: f64,
) -> Result<u32, JsError>
pub fn sketch_add_circle( &mut self, sketch: u32, center_idx: u32, radius: f64, ) -> Result<u32, JsError>
Add a circle to a sketch.
center_idx must be a valid point index. Returns the circle index
(0-based) for use in circle-referencing constraints.
Sourcepub fn sketch_add_constraint(
&mut self,
sketch: u32,
json: &str,
) -> Result<(), JsError>
pub fn sketch_add_constraint( &mut self, sketch: u32, json: &str, ) -> Result<(), JsError>
Add a constraint to a sketch from a JSON string.
Supports all legacy constraint types plus arc-referencing constraints:
tangentLineArc, tangentArcArc, pointOnArc, equalRadiusArcArc,
arcLength, concentricArcArc.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn tessellate_face(
&self,
face: u32,
deflection: f64,
angular_tolerance: Option<f64>,
) -> Result<JsMesh, JsError>
pub fn tessellate_face( &self, face: u32, deflection: f64, angular_tolerance: Option<f64>, ) -> Result<JsMesh, JsError>
Tessellate a single face into a triangle mesh.
§Errors
Returns an error if the face handle is invalid or tessellation fails.
Sourcepub fn tessellate_solid(
&self,
solid: u32,
deflection: f64,
angular_tolerance: Option<f64>,
) -> Result<JsMesh, JsError>
pub fn tessellate_solid( &self, solid: u32, deflection: f64, angular_tolerance: Option<f64>, ) -> Result<JsMesh, JsError>
Tessellate all faces of a solid into a single merged triangle mesh.
Includes both the outer shell and any inner shells (voids).
§Errors
Returns an error if the solid handle is invalid or tessellation fails.
Sourcepub fn tessellate_solid_grouped(
&self,
solid: u32,
deflection: f64,
angular_tolerance: Option<f64>,
) -> Result<JsValue, JsError>
pub fn tessellate_solid_grouped( &self, solid: u32, deflection: f64, angular_tolerance: Option<f64>, ) -> Result<JsValue, JsError>
Tessellate a solid with per-face triangle grouping.
Returns a JSON string containing { positions, normals, indices, faceOffsets }.
faceOffsets is an array where faceOffsets[i] is the start index into
indices for face i, and the last element is indices.length.
Uses the watertight shared-edge-pool tessellation: adjacent faces share identical boundary vertices, so the exported mesh has no T-junctions regardless of how the solid was constructed (booleans included).
Sourcepub fn tessellate_solid_grouped_binary(
&self,
solid: u32,
deflection: f64,
angular_tolerance: Option<f64>,
) -> Result<JsGroupedMesh, JsError>
pub fn tessellate_solid_grouped_binary( &self, solid: u32, deflection: f64, angular_tolerance: Option<f64>, ) -> Result<JsGroupedMesh, JsError>
Tessellate a solid with per-face grouping, returned as packed binary
buffers (JsGroupedMesh) instead of a JSON string.
Identical geometry to tessellate_solid_grouped,
but the mesh crosses the WASM boundary as Float32Array/Uint32Array
bulk copies rather than a (potentially multi-megabyte) JSON string that
the caller must JSON.parse and re-pack — far cheaper for large meshes.
§Errors
Returns an error if the solid handle is invalid or tessellation fails.
Sourcepub fn tessellate_solid_uv(
&self,
solid: u32,
deflection: f64,
angular_tolerance: Option<f64>,
) -> Result<JsValue, JsError>
pub fn tessellate_solid_uv( &self, solid: u32, deflection: f64, angular_tolerance: Option<f64>, ) -> Result<JsValue, JsError>
Tessellate a solid and include per-vertex UV coordinates.
Returns a JSON string containing { positions, normals, indices, uvs }.
uvs is a flat array of [u0, v0, u1, v1, ...] values, two per vertex.
For analytic and NURBS surfaces, these are the parametric (u, v) values.
For planar faces, UVs are computed by projection onto the face plane.
§Errors
Returns an error if the solid handle is invalid or tessellation fails.
Sourcepub fn mesh_edges(
&self,
solid: u32,
deflection: f64,
angular_tolerance: Option<f64>,
) -> Result<JsEdgeLines, JsError>
pub fn mesh_edges( &self, solid: u32, deflection: f64, angular_tolerance: Option<f64>, ) -> Result<JsEdgeLines, JsError>
Sample edges of a solid into polylines for wireframe rendering.
Returns a JsEdgeLines containing flattened positions and per-edge
offset indices. The deflection parameter controls sampling density.
Smooth edges (between faces on the same underlying surface) are automatically filtered out to reduce wireframe clutter. These edges arise from boolean face-splitting and don’t represent visible creases.
Sourcepub fn mesh_edges_all(
&self,
solid: u32,
deflection: f64,
angular_tolerance: Option<f64>,
) -> Result<JsEdgeLines, JsError>
pub fn mesh_edges_all( &self, solid: u32, deflection: f64, angular_tolerance: Option<f64>, ) -> Result<JsEdgeLines, JsError>
Sample ALL edges of a solid (no smooth-edge filtering).
Same as meshEdges but includes edges between co-surface faces.
Useful for debugging topology.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn transform_solid_binding(
&mut self,
solid: u32,
matrix: Vec<f64>,
) -> Result<(), JsError>
pub fn transform_solid_binding( &mut self, solid: u32, matrix: Vec<f64>, ) -> Result<(), JsError>
Apply a 4×4 affine transform to a solid (in place).
The matrix must contain exactly 16 values in row-major order.
§Errors
Returns an error if the solid handle is invalid, the matrix doesn’t have 16 elements, or the matrix is singular.
Sourcepub fn compose_transforms(
&self,
matrix_a: Vec<f64>,
matrix_b: Vec<f64>,
) -> Result<Vec<f64>, JsError>
pub fn compose_transforms( &self, matrix_a: Vec<f64>, matrix_b: Vec<f64>, ) -> Result<Vec<f64>, JsError>
Compose (multiply) two 4x4 transformation matrices.
Returns the composed matrix as a flat 16-element array (row-major).
This computes a * b, meaning b is applied first, then a.
§Errors
Returns an error if either matrix doesn’t have 16 elements.
Sourcepub fn copy_solid(&mut self, solid: u32) -> Result<u32, JsError>
pub fn copy_solid(&mut self, solid: u32) -> Result<u32, JsError>
Deep copy a solid, returning a new independent solid handle.
§Errors
Returns an error if the solid handle is invalid.
Sourcepub fn copy_wire(&mut self, wire: u32) -> Result<u32, JsError>
pub fn copy_wire(&mut self, wire: u32) -> Result<u32, JsError>
Deep copy a wire, returning a new independent wire handle.
§Errors
Returns an error if the wire handle is invalid.
Sourcepub fn copy_face(&mut self, face: u32) -> Result<u32, JsError>
pub fn copy_face(&mut self, face: u32) -> Result<u32, JsError>
Deep copy a face, returning a new independent face handle.
The copy shares no sub-entities with the original, so translating it (to form a pocket or boss profile) does not mutate the donor solid.
§Errors
Returns an error if the face handle is invalid.
Sourcepub fn transform_wire(
&mut self,
wire: u32,
matrix: Vec<f64>,
) -> Result<(), JsError>
pub fn transform_wire( &mut self, wire: u32, matrix: Vec<f64>, ) -> Result<(), JsError>
Apply a 4×4 affine transform to a wire (in place).
The matrix must contain exactly 16 values in row-major order.
§Errors
Returns an error if the wire handle is invalid, the matrix doesn’t have 16 elements, or the matrix is singular.
Sourcepub fn transform_face(
&mut self,
face: u32,
matrix: Vec<f64>,
) -> Result<(), JsError>
pub fn transform_face( &mut self, face: u32, matrix: Vec<f64>, ) -> Result<(), JsError>
Apply a 4×4 affine transform to a face (in place).
Transforms all vertices, edge curves, and the face surface geometry.
The matrix must contain exactly 16 values in row-major order.
§Errors
Returns an error if the face handle is invalid, the matrix doesn’t have 16 elements, or the matrix is singular.
Sourcepub fn copy_and_transform_solid(
&mut self,
solid: u32,
matrix: Vec<f64>,
) -> Result<u32, JsError>
pub fn copy_and_transform_solid( &mut self, solid: u32, matrix: Vec<f64>, ) -> Result<u32, JsError>
Copy a solid and apply a 4×4 row-major affine transform in one pass.
Equivalent to copySolid + transformSolid but performs both in a
single topology traversal, avoiding redundant NURBS clones.
§Errors
Returns an error if the solid handle is invalid, the matrix doesn’t have 16 elements, or the matrix is singular.
Sourcepub fn mirror_solid(
&mut self,
solid: u32,
px: f64,
py: f64,
pz: f64,
nx: f64,
ny: f64,
nz: f64,
) -> Result<u32, JsError>
pub fn mirror_solid( &mut self, solid: u32, px: f64, py: f64, pz: f64, nx: f64, ny: f64, nz: f64, ) -> Result<u32, JsError>
Mirror a solid across a plane.
Returns a new solid handle.
§Errors
Returns an error if the solid handle is invalid or the normal is zero.
Sourcepub fn linear_pattern(
&mut self,
solid: u32,
dx: f64,
dy: f64,
dz: f64,
spacing: f64,
count: u32,
) -> Result<u32, JsError>
pub fn linear_pattern( &mut self, solid: u32, dx: f64, dy: f64, dz: f64, spacing: f64, count: u32, ) -> Result<u32, JsError>
Create a linear pattern of a solid.
Returns a compound handle containing all copies.
§Errors
Returns an error if inputs are invalid.
Sourcepub fn grid_pattern(
&mut self,
solid: u32,
dir_x_x: f64,
dir_x_y: f64,
dir_x_z: f64,
dir_y_x: f64,
dir_y_y: f64,
dir_y_z: f64,
spacing_x: f64,
spacing_y: f64,
count_x: u32,
count_y: u32,
) -> Result<u32, JsError>
pub fn grid_pattern( &mut self, solid: u32, dir_x_x: f64, dir_x_y: f64, dir_x_z: f64, dir_y_x: f64, dir_y_y: f64, dir_y_z: f64, spacing_x: f64, spacing_y: f64, count_x: u32, count_y: u32, ) -> Result<u32, JsError>
Create a 2D grid pattern of a solid.
Produces count_x × count_y copies arranged in a rectangular grid.
Source§impl BrepKernel
impl BrepKernel
Sourcepub fn resolve_face(&self, handle: u32) -> Result<FaceId, WasmError>
pub fn resolve_face(&self, handle: u32) -> Result<FaceId, WasmError>
Resolve a u32 face handle to a typed FaceId.
Sourcepub fn resolve_vertex(&self, handle: u32) -> Result<VertexId, WasmError>
pub fn resolve_vertex(&self, handle: u32) -> Result<VertexId, WasmError>
Resolve a u32 vertex handle to a typed VertexId.
Sourcepub fn resolve_edge(&self, handle: u32) -> Result<EdgeId, WasmError>
pub fn resolve_edge(&self, handle: u32) -> Result<EdgeId, WasmError>
Resolve a u32 edge handle to a typed EdgeId.
Sourcepub fn resolve_solid(&self, handle: u32) -> Result<SolidId, WasmError>
pub fn resolve_solid(&self, handle: u32) -> Result<SolidId, WasmError>
Resolve a u32 solid handle to a typed SolidId.
Sourcepub fn resolve_wire(&self, handle: u32) -> Result<WireId, WasmError>
pub fn resolve_wire(&self, handle: u32) -> Result<WireId, WasmError>
Resolve a u32 wire handle to a typed WireId.
Sourcepub fn resolve_shell(&self, handle: u32) -> Result<ShellId, WasmError>
pub fn resolve_shell(&self, handle: u32) -> Result<ShellId, WasmError>
Resolve a u32 shell handle to a typed ShellId.
Sourcepub fn resolve_compound(&self, handle: u32) -> Result<CompoundId, WasmError>
pub fn resolve_compound(&self, handle: u32) -> Result<CompoundId, WasmError>
Resolve a u32 compound handle to a typed CompoundId.
Source§impl BrepKernel
impl BrepKernel
Trait Implementations§
Source§impl Default for BrepKernel
impl Default for BrepKernel
Source§impl From<BrepKernel> for JsValue
impl From<BrepKernel> for JsValue
Source§fn from(value: BrepKernel) -> Self
fn from(value: BrepKernel) -> Self
Source§impl FromWasmAbi for BrepKernel
impl FromWasmAbi for BrepKernel
Source§impl IntoWasmAbi for BrepKernel
impl IntoWasmAbi for BrepKernel
Source§impl LongRefFromWasmAbi for BrepKernel
impl LongRefFromWasmAbi for BrepKernel
Source§type Abi = WasmPtr<WasmRefCell<BrepKernel>>
type Abi = WasmPtr<WasmRefCell<BrepKernel>>
RefFromWasmAbi::AbiSource§type Anchor = RcRef<BrepKernel>
type Anchor = RcRef<BrepKernel>
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiSource§impl OptionFromWasmAbi for BrepKernel
impl OptionFromWasmAbi for BrepKernel
Source§impl OptionIntoWasmAbi for BrepKernel
impl OptionIntoWasmAbi for BrepKernel
Source§impl RefFromWasmAbi for BrepKernel
impl RefFromWasmAbi for BrepKernel
Source§type Abi = WasmPtr<WasmRefCell<BrepKernel>>
type Abi = WasmPtr<WasmRefCell<BrepKernel>>
Self are recovered from.Source§type Anchor = RcRef<BrepKernel>
type Anchor = RcRef<BrepKernel>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for BrepKernel
impl RefMutFromWasmAbi for BrepKernel
Source§type Abi = WasmPtr<WasmRefCell<BrepKernel>>
type Abi = WasmPtr<WasmRefCell<BrepKernel>>
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<BrepKernel>
type Anchor = RcRefMut<BrepKernel>
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiimpl SupportsConstructor for BrepKernel
impl SupportsInstanceProperty for BrepKernel
impl SupportsStaticProperty for BrepKernel
Source§impl TryFromJsValue for BrepKernel
impl TryFromJsValue for BrepKernel
Source§impl VectorFromWasmAbi for BrepKernel
impl VectorFromWasmAbi for BrepKernel
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[BrepKernel]>
Source§impl VectorIntoWasmAbi for BrepKernel
impl VectorIntoWasmAbi for BrepKernel
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[BrepKernel]>) -> Self::Abi
Source§impl WasmDescribeVector for BrepKernel
impl WasmDescribeVector for BrepKernel
Auto Trait Implementations§
impl !Send for BrepKernel
impl !Sync for BrepKernel
impl Freeze for BrepKernel
impl RefUnwindSafe for BrepKernel
impl Unpin for BrepKernel
impl UnsafeUnpin for BrepKernel
impl UnwindSafe for BrepKernel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.