pub struct StepBuilder { /* private fields */ }Expand description
Implementations§
Source§impl StepBuilder
impl StepBuilder
Sourcepub fn new() -> Result<Self, AuthorError>
pub fn new() -> Result<Self, AuthorError>
Set up the shared skeleton with the default units (millimetre,
1e-7 uncertainty) — see new_with to choose.
§Errors
Propagates AuthorError from the strict constructors; the wiring
here is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn new_with(units: &UnitsInput) -> Result<Self, AuthorError>
pub fn new_with(units: &UnitsInput) -> Result<Self, AuthorError>
Set up the shared skeleton: application context + protocol definition
(values are stamped with the AP242 profile on finish), product
contexts, and the geometric context complex carrying the chosen SI
length unit, radian, steradian, and the given length uncertainty.
§Errors
Propagates AuthorError from the strict constructors; the wiring
here is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn header(&mut self, h: &HeaderInput)
pub fn header(&mut self, h: &HeaderInput)
Set the Part 21 HEADER fields (file name, description, authors,
organizations, originating system, authorisation, timestamp) applied
on finish. May be called any time before finish;
the last call wins. Without it the header carries only the automatic
timestamp and preprocessor stamp.
Escape hatch to the strict low-level layer — the write-side
counterpart of the read side’s Scene::model(). Entities the builder
does not cover go through Ap242Author’s generated constructors
directly; ids cross freely in both directions (builder-produced ids
feed low-level calls and vice versa — same model, same validation).
Only borrowed access is offered: taking the author out would bypass
finish, which still has to materialize the pending
shape representations, placements, style anchors, category, and
header.
Sourcepub fn style(
&mut self,
target: StyleTarget,
color: Rgb,
transparency: Option<f64>,
) -> Result<StyledItemId, AuthorError>
pub fn style( &mut self, target: StyleTarget, color: Rgb, transparency: Option<f64>, ) -> Result<StyledItemId, AuthorError>
Colour target (a solid or one face), optionally with a transparency
(0.0 = opaque, 1.0 = fully transparent). Styling the same target
again adds another style record; readers use the first they find.
§Errors
An id that did not come from this builder (another builder’s, or out
of range) fails validation with AuthorError; beyond that the
wiring is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn layer(
&mut self,
name: &str,
targets: Vec<StyleTarget>,
) -> Result<PresentationLayerAssignmentId, AuthorError>
pub fn layer( &mut self, name: &str, targets: Vec<StyleTarget>, ) -> Result<PresentationLayerAssignmentId, AuthorError>
Assign targets to a named presentation layer; the returned id can
be fed to hide_layer to switch the whole layer
off by default.
§Errors
An id that did not come from this builder (another builder’s, or out
of range) fails validation with AuthorError; beyond that the
wiring is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn hide(&mut self, target: StyleTarget) -> Result<(), AuthorError>
pub fn hide(&mut self, target: StyleTarget) -> Result<(), AuthorError>
Mark target invisible by default. Implemented the way STEP requires
it: an INVISIBILITY cannot point at geometry directly, so the
builder attaches an empty (.NULL.-styled) styled item to the target
and registers that — colour styles on the same target are unaffected.
§Errors
An id that did not come from this builder (another builder’s, or out
of range) fails validation with AuthorError; beyond that the
wiring is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn hide_layer(&mut self, layer: PresentationLayerAssignmentId)
pub fn hide_layer(&mut self, layer: PresentationLayerAssignmentId)
Sourcepub fn vertex(&mut self, p: [f64; 3]) -> Result<Vertex, AuthorError>
pub fn vertex(&mut self, p: [f64; 3]) -> Result<Vertex, AuthorError>
Add a topological vertex at p.
§Errors
Propagates AuthorError from the strict constructors; the wiring
here is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn edge(
&mut self,
from: Vertex,
to: Vertex,
curve: CurveInput,
) -> Result<EdgeCurveId, AuthorError>
pub fn edge( &mut self, from: Vertex, to: Vertex, curve: CurveInput, ) -> Result<EdgeCurveId, AuthorError>
Add an edge between two vertices over the given curve. A straight
edge derives its line from the vertex positions (a zero-length
segment gets a placeholder direction — degenerate geometry is the
caller’s responsibility); a circle with from == to is a closed
full-circle edge.
§Errors
Propagates AuthorError from the strict constructors; the wiring
here is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn face(
&mut self,
surface: SurfaceInput,
same_sense: bool,
bounds: Vec<FaceBoundInput>,
) -> Result<AdvancedFaceId, AuthorError>
pub fn face( &mut self, surface: SurfaceInput, same_sense: bool, bounds: Vec<FaceBoundInput>, ) -> Result<AdvancedFaceId, AuthorError>
Add a face over an analytic surface, bounded by the given loops.
§Errors
An id that did not come from this builder (another builder’s, or out
of range) fails validation with AuthorError; beyond that the
wiring is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn solid(
&mut self,
part: Part,
name: &str,
faces: Vec<AdvancedFaceId>,
) -> Result<ManifoldSolidBrepId, AuthorError>
pub fn solid( &mut self, part: Part, name: &str, faces: Vec<AdvancedFaceId>, ) -> Result<ManifoldSolidBrepId, AuthorError>
Close the faces into a shell and add the solid to part; the solid
lands in the part’s shape representation on finish
(as an ADVANCED_BREP_SHAPE_REPRESENTATION).
§Errors
An id that did not come from this builder (another builder’s, or out
of range) fails validation with AuthorError; beyond that the
wiring is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn part(&mut self, name: &str) -> Result<Part, AuthorError>
pub fn part(&mut self, name: &str) -> Result<Part, AuthorError>
Add one part: the full product chain (product → formation →
definition → definition shape) plus its origin placement. Shape items
collected for the part are bound into its shape representation by
finish.
§Errors
Propagates AuthorError from the strict constructors; the wiring
here is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn part_with(
&mut self,
name: &str,
opts: &PartOptions,
) -> Result<Part, AuthorError>
pub fn part_with( &mut self, name: &str, opts: &PartOptions, ) -> Result<Part, AuthorError>
part with metadata overrides: part number, version
label, and the description fields.
§Errors
Propagates AuthorError from the strict constructors; the wiring
here is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn mesh(
&mut self,
part: Part,
name: &str,
input: &MeshInput,
of_solid: Option<ManifoldSolidBrepId>,
) -> Result<TessellatedSolidId, AuthorError>
pub fn mesh( &mut self, part: Part, name: &str, input: &MeshInput, of_solid: Option<ManifoldSolidBrepId>, ) -> Result<TessellatedSolidId, AuthorError>
Attach a display mesh to part, optionally linked to the b-rep solid
it tessellates (the link is what MeshGroup::solid() resolves on the
read side). Triangle indices are 0-based into points; the builder
converts to STEP’s 1-based strip encoding. The mesh lands in its own
TESSELLATED_SHAPE_REPRESENTATION on finish.
§Errors
An id that did not come from this builder (another builder’s, or out
of range) fails validation with AuthorError; beyond that the
wiring is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn person_and_org(
&mut self,
p: &PersonOrg,
) -> Result<PersonAndOrganizationId, AuthorError>
pub fn person_and_org( &mut self, p: &PersonOrg, ) -> Result<PersonAndOrganizationId, AuthorError>
A person at an organization — reusable across
contributor and approver roles.
§Errors
Propagates AuthorError from the strict constructors; the wiring
here is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn contributor(
&mut self,
part: Part,
role: &str,
who: PersonAndOrganizationId,
) -> Result<(), AuthorError>
pub fn contributor( &mut self, part: Part, role: &str, who: PersonAndOrganizationId, ) -> Result<(), AuthorError>
Record who as a contributor to the part’s version under the given
role (customary roles: "creator", "design_owner", "checker").
§Errors
An id that did not come from this builder (another builder’s, or out
of range) fails validation with AuthorError; beyond that the
wiring is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn approve(
&mut self,
part: Part,
input: &ApprovalInput,
) -> Result<ApprovalId, AuthorError>
pub fn approve( &mut self, part: Part, input: &ApprovalInput, ) -> Result<ApprovalId, AuthorError>
Attach an approval to the part’s version: a status word, a level, any approvers with their roles, and an optional approval date.
§Errors
An id that did not come from this builder (another builder’s, or out
of range) fails validation with AuthorError; beyond that the
wiring is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn document(
&mut self,
part: Part,
d: &DocumentInput,
) -> Result<(), AuthorError>
pub fn document( &mut self, part: Part, d: &DocumentInput, ) -> Result<(), AuthorError>
Attach an external document reference to the part’s version.
§Errors
Propagates AuthorError from the strict constructors; the wiring
here is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn security(
&mut self,
part: Part,
name: &str,
purpose: &str,
level: &str,
) -> Result<(), AuthorError>
pub fn security( &mut self, part: Part, name: &str, purpose: &str, level: &str, ) -> Result<(), AuthorError>
Attach a security classification to the part’s version.
§Errors
Propagates AuthorError from the strict constructors; the wiring
here is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn place(
&mut self,
parent: Part,
child: Part,
at: Frame,
) -> Result<NextAssemblyUsageOccurrenceId, AuthorError>
pub fn place( &mut self, parent: Part, child: Part, at: Frame, ) -> Result<NextAssemblyUsageOccurrenceId, AuthorError>
Place child inside parent at the given frame — one assembly
occurrence (the same child may be placed any number of times; each
call is one instance). The usage occurrence is created immediately;
its shape wiring is bound in finish.
§Errors
Propagates AuthorError from the strict constructors; the wiring
here is fixed, so an error indicates a bug in the builder itself.
Sourcepub fn finish(self) -> Result<String, AuthorError>
pub fn finish(self) -> Result<String, AuthorError>
Materialize each part’s shape representation (its origin placement plus the collected items) with its shape-definition link, add the customary product category, and emit the Part 21 text.
§Errors
Propagates AuthorError from the strict constructors; the wiring
here is fixed, so an error indicates a bug in the builder itself.