Module plan

Module plan 

Source
Expand description

The export-plan executor: callers speak IFC (objects by express id or GlobalId, properties by measure type, placements by matrix), and execute is the one place that lowers a plan into the STEP-level primitives the rest of this crate already carries (AttrMutation-shaped edits, CopyOnWriteMutation’s copy-then-repoint shape, [crate::step_cow]’s id allocator role) plus the parts no STEP option expresses: occurrence overrides, placement rewrites, body geometry replacement, and delete with reverse-reference repair. Disposition::Add builds a new object (placement, geometry, containment, type, property sets, material, classifications, an opening in a host) from an IFC-level description; see add.rs. Disposition::AddType adds a type nothing instances yet.

§Design

Memory follows the plan, not the file. [index::FileIndex::scan] makes one pass that keeps where each record is and little else; attributes are parsed on demand, only for records the plan reaches; who refers to a record is collected by [referrers] only for the records a plan asks about, in streaming passes over the file that repeat until [resolve::resolve] completes without asking about anything new ([referrers] explains how many passes that takes, and why). [write::write_output] then streams the output in file order, validating each record as it goes. A single [crate::step_ids::IdAllocator], the one every STEP writer in this crate allocates with, is threaded through every appender so a plan’s copy-on-write, an occurrence override, and a synthesized owner history can never land on the same id.

§What this does not do

  • It does not convert between IFC2X3/IFC4/IFC4X3 — crate::schema_convert already does that, as a separate concern a caller composes with this one.
  • A property or quantity write never edits a shared record in place. Sharing is judged at the set (how many relationships or types reach it) and at the value (how many sets list it); either one shared means a copy, or a refusal for a set shared between types.

Structs§

ClassSpec
A class plus the enumeration value for its PredefinedType, e.g. Some("PARTITIONING") for a wall. The value is written as given (upper-cased); a class whose schema declares no PredefinedType (IFC2X3’s IfcDoor, for one) refuses a Some rather than dropping it.
DroppedRepresentation
A representation a GeometryPatch took off a product that was not its body: an Axis, Box, FootPrint or other representation of the old shape, which no longer describes the product once its body is replaced.
ExportPlan
The whole request: what happens to which objects, and the header provenance to stamp the output with.
ExportingApplication
Who an export attributes its changes to, per the buildingSMART IfcChangeActionEnum guidance: an object the exporting application adds is ADDED with that application as its OwningApplication; an object it modifies keeps its original owner and creation date, and gets MODIFIED, a LastModifiedDate, and the exporting user and application as LastModifyingUser and LastModifyingApplication.
ExportingPerson
The person on whose behalf the exporting application makes its changes.
Extrusion
A closed polygon profile swept along direction for depth. The profile lies in the object’s local XY plane; repeating the first point of a loop at the end is allowed but not required.
GeometryPatch
Replace a product’s body geometry with mesh.
GlobalId
The 128 bits of an IfcGloballyUniqueId, supplied by the caller so the executor never has to invent an identity (no clock, no RNG: the output of a plan is a pure function of the plan and the source).
MapConversion
An IfcMapConversion to an IfcProjectedCRS: how the project’s engineering frame (metres) maps to map coordinates.
MappedBody
How an object places its type’s mapped representation: transform (row-major, file length units) takes the map’s coordinates into the object’s local frame. A rotation and a translation, no scale. Identity puts the type’s geometry at the object’s placement, which is where most files keep it.
NewClassification
A new IfcClassification. IFC2X3 requires source and edition, and refuses a classification without them.
NewClassificationReference
A new IfcClassificationReference into system. identification is written as IFC2X3’s ItemReference.
NewLayerSet
A new IfcMaterialLayerSet, layers in the order given.
NewMaterial
A new IfcMaterial. category is IFC4 and later only; an IFC2X3 file refuses it rather than dropping it.
NewMaterialLayer
One layer of a new IfcMaterialLayerSet. thickness is in the file’s length unit.
NewObject
Everything super::Disposition::Add builds.
NewOpening
An IfcOpeningElement cut into host, placed at matrix (row-major, file length units) in the NEW object’s local frame, so the profile describes the hole where the object will sit. When the new object is a door or window, it also fills the opening. A shape with voids cuts a ring, leaving the host’s material inside each void.
NewPlacement
Where a new object sits: matrix (row-major, file length units) is its transform relative to relative_to.
NewProperty
NewPropertySet
A property set (kind: Property) or quantity set (kind: Quantity, every value a PropertyValue::Measure with a quantity entity) to attach. Properties are written in the order given.
NewType
A type object created alongside the occurrence. Types carry no placement and no container; their sets are attached through HasPropertySets.
Patch
The edits Disposition::Patch carries. Any field left at its default (None, empty Vec) makes no change for that concern.
PlacementPatch
Rewrite a product’s placement to matrix (row-major, file units, relative to whatever the existing IfcLocalPlacement.PlacementRelTo already names — this carries no opinion about the parent, only the local transform).
PlanContext
Header provenance the caller supplies. There is no clock fallback: now() is unavailable on the wasm32-unknown-unknown target this crate ships to.
PropWrite
One typed property/quantity write: attach or overwrite prop in pset.
Refusal
A disposition the executor could not carry out, and why. Every refusal here is an edit the plan asked for that is NOT in the output.
Removal
One record the plan removed, and why.
Skeleton
What skeleton writes.
SkeletonRoot
One spatial root: its GlobalId and optional name.
SurfaceColour
A surface colour for body geometry. Components are 0..1.
TriangleMesh
A triangle mesh. Indices are 0-based into positions.
ValidationFinding
One thing the post-write validator found wrong with the file it just produced.
WriteReport
What super::execute did, and what it could not.

