use ifc_model::{Entity, EntityId, Model, Transaction, Value};
use crate::error::GeometryError;
use crate::solid::swept::directrix_slot;
use super::release::bind;
use super::swept::{directrix_attrs, ParamForm, SweepTrim};
pub fn surface_curve_swept_area_solid_in(
tx: &mut Transaction,
model: &Model,
swept_area: EntityId,
position: Option<EntityId>,
directrix: EntityId,
trim: SweepTrim,
reference_surface: EntityId,
) -> Result<EntityId, GeometryError> {
const T: &str = "IFCSURFACECURVESWEPTAREASOLID";
let release = bind(model, T)?;
let form = ParamForm::Release(release);
let mut attrs = directrix_attrs(T, swept_area, position, directrix, trim, form)?;
attrs[directrix_slot::REFERENCE_SURFACE] = Value::Ref(reference_surface);
release.require(T, &attrs)?;
Ok(tx.create(Entity::new(T, attrs)))
}
pub fn fixed_reference_swept_area_solid_in(
tx: &mut Transaction,
model: &Model,
swept_area: EntityId,
position: Option<EntityId>,
directrix: EntityId,
trim: SweepTrim,
fixed_reference: EntityId,
) -> Result<EntityId, GeometryError> {
const T: &str = "IFCFIXEDREFERENCESWEPTAREASOLID";
let release = bind(model, T)?;
let form = ParamForm::Release(release);
let mut attrs = directrix_attrs(T, swept_area, position, directrix, trim, form)?;
attrs[directrix_slot::FIXED_REFERENCE] = Value::Ref(fixed_reference);
release.require(T, &attrs)?;
Ok(tx.create(Entity::new(T, attrs)))
}