mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
Example for #209
This commit is contained in:
@@ -265,6 +265,16 @@ int main() {
|
|||||||
IfcSchema::IfcProductDefinitionShape* ground_representation = IfcGeom::tesselate(shape, 100.);
|
IfcSchema::IfcProductDefinitionShape* ground_representation = IfcGeom::tesselate(shape, 100.);
|
||||||
file.getSingle<IfcSchema::IfcSite>()->setRepresentation(ground_representation);
|
file.getSingle<IfcSchema::IfcSite>()->setRepresentation(ground_representation);
|
||||||
|
|
||||||
|
// Relate a property set to the IfcSite
|
||||||
|
const double site_area = IfcGeom::Kernel::face_area(TopoDS::Face(shape)) / 1000 / 1000;
|
||||||
|
IfcSchema::IfcProperty::list::ptr properties(new IfcSchema::IfcProperty::list);
|
||||||
|
properties->push(new IfcSchema::IfcPropertySingleValue("TotalArea", null, new IfcSchema::IfcAreaMeasure(site_area), 0));
|
||||||
|
IfcSchema::IfcPropertySet* pset = new IfcSchema::IfcPropertySet(guid(), file.getSingle<IfcSchema::IfcOwnerHistory>(), S("Pset_SiteCommon"), null, properties);
|
||||||
|
IfcSchema::IfcObject::list::ptr related_objs(new IfcSchema::IfcObject::list);
|
||||||
|
related_objs->push(file.getSingle<IfcSchema::IfcSite>());
|
||||||
|
IfcSchema::IfcRelDefinesByProperties* site_prop = new IfcSchema::IfcRelDefinesByProperties(guid(), file.getSingle<IfcSchema::IfcOwnerHistory>(), null, null, related_objs, pset);
|
||||||
|
file.addEntity(site_prop);
|
||||||
|
|
||||||
IfcSchema::IfcRepresentation::list::ptr ground_reps = file.getSingle<IfcSchema::IfcSite>()->Representation()->Representations();
|
IfcSchema::IfcRepresentation::list::ptr ground_reps = file.getSingle<IfcSchema::IfcSite>()->Representation()->Representations();
|
||||||
for (IfcSchema::IfcRepresentation::list::it it = ground_reps->begin(); it != ground_reps->end(); ++it) {
|
for (IfcSchema::IfcRepresentation::list::it it = ground_reps->begin(); it != ground_reps->end(); ++it) {
|
||||||
(*it)->setContextOfItems(file.getRepresentationContext("Model"));
|
(*it)->setContextOfItems(file.getRepresentationContext("Model"));
|
||||||
|
|||||||
@@ -215,8 +215,6 @@ public:
|
|||||||
gp_Pnt point_above_plane(const gp_Pln& pln, bool agree=true);
|
gp_Pnt point_above_plane(const gp_Pln& pln, bool agree=true);
|
||||||
const TopoDS_Shape& ensure_fit_for_subtraction(const TopoDS_Shape& shape, TopoDS_Shape& solid);
|
const TopoDS_Shape& ensure_fit_for_subtraction(const TopoDS_Shape& shape, TopoDS_Shape& solid);
|
||||||
bool profile_helper(int numVerts, double* verts, int numFillets, int* filletIndices, double* filletRadii, gp_Trsf2d trsf, TopoDS_Shape& face);
|
bool profile_helper(int numVerts, double* verts, int numFillets, int* filletIndices, double* filletRadii, gp_Trsf2d trsf, TopoDS_Shape& face);
|
||||||
double shape_volume(const TopoDS_Shape& s);
|
|
||||||
double face_area(const TopoDS_Face& f);
|
|
||||||
void apply_tolerance(TopoDS_Shape& s, double t);
|
void apply_tolerance(TopoDS_Shape& s, double t);
|
||||||
void setValue(GeomValue var, double value);
|
void setValue(GeomValue var, double value);
|
||||||
double getValue(GeomValue var) const;
|
double getValue(GeomValue var) const;
|
||||||
@@ -228,6 +226,9 @@ public:
|
|||||||
bool approximate_plane_through_wire(const TopoDS_Wire&, gp_Pln&);
|
bool approximate_plane_through_wire(const TopoDS_Wire&, gp_Pln&);
|
||||||
bool flatten_wire(TopoDS_Wire&);
|
bool flatten_wire(TopoDS_Wire&);
|
||||||
|
|
||||||
|
static double shape_volume(const TopoDS_Shape& s);
|
||||||
|
static double face_area(const TopoDS_Face& f);
|
||||||
|
|
||||||
static TopoDS_Shape apply_transformation(const TopoDS_Shape&, const gp_Trsf&);
|
static TopoDS_Shape apply_transformation(const TopoDS_Shape&, const gp_Trsf&);
|
||||||
static TopoDS_Shape apply_transformation(const TopoDS_Shape&, const gp_GTrsf&);
|
static TopoDS_Shape apply_transformation(const TopoDS_Shape&, const gp_GTrsf&);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user