Skip to main content

StepWriter

Struct StepWriter 

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

IFC STEP file writer

Builds a valid IFC file with the minimum structure needed for light fixtures.

Implementations§

Source§

impl StepWriter

Source

pub fn new(schema: &str) -> Self

Create a new STEP writer for the given IFC schema

Source

pub fn add_owner_history(&mut self, organization_name: &str) -> EntityRef

Add IfcOwnerHistory

Source

pub fn add_project(&mut self, name: &str, owner_history: EntityRef) -> EntityRef

Add IfcProject

Source

pub fn add_site( &mut self, name: &str, owner_history: EntityRef, project: EntityRef, ) -> EntityRef

Add IfcSite

Source

pub fn add_building( &mut self, name: &str, owner_history: EntityRef, site: EntityRef, ) -> EntityRef

Add IfcBuilding

Source

pub fn add_storey( &mut self, name: &str, owner_history: EntityRef, building: EntityRef, ) -> EntityRef

Add IfcBuildingStorey

Source

pub fn add_light_fixture_type( &mut self, name: &str, manufacturer: &str, predefined_type: LightFixtureTypeEnum, owner_history: EntityRef, ) -> EntityRef

Add IfcLightFixtureType with optional shared geometry

§Arguments
  • name - Type name
  • manufacturer - Manufacturer name
  • predefined_type - Light fixture predefined type
  • owner_history - Owner history reference
  • representation_map - Optional shared geometry (IFCREPRESENTATIONMAP)

When representation_map is provided, all fixture types share the same geometry, avoiding duplication. This is the correct IFC pattern for variants.

Source

pub fn add_light_fixture_type_with_geometry( &mut self, name: &str, manufacturer: &str, predefined_type: LightFixtureTypeEnum, owner_history: EntityRef, representation_map: Option<EntityRef>, ) -> EntityRef

Add IfcLightFixtureType with shared representation map

Source

pub fn create_representation_map( &mut self, mesh: Option<&MeshData>, ) -> EntityRef

Create a representation map for shared geometry

Creates geometry that can be referenced by multiple IFCLIGHTFIXTURETYPE entities. This avoids duplicating geometry for each variant.

§Arguments
  • mesh - Optional triangulated mesh data. If None, creates default box.
§Returns

EntityRef to IFCREPRESENTATIONMAP

Source

pub fn create_tessellated_geometry(&mut self, mesh: &MeshData) -> EntityRef

Create tessellated geometry from L3D mesh data

Converts triangulated mesh to IFC format:

  • IFCCARTESIANPOINTLIST3D for vertex positions
  • IFCTRIANGULATEDFACESET for triangle indices
  • IFCSHAPEREPRESENTATION with ‘Tessellation’ type
§Arguments
  • mesh - Triangulated mesh data with vertices and triangle indices
§Returns

EntityRef to IFCPRODUCTDEFINITIONSHAPE

Source

pub fn add_light_fixture_with_map( &mut self, name: &str, owner_history: EntityRef, storey: EntityRef, fixture_type: Option<EntityRef>, representation_map: Option<EntityRef>, mesh_data: Option<&MeshData>, ) -> EntityRef

Add IfcLightFixture occurrence with geometry

§Arguments
  • name - Fixture name
  • owner_history - Owner history reference
  • storey - Building storey reference
  • fixture_type - Optional fixture type reference
  • representation_map - Optional shared representation map. If provided, uses IFCMAPPEDITEM. If None, creates inline geometry from mesh_data or default box.
  • mesh_data - Optional L3D mesh data for inline tessellated geometry (used when no rep map).
Source

pub fn add_light_fixture( &mut self, name: &str, owner_history: EntityRef, storey: EntityRef, fixture_type: Option<EntityRef>, mesh_data: Option<&MeshData>, ) -> EntityRef

Add IfcLightFixture occurrence with geometry and connected light sources

§Arguments
  • name - Fixture name
  • owner_history - Owner history reference
  • storey - Building storey reference
  • fixture_type - Optional fixture type reference
  • mesh_data - Optional L3D mesh data for tessellated geometry. If None, creates a default 0.3m x 0.3m x 0.1m box.
Source

pub fn add_external_reference( &mut self, location: &str, identification: Option<&str>, name: &str, ) -> EntityRef

Add IfcExternalReference for LDT/IES photometric file

Source

pub fn add_light_source_goniometric( &mut self, name: &str, colour_appearance: Option<(f64, f64, f64)>, colour_temperature: f64, luminous_flux: f64, emission_source: LightEmissionSourceEnum, photometry_file: Option<&str>, ) -> EntityRef

Add IfcLightSourceGoniometric

Source

pub fn add_light_source_goniometric_with_distribution( &mut self, name: &str, colour_appearance: Option<(f64, f64, f64)>, colour_temperature: f64, luminous_flux: f64, emission_source: LightEmissionSourceEnum, distribution_data: &[(f64, f64, f64)], ) -> EntityRef

Add IfcLightSourceGoniometric with embedded distribution data

Instead of using an external file reference, this embeds the photometric distribution directly in the IFC using IFCLIGHTINTENSITYDISTRIBUTION.

Source

pub fn add_light_source_goniometric_with_distribution_ref( &mut self, name: &str, colour_appearance: Option<(f64, f64, f64)>, colour_temperature: f64, luminous_flux: f64, emission_source: LightEmissionSourceEnum, distribution_ref: EntityRef, ) -> EntityRef

Add IfcLightSourceGoniometric with a pre-existing distribution reference

This allows sharing the same IFCLIGHTINTENSITYDISTRIBUTION across multiple light sources.

Source

