Skip to main content

IfcModel

Struct IfcModel 

Source
pub struct IfcModel { /* private fields */ }
Expand description

An IFC model: entities keyed by their #id, in file order.

Implementations§

Source§

impl IfcModel

Source

pub fn attribute_names( &self, id: u64, ) -> Result<Vec<AttributeInfo>, BindingError>

Every explicit attribute of entity id in slot order, inherited first, resolved against the declared release.

Source

pub fn attribute_by_name( &self, id: u64, name: &str, ) -> Result<Tagged, BindingError>

Attribute name (any case) of entity id; null when the record stops before its slot, as for Self::attribute. An INVERSE name reads the entities referencing id through it (crate::inverse): a list of refs for a SET or BAG, a ref or null for a single-valued one.

Source

pub fn set_attribute_by_name( &mut self, id: u64, name: &str, value: Tagged, ) -> Result<Tagged, BindingError>

Set attribute name (any case) of entity id, returning the previous value. The value is checked as for Self::set_attribute; every check runs before the write, so a refusal changes nothing.

Source§

impl IfcModel

Source

pub fn copy_product( &mut self, id: u64, options: CopyProductOptions, ) -> Result<CopyReport, BindingError>

Copy product (or type object) id with everything it solely owns, as one checked transaction: its placement (moved or replaced by option), representation, own property sets, material usage, ports and, by option, openings and fillings; joining its type, shared property sets, classification and, by option, container and whole. With options.dry_run, only report. See the module docs for the refusals.

Source

pub fn copy_product_seeded( &mut self, id: u64, options: CopyProductOptions, seed: u128, ) -> Result<CopyReport, BindingError>

Self::copy_product with the seed the copy’s new GlobalIds derive from: a host with entropy of its own (the browser) passes it. The seed names the batch; reusing it on a model that holds its GlobalIds is refused (invalid-value).

Source

pub fn append( &mut self, source: &IfcModel, roots: &[u64], options: &AppendOptions, ) -> Result<CopyReport, BindingError>

Copy roots of source into this model with what belongs to them, as one checked transaction: what they reference, their property sets, type, material and classification, openings, fillings and ports; units, contexts, owner history, materials and styles equal to this model’s are reused. Relationships to objects not copied are skipped and reported. With options.dry_run, only report. See the module docs for the refusals.

Source

pub fn append_seeded( &mut self, source: &IfcModel, roots: &[u64], options: &AppendOptions, seed: u128, ) -> Result<CopyReport, BindingError>

Self::append with the seed new GlobalIds derive from: a host with entropy of its own (the browser) passes it. The seed names the batch; reusing it on a model that holds its GlobalIds is refused (invalid-value).

Source§

impl IfcModel

Source

pub fn remove_product( &mut self, id: u64, options: RemoveProductOptions, ) -> Result<RemovalReport, BindingError>

Remove product (or type object) id with everything it solely owns, keeping what is shared, as one checked transaction; with options.dry_run, only report. See the module docs for the refusals.

Source

pub fn purge( &mut self, options: PurgeOptions, ) -> Result<RemovalReport, BindingError>

Purge unreferenced entities as one checked transaction; with options.dry_run, only report. See the module docs.

Source

pub fn remove_representation( &mut self, id: u64, dry_run: bool, ) -> Result<RemovalReport, BindingError>

