pub struct Entity {
pub type_name: Arc<str>,
pub attributes: Vec<Value>,
}Expand description
One IFC entity instance.
§Reading the type name
type_name is a public field, not a method — there is no
entity.type_name(). Access it directly:
let entity = Entity::new("IFCWALL", vec![]);
assert_eq!(&*entity.type_name, "IFCWALL");Fields§
§type_name: Arc<str>Upper-cased type name exactly as it appeared (IFCWALL).
Case is normalized because STEP is case-insensitive for keywords but real files are inconsistent; comparing normalized names avoids a class of silent lookup misses.
attributes: Vec<Value>Positional attributes, in declaration order.
Order is significant: STEP records are positional, so slot 3 of
IFCWALL is its name regardless of what any other entity looks like.
Implementations§
Source§impl Entity
impl Entity
Sourcepub fn new(type_name: impl Into<Arc<str>>, attributes: Vec<Value>) -> Self
pub fn new(type_name: impl Into<Arc<str>>, attributes: Vec<Value>) -> Self
Build an entity from a type name and its attributes.
Sourcepub fn attribute(&self, index: usize) -> Option<&Value>
pub fn attribute(&self, index: usize) -> Option<&Value>
Attribute at index, or None when the slot does not exist.
Returns None rather than panicking because real files are routinely
short a trailing optional attribute, and a reader that panics on that
is useless in practice.
Sourcepub fn reference(&self, index: usize) -> Option<EntityId>
pub fn reference(&self, index: usize) -> Option<EntityId>
Attribute at index interpreted as an entity reference.
Sourcepub fn references(&self) -> Vec<EntityId>
pub fn references(&self) -> Vec<EntityId>
Every entity this one refers to, at any nesting depth.