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
impl StepWriter
Sourcepub fn add_owner_history(&mut self, organization_name: &str) -> EntityRef
pub fn add_owner_history(&mut self, organization_name: &str) -> EntityRef
Add IfcOwnerHistory
Sourcepub fn add_project(&mut self, name: &str, owner_history: EntityRef) -> EntityRef
pub fn add_project(&mut self, name: &str, owner_history: EntityRef) -> EntityRef
Add IfcProject
Sourcepub fn add_site(
&mut self,
name: &str,
owner_history: EntityRef,
project: EntityRef,
) -> EntityRef
pub fn add_site( &mut self, name: &str, owner_history: EntityRef, project: EntityRef, ) -> EntityRef
Add IfcSite
Sourcepub fn add_building(
&mut self,
name: &str,
owner_history: EntityRef,
site: EntityRef,
) -> EntityRef
pub fn add_building( &mut self, name: &str, owner_history: EntityRef, site: EntityRef, ) -> EntityRef
Add IfcBuilding
Sourcepub fn add_storey(
&mut self,
name: &str,
owner_history: EntityRef,
building: EntityRef,
) -> EntityRef
pub fn add_storey( &mut self, name: &str, owner_history: EntityRef, building: EntityRef, ) -> EntityRef
Add IfcBuildingStorey
Sourcepub fn add_light_fixture_type(
&mut self,
name: &str,
manufacturer: &str,
predefined_type: LightFixtureTypeEnum,
owner_history: EntityRef,
) -> EntityRef
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 namemanufacturer- Manufacturer namepredefined_type- Light fixture predefined typeowner_history- Owner history referencerepresentation_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.
Sourcepub fn add_light_fixture_type_with_geometry(
&mut self,
name: &str,
manufacturer: &str,
predefined_type: LightFixtureTypeEnum,
owner_history: EntityRef,
representation_map: Option<EntityRef>,
) -> EntityRef
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
Sourcepub fn create_representation_map(
&mut self,
mesh: Option<&MeshData>,
) -> EntityRef
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
Sourcepub fn create_tessellated_geometry(&mut self, mesh: &MeshData) -> EntityRef
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
Sourcepub 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
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 nameowner_history- Owner history referencestorey- Building storey referencefixture_type- Optional fixture type referencerepresentation_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).
Sourcepub fn add_light_fixture(
&mut self,
name: &str,
owner_history: EntityRef,
storey: EntityRef,
fixture_type: Option<EntityRef>,
mesh_data: Option<&MeshData>,
) -> EntityRef
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 nameowner_history- Owner history referencestorey- Building storey referencefixture_type- Optional fixture type referencemesh_data- Optional L3D mesh data for tessellated geometry. If None, creates a default 0.3m x 0.3m x 0.1m box.
Sourcepub fn add_external_reference(
&mut self,
location: &str,
identification: Option<&str>,
name: &str,
) -> EntityRef
pub fn add_external_reference( &mut self, location: &str, identification: Option<&str>, name: &str, ) -> EntityRef
Add IfcExternalReference for LDT/IES photometric file
Sourcepub 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
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
Sourcepub 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
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.
Sourcepub 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
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.
Sourcepub fn add_light_intensity_distribution(
&mut self,
distribution_type: &str,
distribution_data: &[(f64, f64, f64)],
) -> EntityRef
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
Sourcepub 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
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
Sourcepub 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
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
Sourcepub fn add_electrical_device_pset(
&mut self,
element: EntityRef,
owner_history: EntityRef,
props: &ElectricalDeviceProperties,
) -> EntityRef
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
Sourcepub fn add_light_fixture_common_pset_full(
&mut self,
element: EntityRef,
owner_history: EntityRef,
props: &LightFixtureCommonProperties,
) -> EntityRef
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.
Sourcepub fn add_manufacturer_info_pset(
&mut self,
element: EntityRef,
owner_history: EntityRef,
info: &ManufacturerTypeInfo,
) -> EntityRef
pub fn add_manufacturer_info_pset( &mut self, element: EntityRef, owner_history: EntityRef, info: &ManufacturerTypeInfo, ) -> EntityRef
Add manufacturer type information (Pset_ManufacturerTypeInformation) - COBie
Sourcepub fn add_warranty_pset(
&mut self,
element: EntityRef,
owner_history: EntityRef,
warranty: &WarrantyInfo,
) -> EntityRef
pub fn add_warranty_pset( &mut self, element: EntityRef, owner_history: EntityRef, warranty: &WarrantyInfo, ) -> EntityRef
Add warranty information (Pset_Warranty) - COBie
Sourcepub fn add_service_life_pset(
&mut self,
element: EntityRef,
owner_history: EntityRef,
service_life: &ServiceLifeInfo,
) -> EntityRef
pub fn add_service_life_pset( &mut self, element: EntityRef, owner_history: EntityRef, service_life: &ServiceLifeInfo, ) -> EntityRef
Add service life information (Pset_ServiceLife) - COBie
Sourcepub fn add_distribution_port(
&mut self,
name: &str,
owner_history: EntityRef,
parent_element: EntityRef,
flow_direction: FlowDirectionEnum,
system_type: DistributionSystemEnum,
) -> EntityRef
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.
Sourcepub fn add_lighting_system(
&mut self,
name: &str,
owner_history: EntityRef,
building: EntityRef,
) -> EntityRef
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.
Sourcepub fn assign_to_system(
&mut self,
owner_history: EntityRef,
system: EntityRef,
elements: &[EntityRef],
)
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)
Sourcepub 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
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)
Sourcepub fn clear_light_sources(&mut self)
pub fn clear_light_sources(&mut self)
Clear light source tracking for a new fixture type
Sourcepub fn add_photometry_filenames_pset(
&mut self,
element: EntityRef,
owner_history: EntityRef,
filenames: &[String],
) -> EntityRef
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.
Sourcepub 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
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
Sourcepub fn add_ldt_raw_content_pset(
&mut self,
element: EntityRef,
owner_history: EntityRef,
index: usize,
filename: &str,
raw_content: &str,
) -> EntityRef
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.
Sourcepub 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
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.
Sourcepub fn add_gldf_file_pset(
&mut self,
project: EntityRef,
owner_history: EntityRef,
file_type: &str,
filename: &str,
content_type: &str,
content: &[u8],
) -> EntityRef
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.
Sourcepub fn to_step_string(&self) -> String
pub fn to_step_string(&self) -> String
Generate the complete IFC STEP file content