Remove shape representation id with what only it uses (#481): taken off its product definition shape (which goes when left empty), representation map or shape aspects first, then removed by the cascade of Self::remove_product. With dry_run, only report. still-referenced for a representation map an IfcMappedItem still maps; wrong-entity-type for an entity that is not an IfcShapeModel.

Source§

impl IfcModel

Source

pub fn author( &mut self, ops: Vec<AuthorOp>, ) -> Result<AuthoringResult, BindingError>

Apply ops as one checked transaction, with GlobalIds drawn from a fresh seed. See the module docs for the refusals.

Source

pub fn author_seeded( &mut self, ops: Vec<AuthorOp>, seed: u128, ) -> Result<AuthoringResult, BindingError>

Self::author with the seed new GlobalIds derive from: a host with entropy of its own (the browser) passes it. The seed names the batch: a fixed seed reproduces its GlobalIds, also after a write/read cycle; reusing it for another batch on the same model may be refused (invalid-value).

Source

pub fn create_entity( &mut self, type_name: &str, attributes: Vec<(String, Tagged)>, ) -> Result<u64, BindingError>

Create one entity of type_name from named attributes: a batch of one create. Returns its id.

Source

pub fn remove_with_relationships(&mut self, id: u64) -> Result<(), BindingError>

Remove entity id with its relationships: a batch of one remove. Unlike Self::remove, it leaves nothing dangling, and is refused with still-referenced while an entity that is not a relationship needs id.

Source§

impl IfcModel

Source

pub fn classifications( &self, object: u64, ) -> Result<Vec<Classification>, BindingError>

The classifications that apply to object: its own associations, then its type object’s, in relationship id order.

Refused with missing-entity for an id not in the model, unsupported-schema for a release other than IFC2X3, IFC4 or IFC4X3, invalid-model for malformed or ambiguous associations, missing-reference for a dangling one, budget-exceeded for a reference chain that cycles or runs deeper than 64, and feature-disabled without the classification feature.

Source§

impl IfcModel

Source

pub fn coerce_attribute( &self, id: u64, name: &str, value: Plain, ) -> Result<Tagged, BindingError>

The tagged value Self::set_attribute_by_name_plain would write for value into attribute name (any case) of entity id, without writing it.

Refused as Self::attribute_by_name is, with derived-attribute for a derived slot, and by the rules of the module.

Source

pub fn set_attribute_by_name_plain( &mut self, id: u64, name: &str, value: Plain, ) -> Result<Tagged, BindingError>

Set attribute name (any case) of entity id from a plain host value, coerced against its declared type (see the module); returns the previous value. Every check runs before the write, so a refusal changes nothing.

Source§

impl IfcModel

Source

pub fn cost(&self) -> Result<Cost, BindingError>

Every cost schedule and cost item.

Refused with unsupported-schema for a release other than IFC2X3, IFC4 or IFC4X3, missing-reference for a cost value or component the file does not contain, budget-exceeded for a component tree that cycles or nests deeper than 64, and feature-disabled without the cost feature.

Source§

impl IfcModel

Source

pub fn product_curves( &self, products: Option<&[u64]>, representation: &str, ) -> Result<Vec<ProductCurves>, BindingError>

The curves of each of products’ representation as polylines (#458), or, with None, of every product that has a shape, in id order. representation is Plan by default in the hosts (the best drawing curves), or Axis, FootPrint, Annotation, Body, Surface, Reference. Chord budget: one millimetre.

Refused as a whole as Self::product_meshes is: unsupported-schema, feature-disabled without the mesh feature, and invalid-value for a representation name it does not know.

Source§

impl IfcModel

Source

pub fn product_geometry( &self, products: Option<&[u64]>, encoding: GeometryEncoding, ) -> Result<Vec<ProductGeometry>, BindingError>

The Body of each of products, or, with None, of every product that has a shape, in id order, as Axiolid’s geometry graph encoded as encoding (GEOMETRY_FORMAT GEOMETRY_FORMAT_VERSION).

A product whose placement, lowering or encoding is refused is a record with a typed refusal. Refused as a whole only as Self::product_placements is, and with feature-disabled without the graph feature.

Source§

impl IfcModel

Source

pub fn product_placements( &self, products: Option<&[u64]>, ) -> Result<Vec<ProductPlacement>, BindingError>

The world placement and selected Body of each of products, or, with None, of every product that has a shape, in id order.

An id the model lacks is a record refused with missing-reference. Refused as a whole only with unsupported-schema (the header names a release this build does not bundle, as for the domain views) and feature-disabled without the placements feature.

Source

pub fn product_meshes( &self, products: Option<&[u64]>, ) -> Result<Vec<ProductMesh>, BindingError>

The Body mesh of each of products, or, with None, of every product that has a shape, in id order. Tolerance: one millimetre.

Refused as a whole only as Self::product_placements is, and with feature-disabled without the mesh feature.

Source

pub fn product_meshes_for( &self, products: Option<&[u64]>, representation: &str, ) -> Result<Vec<ProductMesh>, BindingError>

The surfaces and solids of each product’s representation as one mesh (#458): Body as Self::product_meshes, or another name the module docs list, such as Surface. Curves are not meshed: Self::product_curves returns them. A product without that representation, or with curves only, has an empty mesh and no refusal. Only a Body mesh carries a colour.

Refused as a whole as Self::product_meshes is, and with invalid-value for a representation name it does not know.

Source§

impl IfcModel

Source

pub fn georeferencing(&self) -> Result<Vec<MapConversion>, BindingError>

Every coordinate operation, resolved, in file order.

Refused with unsupported-schema for a release other than IFC2X3, IFC4 or IFC4X3, unsupported for an operation with no project-to-map form, invalid-model for a malformed operation, an incomplete, ambiguous or malformed IFC2X3 property set, or a malformed project length unit, missing-reference for a dangling one, and feature-disabled without the georef feature.

Source§

impl IfcModel

Source

pub fn header(&self) -> Header

The file header: description, name, time stamp, author, organization, preprocessor, originating system, authorization and the schema tokens, as written.

Source

pub fn set_header(&mut self, header: Header)

Replace the file header. Every field is written back as given; the schema tokens decide which tables subtype queries and validation use.

Source§

impl IfcModel

Source

pub fn set_history_limit(&mut self, limit: usize)

Bound the undo entries kept; 0 turns history off and drops what is held. Lowering the limit drops the oldest entries.

Source

pub fn history(&self) -> HistoryState

The history bound and how many entries each direction holds.

Source

pub fn peek_undo(&self) -> Result<HistoryChange, BindingError>

What Self::undo would change, without changing anything.

Refused with history-empty when there is nothing to undo and history-stale when the model changed outside the history.

Source

pub fn peek_redo(&self) -> Result<HistoryChange, BindingError>

What Self::redo would change, without changing anything.

Source

pub fn undo(&mut self) -> Result<HistoryChange, BindingError>

Restore the model to the state before the last recorded change. A refusal changes nothing.

Source

pub fn redo(&mut self) -> Result<HistoryChange, BindingError>

Reverse the last Self::undo. A refusal changes nothing.

Source

pub fn clear_history(&mut self)

Drop every undo and redo entry, keeping the limit.

Source§

impl IfcModel

Source

pub fn write_ifczip( &self, inner: Option<&str>, xsd_profile: Option<&str>, ) -> Result<Vec<u8>, BindingError>

Serialize as an ifcZIP archive: one Deflate entry holding STEP (inner None or "step", as model.ifc) or ifcXML ("ifcxml", as model.ifcXML, in the layout xsd_profile names as for Self::write_ifcxml). Any case.

Refused with invalid-value for another inner, or an xsd_profile with STEP inside; otherwise as the inner write, and with feature-disabled without the zip feature.

Source§

impl IfcModel

Source

pub fn inverse_attribute_names( &self, id: u64, ) -> Result<Vec<InverseAttributeInfo>, BindingError>

Every INVERSE attribute of entity id, inherited ones first, resolved against the declared release.

Source

pub fn inverse_references( &self, id: u64, ) -> Result<Vec<InverseReference>, BindingError>

Every reference to entity id, in ascending (id, index) order: one per referencing entity and attribute, whatever the attribute (IfcOpenShell’s get_inverse(.., with_attribute_indices=True)). Needs no schema.

Source

pub fn total_inverses(&self, id: u64) -> Result<usize, BindingError>

How many distinct entities reference entity id, through any attribute (IfcOpenShell’s get_total_inverses). Needs no schema.

Source§

impl IfcModel

Source

pub fn material( &self, object: u64, ) -> Result<Option<MaterialAssignment>, BindingError>

The material association that applies to object, or None when neither it nor its type object has one.

Refused with missing-entity for an id not in the model, unsupported-schema for a release other than IFC2X3, IFC4 or IFC4X3, invalid-model when two associations (or two types) compete, missing-reference for a dangling one, and feature-disabled without the material feature.

Source§

impl IfcModel

Source

pub fn empty() -> Self

An empty model.

Source

pub fn parse(bytes: &[u8]) -> Result<Self, BindingError>

Parse a STEP (.ifc) file, or an ifcZIP archive holding STEP or ifcXML, recognized by its ZIP signature (feature zip, see crate::ifczip).

Non-fatal problems do not fail the parse; they are reported by Self::diagnostics, so a caller can tell a complete read from a partial one.

A strict read keeps the file as the model’s source and decodes each entity on first access, so bytes is copied once; Self::parse_owned hands a buffer over instead.

Source

pub fn parse_with( bytes: &[u8], options: ParseOptions, ) -> Result<Self, BindingError>

Self::parse under explicit ParseOptions: a lenient read skips malformed records and reports each one in Self::diagnostics instead of failing.

Source

pub fn parse_owned(bytes: Vec<u8>) -> Result<Self, BindingError>

Self::parse from a buffer the model keeps, without copying it.

Source

pub fn parse_owned_with( bytes: Vec<u8>, options: ParseOptions, ) -> Result<Self, BindingError>

Source

pub fn open(path: &Path) -> Result<Self, BindingError>

Read a STEP file, or an ifcZIP archive (as Self::parse), from disk into a buffer the model owns.

Cheaper than reading the file in the host and passing its bytes: the file is read once, straight into the model’s source.

Source

pub fn open_with( path: &Path, options: ParseOptions, ) -> Result<Self, BindingError>

Self::open under explicit ParseOptions.

Source

pub unsafe fn open_mapped(path: &Path) -> Result<Self, BindingError>

Read a memory-mapped STEP file: no copy, and the pages belong to the page cache rather than the process heap.

An ifcZIP archive is read as Self::open reads it: its model is inflated into the heap, and nothing stays mapped.

§Safety

The file must not be modified or truncated while the model is alive: the model decodes entities from the mapping on access, and a changed file makes that panic, end the process (SIGBUS on truncation), or read other content. See ifc_step::StepReader::read_path_mapped.

Source

pub unsafe fn open_mapped_with( path: &Path, options: ParseOptions, ) -> Result<Self, BindingError>

Source

pub fn write(&self) -> Result<Vec<u8>, BindingError>

Serialize as STEP.

Source

pub fn len(&self) -> usize

Number of entities.

Source

pub fn is_empty(&self) -> bool

Whether the model has no entities.

Source

pub fn schema(&self) -> Option<&str>

The first FILE_SCHEMA token, e.g. IFC4, if any.

Source

pub fn diagnostics(&self) -> Vec<String>

Every non-fatal problem found while reading, as display strings.

Source

pub fn ids(&self) -> Vec<u64>

Every entity id, in file order.

Source

pub fn ids_of_type(&self, type_name: &str) -> Vec<u64>

Ids of every entity of exactly type_name (case-insensitive), in file order. Subtypes are not included.

Source

pub fn ids_of_type_including_subtypes( &self, type_name: &str, ) -> Result<Vec<u64>, BindingError>

Ids of every entity of type_name or any of its subtypes, in file order, using the schema the file’s header declares.

IfcWall then finds IFCWALLSTANDARDCASE too, which exact Self::ids_of_type does not. An undeclared name finds nothing. Fails when the header names no schema this crate bundles.

Source

pub fn type_of(&self, id: u64) -> Result<&str, BindingError>

The type name of entity id, upper-case.

Source

pub fn attributes(&self, id: u64) -> Result<Vec<Tagged>, BindingError>

Every attribute of entity id, in declaration order.

Source

pub fn attribute(&self, id: u64, index: usize) -> Result<Tagged, BindingError>

Attribute index of entity id; null past the last attribute, the same as an unset $.

Source

pub fn set_attribute( &mut self, id: u64, index: usize, value: Tagged, ) -> Result<Tagged, BindingError>

Set attribute index of entity id, returning the previous value.

Writing past the end pads the gap with $, as the model does.

Source

pub fn add( &mut self, type_name: &str, attributes: Vec<Tagged>, ) -> Result<u64, BindingError>

Append a new entity, returning its id.

Source

pub fn remove(&mut self, id: u64) -> Result<(), BindingError>

Remove entity id. References to it are left dangling, as in the model; find them with Self::dangling_references.

Deprecated in every host (#478): a file with dangling references parses and is wrong. Use Self::remove_with_relationships for one entity, or Self::remove_product for a product with what it solely owns. It keeps working.

Source

pub fn dangling_references(&self) -> Vec<(u64, u64)>

Every (from, to) pair where from references a missing to.

Source§

impl IfcModel

Source

pub fn property_sets( &self, object: u64, ) -> Result<Vec<PropertySet>, BindingError>

Every property set, quantity set and predefined property set that applies to object, with their properties, resolved exactly.

Occurrence sets come first, then the sets inherited from the object’s type, each in assignment order. object may be a type object, which reads its own HasPropertySets. Refused with missing-entity for an id not in the model, wrong-entity-type for an entity that carries no property sets, unsupported-schema for a release other than IFC2X3, IFC4 or IFC4X3, invalid-model when the file’s sets are malformed or ambiguous, and feature-disabled without the properties feature.

Source

pub fn property_sets_many( &self, objects: Option<&[u64]>, ) -> Result<Vec<ObjectPropertySets>, BindingError>

Self::property_sets of each of objects, in the order given, or, with None, of every object definition (IfcObjectDefinition and its subtypes: objects and type objects) in file order, resolved through one property index in time linear in objects plus relationships (#358).

Each record holds exactly what the per-object call answers: its sets, or its refusal (missing-entity, wrong-entity-type, invalid-model, …) as code and message. Refused as a whole only when the model is: unsupported-schema for a release other than IFC2X3, IFC4 or IFC4X3, invalid-model for a lenient read with skipped records, and feature-disabled without the properties feature.

Source

pub fn resolve_unit( &self, measure_type: &str, unit: Option<u64>, ) -> Result<ResolvedUnit, BindingError>

The effective unit of a value of measure_type (IFCAREAMEASURE): unit when given (a property’s stated unit), otherwise the project default for that measure, resolved exactly to SI.

Refused with invalid-value for a type that is no measure, unsupported for a measure with no verified SI correspondence (a monetary one) or an offset unit, invalid-model for a missing, duplicated or malformed unit, and feature-disabled without the properties feature.

Source§

impl IfcModel

Source

pub fn set_properties( &mut self, edits: Vec<PropertyEdit>, ) -> Result<PropertyEditResult, BindingError>

Apply edits as one checked transaction: every edit, in order, or, when any is refused, none, and the model is unchanged.

Refused with missing-entity for an object not in the model, wrong-entity-type for an object that carries no property sets or a set type that disagrees with the set, unsupported-schema for a release other than IFC2X3, IFC4 or IFC4X3, invalid-value for a value the release does not admit, template-violation for one the catalog or the property’s enumeration does not, missing-property for a removal of a property the object does not state (also one it only inherits), unsupported for a value form this writer does not write or when the build or host has no random source for the seed (as crate::relations::new_guid), invalid-model when the file’s records prevent the edit, and feature-disabled without the properties-write feature, or without a catalog feature for a Pset_ or Qto_ set, and catalog-not-loaded for such a set in a property-catalog-runtime build before crate::catalog::load loaded its release, and invalid-value for a GlobalId derived from a seed the model already holds. The message names the refused edit’s position. The new GlobalIds derive from a fresh seed per call.

Source

pub fn set_properties_seeded( &mut self, edits: Vec<PropertyEdit>, seed: u128, ) -> Result<PropertyEditResult, BindingError>

Self::set_properties with the seed the GlobalIds of new sets and relationships derive from: a host with entropy of its own (the browser) passes it. The seed names the batch: a fixed seed reproduces its GlobalIds, also after a write/read cycle; reusing it where the model holds one it derives is refused (invalid-value).

Source

pub fn set_property( &mut self, object: u64, set: &str, name: &str, value: Tagged, set_type: Option<String>, ) -> Result<u64, BindingError>

Write one value; Self::set_properties with one edit, with its refusals, unsupported for a missing random source among them. Returns the entity that holds the property afterwards.

Source

pub fn set_property_seeded( &mut self, object: u64, set: &str, name: &str, value: Tagged, set_type: Option<String>, seed: u128, ) -> Result<u64, BindingError>

Self::set_property with the seed the GlobalIds of new sets and relationships derive from: a host with entropy of its own (the browser) passes it. The seed names the batch: a fixed seed reproduces its GlobalIds, also after a write/read cycle; reusing it where the model holds one it derives is refused (invalid-value).

Source

pub fn remove_property( &mut self, object: u64, set: &str, name: &str, ) -> Result<(), BindingError>

Remove one property; Self::set_properties with one edit, with its refusals, unsupported for a missing random source among them.

Source

pub fn remove_property_seeded( &mut self, object: u64, set: &str, name: &str, seed: u128, ) -> Result<(), BindingError>

Self::remove_property with the seed the GlobalIds of new sets and relationships derive from: a host with entropy of its own (the browser) passes it. The seed names the batch: a fixed seed reproduces its GlobalIds, also after a write/read cycle; reusing it where the model holds one it derives is refused (invalid-value).

Source§

impl IfcModel

Source

pub fn by_guid(&self, global_id: &str) -> Result<Option<u64>, BindingError>

The entity whose GlobalId is global_id, or None when none.

Refused with invalid-value when global_id is not 22 characters of IFC’s alphabet, and with invalid-model when several entities carry it.

Source

pub fn duplicate_global_ids( &self, ) -> Result<Vec<DuplicateGlobalId>, BindingError>

Every GlobalId several entities carry, in GlobalId order, each with its holders in file order. Empty for a conformant file.

Source

pub fn type_object(&self, occurrence: u64) -> Result<Option<u64>, BindingError>

The type object of occurrence (IfcRelDefinesByType), or None.

Source

pub fn occurrences_of(&self, type_object: u64) -> Result<Vec<u64>, BindingError>

Every object type_object types, in file order.

Source

pub fn openings_of(&self, element: u64) -> Result<Vec<u64>, BindingError>

Every opening voiding element (IfcRelVoidsElement), in file order.

Source

pub fn fillings_of(&self, opening: u64) -> Result<Vec<u64>, BindingError>

Every element filling opening (IfcRelFillsElement), in file order.

Source

pub fn voided_element_of( &self, opening: u64, ) -> Result<Option<u64>, BindingError>

The element opening voids (IfcRelVoidsElement), or None.

Source§

impl IfcModel

Source

pub fn select(&self, query: &str) -> Result<Vec<u64>, BindingError>

The entities query selects, in ascending id order.

Refused with invalid-selector for a query that does not parse or names a class or attribute the declared release does not declare, unsupported-schema, invalid-model for an ambiguous or malformed relationship or a duplicated GlobalId an instance facet names, missing-reference, and the property refusals of Self::property_sets.

Source

pub fn select_from( &self, query: &str, base: &[u64], ) -> Result<Vec<u64>, BindingError>

The entities query selects from base alone, in ascending id order. Refused as Self::select, and with missing-entity for an id of base the model lacks.

Source

pub fn get_value(&self, id: u64, path: &str) -> Result<Selected, BindingError>

The value path reads from entity id. Refused with invalid-selector for a path that does not parse, missing-entity, and as Self::select.

Source

pub fn set_value( &mut self, id: u64, path: &str, value: Plain, ) -> Result<(), BindingError>

Write value at path of entity id, as one transaction: an attribute (Name, type.Name, materials.Category) from a plain value coerced against its declared type, or a property (Pset_WallCommon.FireRating, type.Pset_WallCommon.FireRating) from a typed value, or a plain one the property already states the type of. Every check runs first: a refusal changes nothing.

Refused with invalid-value for a path that names no single value (a pattern, count, a prefix reaching no entity), unknown-attribute, derived-attribute, type-mismatch (also for a plain value no stated property types), ambiguous-value, and the property edit’s refusals. Also unsupported when the build or host has no random source for the seed (as crate::relations::new_guid); that is checked first, before feature-disabled for a property write.

Source

pub fn set_value_seeded( &mut self, id: u64, path: &str, value: Plain, seed: u128, ) -> Result<(), BindingError>

Self::set_value with the seed the GlobalIds of new sets and relationships derive from: a host with entropy of its own (the browser) passes it. The seed names the batch: a fixed seed reproduces its GlobalIds, also after a write/read cycle; reusing it where the model holds one it derives is refused (invalid-value).

Source§

impl IfcModel

Source

pub fn spatial_tree(&self) -> Result<SpatialTree, BindingError>

The spatial containment tree.

Refused with unsupported-schema when the header names no bundled release, and with feature-disabled without the spatial feature.

Source§

impl IfcModel

Source

pub fn systems(&self) -> Result<Systems, BindingError>

Every system, with its members and served structures.

Refused with unsupported-schema for a release other than IFC2X3, IFC4 or IFC4X3, and with feature-disabled without the systems feature.

Source§

impl IfcModel

Source

pub fn export_table( &self, query: &str, columns: &[String], format_name: &str, key: Option<&str>, null: &str, ) -> Result<Vec<u8>, BindingError>

The entities query selects as a table in format (csv, tsv or xlsx): the key column first (GlobalId unless key names id), then one column per path of columns, each cell the value the path reads as text, NULL as null.

Refused with invalid-selector (and its span) for a query or path that does not parse, invalid-value for an unknown format or key name, wrong-entity-type for an entity without a GlobalId in a table keyed by it, feature-disabled for XLSX in a build without sheet-xlsx, and as Self::select and Self::get_value.

Source

pub fn import_table( &mut self, data: &[u8], format_name: &str, key: Option<&str>, null: &str, dry_run: bool, ) -> Result<TableImport, BindingError>

Apply the table data (csv, tsv or xlsx) to the model by its key column (key: GlobalId or id; by default GlobalId when the table has one, else id) as one checked transaction, null being the cell text of NULL. With dry_run, or when anything is refused, nothing is written.

Refused with invalid-value for an unknown format or key name, parse for bytes that are no table of the format, feature-disabled for XLSX in a build without sheet-xlsx, unsupported when the build or host has no random source for the seed (as crate::relations::new_guid; checked first), and unsupported-schema; every refusal of the table’s header, rows and cells is in TableImport::refusals.

Source

pub fn import_table_seeded( &mut self, data: &[u8], format_name: &str, key: Option<&str>, null: &str, dry_run: bool, seed: u128, ) -> Result<TableImport, BindingError>

Self::import_table with the seed the GlobalIds of new sets and relationships derive from: a host with entropy of its own (the browser) passes it. The seed names the batch: a fixed seed reproduces its GlobalIds, also after a write/read cycle; reusing it where the model holds one it derives is refused (invalid-value).

Source§

impl IfcModel

Source

pub fn convert_unit_value( &self, value: f64, from: u64, to: u64, ) -> Result<f64, BindingError>

Convert value from unit entity from to unit entity to of this model.

§Errors

See the module docs.

Source

pub fn convert_length_unit( &mut self, target: &str, options: LengthUnitOptions, ) -> Result<LengthUnitReport, BindingError>

Convert the model’s length unit to the unit named target (an SI METRE with any prefix, or inch, foot, yard, mile, US survey foot), rescaling every length, area and volume value, as one checked transaction; with options.dry_run, only report.

§Errors

See the module docs.

Source§

impl IfcModel

Source

pub fn unreachable_products( &self, ) -> Result<Vec<UnreachableProduct>, BindingError>

Products that no viewer will draw, with the reason, in id order.

Openings, assembly parts, spatial containers and products without a representation are not reported: they legitimately sit outside the containment tree.

Source§

impl IfcModel

Source

pub fn validate( &self, max_findings: Option<usize>, ) -> Result<ValidationReport, BindingError>

Validate against the schema the header declares.

max_findings caps how many findings are recorded (the validator’s default budget, 10,000, when None); hitting it sets ValidationReport::truncated. Refused with unsupported-schema when the header names no bundled schema, and with feature-disabled in a build without the validate feature.

Source

pub fn validate_express( &self, express: &str, max_findings: Option<usize>, ) -> Result<ValidationReport, BindingError>

Validate with the EXPRESS rules of the declared release, read from express, the text of that release’s .exp file (#538).

Every WHERE, type and global rule is evaluated, and INVERSE cardinality is checked. The text is parsed on each call against the declared release’s tables; it is never bundled (the schemas are CC BY-ND). Refused with express-mismatch when the text declares another schema or disagrees with the tables, with invalid-express when it does not parse, with unsupported-schema when the header names no bundled schema, and with feature-disabled in a build without the validate-express feature.

Source§

impl IfcModel

Source

pub fn parse_ifcxml( bytes: &[u8], xsd_profile: Option<&str>, ) -> Result<Self, BindingError>

Parse an ifcXML document: the native layout when xsd_profile is None, else the XSD configuration of that profile (IFC4 or IFC4X3_ADD2, case-insensitive).

Refused with unsupported-profile for any other token, with unsupported-schema when the profile’s release is not bundled, and with parse when the document does not read.

Source

pub fn write_ifcxml( &self, xsd_profile: Option<&str>, ) -> Result<Vec<u8>, BindingError>

Serialize as ifcXML, in the layout Self::parse_ifcxml reads.

An XSD-layout write needs the header to declare the profile’s schema token, and refuses with write what the configuration cannot carry.

Trait Implementations§

Source§

impl Debug for IfcModel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IfcModel

Source§

fn default() -> IfcModel

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.