Enums§

ClassificationLink
One classification a new object is associated with through IfcRelAssociatesClassification.
ClassificationSystem
Disposition
What one object should become in the output.
IfcClass
The IFC class of a new object. The listed classes are the ones common enough to name; anything else goes through IfcClass::Named, which is checked against the source schema (declared, not abstract, and of the right kind: an IfcProduct for an object, an IfcTypeObject for a type).
LayerMaterial
A material for one layer of a new layer set.
MapUnit
The length unit of a projected CRS’s map coordinates.
MaterialLink
The material a new object is associated with through IfcRelAssociatesMaterial.
ObjectRef
One object in the source file, named the way a caller has it: by express id when it already ran a query that produced one, by GlobalId when it does not track express ids across a load.
PlanError
Failure modes of super::execute itself, as opposed to a single disposition being refused (which is reported, not erred).
PropScope
Whether a property write targets the occurrence’s own set or the type’s.
PropertyValue
A property value, typed the way IFC types it.
PsetKind
A property or quantity, distinguished because they synthesize different entities (IfcPropertySingleValue under IfcPropertySet vs. an IfcQuantityLength-family entity under IfcElementQuantity).
RemovalReason
Why a record is not in the output. When the cascade reaches a removed record again for another reason, the earlier one in this order is kept.
Representation
TypeLink
New is much larger than Existing; a plan holds one per Add, so the space is not worth an indirection in the public shape.
ValueUnit
The unit a property or quantity value is measured in, when it is not the project’s unit for that measure.

Constants§

IDENTITY
The identity 4x4, row-major: no rotation, no translation.
SKELETON_SCHEMA
The schema a skeleton is written in.

Functions§

execute
Execute plan against source, writing the result to out.
skeleton
The skeleton’s bytes. A header that doesn’t follow buildingSMART’s agreement is not reported here; skeleton_with_findings reports it.
skeleton_with_findings
skeleton, reporting rather than refusing an application it cannot attribute the skeleton to: the skeleton is then written unattributed, and a finding says why. A header that doesn’t follow buildingSMART’s agreement is a finding too.