pub fn add_light_intensity_distribution( &mut self, distribution_type: &str, distribution_data: &[(f64, f64, f64)], ) -> EntityRef

Add IfcLightIntensityDistribution for embedded photometric data

Distribution data format: Vec<(main_angle, secondary_angle, intensity)> This is grouped by main angle to create IFCLIGHTDISTRIBUTIONDATA entries

Source

pub fn add_light_fixture_common_pset( &mut self, element: EntityRef, owner_history: EntityRef, number_of_sources: Option<i32>, total_wattage: Option<f64>, light_fixture_mounting_type: Option<&str>, light_fixture_placement_type: Option<&str>, ) -> EntityRef

Add Pset_LightFixtureTypeCommon property set

Source

pub fn add_electrical_pset( &mut self, element: EntityRef, owner_history: EntityRef, rated_voltage: Option<f64>, rated_current: Option<f64>, power_factor: Option<f64>, ip_code: Option<&str>, ) -> EntityRef

Add electrical properties property set

Source

pub fn add_electrical_device_pset( &mut self, element: EntityRef, owner_history: EntityRef, props: &ElectricalDeviceProperties, ) -> EntityRef

Add comprehensive electrical device properties (Pset_ElectricalDeviceCommon)

Full support for Electrical Information Exchange MVD (SPARKIE). See: https://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/Pset_ElectricalDeviceCommon.htm

Source

pub fn add_light_fixture_common_pset_full( &mut self, element: EntityRef, owner_history: EntityRef, props: &LightFixtureCommonProperties, ) -> EntityRef

Add light fixture common properties (Pset_LightFixtureTypeCommon)

Full support for Electrical Information Exchange MVD.

Source

pub fn add_manufacturer_info_pset( &mut self, element: EntityRef, owner_history: EntityRef, info: &ManufacturerTypeInfo, ) -> EntityRef

Add manufacturer type information (Pset_ManufacturerTypeInformation) - COBie

Source

pub fn add_warranty_pset( &mut self, element: EntityRef, owner_history: EntityRef, warranty: &WarrantyInfo, ) -> EntityRef

Add warranty information (Pset_Warranty) - COBie

Source

pub fn add_service_life_pset( &mut self, element: EntityRef, owner_history: EntityRef, service_life: &ServiceLifeInfo, ) -> EntityRef

Add service life information (Pset_ServiceLife) - COBie

Source

pub fn add_distribution_port( &mut self, name: &str, owner_history: EntityRef, parent_element: EntityRef, flow_direction: FlowDirectionEnum, system_type: DistributionSystemEnum, ) -> EntityRef

Add a distribution port for electrical connection

Creates an IfcDistributionPort to represent a power connection point on a light fixture. This enables circuit connectivity in Electrical MVD.

Source

pub fn add_lighting_system( &mut self, name: &str, owner_history: EntityRef, building: EntityRef, ) -> EntityRef

Add a lighting distribution system

Creates an IfcDistributionSystem to group light fixtures into a lighting circuit.

Source

pub fn assign_to_system( &mut self, owner_history: EntityRef, system: EntityRef, elements: &[EntityRef], )

Assign elements to a distribution system (e.g., light fixtures to lighting circuit)

Source

pub fn add_variant_pset( &mut self, element: EntityRef, owner_history: EntityRef, variant_id: &str, cct: Option<i32>, luminous_flux: Option<f64>, power: Option<f64>, cri: Option<i32>, weight: Option<f64>, ) -> EntityRef

Add variant-specific property set (Pset_LuminaireVariant)

Source

pub fn clear_light_sources(&mut self)

Clear light source tracking for a new fixture type

Source

pub fn add_photometry_filenames_pset( &mut self, element: EntityRef, owner_history: EntityRef, filenames: &[String], ) -> EntityRef

Add photometry filenames property set (for roundtrip preservation)

Stores original LDT filenames so they can be restored after IFC import.

Source

pub fn add_gldf_descriptive_pset( &mut self, element: EntityRef, owner_history: EntityRef, safety_class: Option<&str>, median_useful_life: Option<&str>, mounting_type: Option<&str>, recessed_depth: Option<f64>, ) -> EntityRef

Add GLDF descriptive attributes property set

Stores GLDF-specific descriptive attributes for roundtrip preservation:

  • ElectricalSafetyClass
  • MedianUsefulLife
  • MountingType (Ceiling/Wall/etc.)
  • RecessedDepth
Source

pub fn add_ldt_raw_content_pset( &mut self, element: EntityRef, owner_history: EntityRef, index: usize, filename: &str, raw_content: &str, ) -> EntityRef

Add raw LDT file content as base64 for exact roundtrip preservation

This stores the complete LDT file so it can be restored exactly.

Source

pub fn add_ldt_metadata_pset( &mut self, element: EntityRef, owner_history: EntityRef, index: usize, symmetry: i32, num_c_planes: i32, num_g_angles: i32, dc: f64, dg: f64, total_flux: f64, dr: &[f64; 10], luminaire_name: &str, ) -> EntityRef

Add LDT metadata property set (for roundtrip preservation)

Stores original LDT file metadata (symmetry, Mc, Ng, Dc, Dg, DR values, etc.) so they can be restored after IFC import.

Source

pub fn add_gldf_file_pset( &mut self, project: EntityRef, owner_history: EntityRef, file_type: &str, filename: &str, content_type: &str, content: &[u8], ) -> EntityRef

Add a generic GLDF file as base64-encoded property set

Used for preserving product images, sensor files, etc. through IFC roundtrip.

Source

pub fn to_step_string(&self) -> String

Generate the complete IFC STEP file content

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more