Skip to content

Commit 83ac741

Browse files
author
aothms
committed
Add support for IfcGeometricSet IfcRevolvedAreaSolid IfcSurfaceOfLinearExtrusion IfcSurfaceOfRevolution IfcCenterLineProfileDef IfcArbitraryOpenProfileDef
1 parent 2fb4be2 commit 83ac741

9 files changed

Lines changed: 339 additions & 6 deletions
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/********************************************************************************
2+
* *
3+
* This file is part of IfcOpenShell. *
4+
* *
5+
* IfcOpenShell is free software: you can redistribute it and/or modify *
6+
* it under the terms of the Lesser GNU General Public License as published by *
7+
* the Free Software Foundation, either version 3.0 of the License, or *
8+
* (at your option) any later version. *
9+
* *
10+
* IfcOpenShell is distributed in the hope that it will be useful, *
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13+
* Lesser GNU General Public License for more details. *
14+
* *
15+
* You should have received a copy of the Lesser GNU General Public License *
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17+
* *
18+
********************************************************************************/
19+
20+
/********************************************************************************
21+
* *
22+
* Example that generates various representations from *
23+
* IfcArbitraryOpenProfileDefs and its subclass IfcCenterLineProfileDef *
24+
* *
25+
********************************************************************************/
26+
27+
#include <string>
28+
#include <iostream>
29+
#include <fstream>
30+
31+
#include "../ifcparse/Ifc2x3.h"
32+
#include "../ifcparse/IfcUtil.h"
33+
#include "../ifcparse/IfcHierarchyHelper.h"
34+
35+
typedef std::string S;
36+
typedef IfcWrite::IfcGuidHelper guid;
37+
boost::none_t const null = (static_cast<boost::none_t>(0));
38+
static int i = 0;
39+
40+
void create_product_from_item(IfcHierarchyHelper& file, IfcSchema::IfcRepresentationItem* item, const std::string& s) {
41+
IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy(
42+
guid(), 0, S("product"), null, null, 0, 0, null, null);
43+
file.addBuildingProduct(product);
44+
product->setOwnerHistory(file.getSingle<IfcSchema::IfcOwnerHistory>());
45+
46+
product->setObjectPlacement(file.addLocalPlacement(120 * i++));
47+
48+
IfcSchema::IfcRepresentation::list reps (new IfcTemplatedEntityList<IfcSchema::IfcRepresentation>());
49+
IfcSchema::IfcRepresentationItem::list items (new IfcTemplatedEntityList<IfcSchema::IfcRepresentationItem>());
50+
items->push(item);
51+
52+
if (s == "GeometricSet") {
53+
IfcSchema::IfcGeometricSet* set = new IfcSchema::IfcGeometricSet(items->generalize());
54+
file.AddEntity(set);
55+
items = IfcSchema::IfcRepresentationItem::list(new IfcTemplatedEntityList<IfcSchema::IfcRepresentationItem>());
56+
items->push(set);
57+
}
58+
59+
IfcSchema::IfcShapeRepresentation* rep = new IfcSchema::IfcShapeRepresentation(
60+
file.getSingle<IfcSchema::IfcRepresentationContext>(), S("Body"), s, items);
61+
reps->push(rep);
62+
63+
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(0, 0, reps);
64+
file.AddEntity(rep);
65+
file.AddEntity(shape);
66+
67+
product->setRepresentation(shape);
68+
}
69+
70+
void create_surfaces_from_profile(IfcHierarchyHelper& file, IfcSchema::IfcProfileDef* profile) {
71+
IfcSchema::IfcSurfaceOfLinearExtrusion* extrusion = new IfcSchema::IfcSurfaceOfLinearExtrusion(profile, file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 100.);
72+
file.AddEntity(extrusion);
73+
74+
IfcSchema::IfcAxis1Placement* ax1 = new IfcSchema::IfcAxis1Placement(file.addTriplet<IfcSchema::IfcCartesianPoint>(0,100,0), file.addTriplet<IfcSchema::IfcDirection>(1,0,0));
75+
IfcSchema::IfcSurfaceOfRevolution* revolution = new IfcSchema::IfcSurfaceOfRevolution(profile, file.addPlacement3d(), ax1);
76+
file.AddEntity(ax1);
77+
file.AddEntity(revolution);
78+
79+
create_product_from_item(file, extrusion, "GeometricSet");
80+
create_product_from_item(file, revolution, "GeometricSet");
81+
}
82+
83+
void create_solids_from_profile(IfcHierarchyHelper& file, IfcSchema::IfcProfileDef* profile) {
84+
IfcSchema::IfcExtrudedAreaSolid* extrusion = new IfcSchema::IfcExtrudedAreaSolid(profile, file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 100.);
85+
file.AddEntity(extrusion);
86+
87+
IfcSchema::IfcAxis1Placement* ax1 = new IfcSchema::IfcAxis1Placement(file.addTriplet<IfcSchema::IfcCartesianPoint>(0,100,0), file.addTriplet<IfcSchema::IfcDirection>(1,0,0));
88+
IfcSchema::IfcRevolvedAreaSolid* revolution1 = new IfcSchema::IfcRevolvedAreaSolid(profile, file.addPlacement3d(), ax1, 360.);
89+
IfcSchema::IfcRevolvedAreaSolid* revolution2 = new IfcSchema::IfcRevolvedAreaSolid(profile, file.addPlacement3d(), ax1, 90.);
90+
file.AddEntity(ax1);
91+
file.AddEntity(revolution1);
92+
file.AddEntity(revolution2);
93+
94+
create_product_from_item(file, extrusion, "SweptSolid");
95+
create_product_from_item(file, revolution1, "SweptSolid");
96+
create_product_from_item(file, revolution2, "SweptSolid");
97+
}
98+
99+
void create_products_from_curve(IfcHierarchyHelper& file, IfcSchema::IfcBoundedCurve* curve) {
100+
IfcSchema::IfcArbitraryOpenProfileDef* open = new IfcSchema::IfcArbitraryOpenProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_CURVE, null, curve);
101+
IfcSchema::IfcCenterLineProfileDef* center_line = new IfcSchema::IfcCenterLineProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, curve, 10.);
102+
file.AddEntity(open);
103+
file.AddEntity(center_line);
104+
105+
create_surfaces_from_profile(file, open);
106+
create_solids_from_profile(file, center_line);
107+
}
108+
109+
int main(int argc, char** argv) {
110+
const char filename[] = "IfcArbitraryOpenProfileDef.ifc";
111+
IfcHierarchyHelper file;
112+
file.filename(filename);
113+
114+
double coords1[] = {-50.0, 0.0};
115+
double coords2[] = { 50.0, 0.0};
116+
IfcSchema::IfcCartesianPoint::list points (new IfcTemplatedEntityList<IfcSchema::IfcCartesianPoint>());
117+
points->push(new IfcSchema::IfcCartesianPoint(std::vector<double>(coords1, coords1+2)));
118+
points->push(new IfcSchema::IfcCartesianPoint(std::vector<double>(coords2, coords2+2)));
119+
file.AddEntities(points->generalize());
120+
IfcSchema::IfcPolyline* poly = new IfcSchema::IfcPolyline(points);
121+
file.AddEntity(poly);
122+
123+
create_products_from_curve(file, poly);
124+
125+
IfcSchema::IfcEllipse* ellipse = new IfcSchema::IfcEllipse(file.addPlacement2d(), 50., 25.);
126+
file.AddEntity(ellipse);
127+
IfcEntities trim1(new IfcEntityList());
128+
IfcEntities trim2(new IfcEntityList());
129+
trim1->push(new IfcWrite::IfcSelectHelper( 0., Ifc2x3::Type::IfcParameterValue));
130+
trim2->push(new IfcWrite::IfcSelectHelper(180., Ifc2x3::Type::IfcParameterValue));
131+
IfcSchema::IfcTrimmedCurve* trim = new IfcSchema::IfcTrimmedCurve(ellipse, trim1, trim2, true, IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER);
132+
file.AddEntity(trim);
133+
134+
create_products_from_curve(file, trim);
135+
136+
file.getSingle<Ifc2x3::IfcProject>()->setName("IfcArbitraryOpenProfileDef");
137+
138+
std::ofstream f(filename);
139+
f << file;
140+
}

src/ifcgeom/IfcGeom.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ namespace IfcGeom {
8080
};
8181

8282
bool convert_wire_to_face(const TopoDS_Wire& wire, TopoDS_Face& face);
83+
bool convert_curve_to_wire(const Handle(Geom_Curve)& curve, TopoDS_Wire& wire);
8384
bool convert_shapes(const IfcUtil::IfcBaseClass* L, IfcRepresentationShapeItems& result);
8485
bool is_shape_collection(const IfcUtil::IfcBaseClass* L);
8586
bool convert_shape(const IfcUtil::IfcBaseClass* L, TopoDS_Shape& result);

src/ifcgeom/IfcGeomFaces.cpp

Lines changed: 77 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,27 @@
5050
#include <Geom_Circle.hxx>
5151
#include <Geom_Ellipse.hxx>
5252
#include <Geom_TrimmedCurve.hxx>
53+
#include <Geom_OffsetCurve.hxx>
54+
55+
#include <BRepPrimAPI_MakePrism.hxx>
56+
#include <BRepPrimAPI_MakeHalfSpace.hxx>
5357

5458
#include <BRepOffsetAPI_Sewing.hxx>
59+
#include <BRepOffsetAPI_MakeOffset.hxx>
60+
5561
#include <BRepBuilderAPI_MakeFace.hxx>
5662
#include <BRepBuilderAPI_MakeEdge.hxx>
5763
#include <BRepBuilderAPI_MakeWire.hxx>
5864
#include <BRepBuilderAPI_MakePolygon.hxx>
5965
#include <BRepBuilderAPI_MakeVertex.hxx>
66+
#include <BRepBuilderAPI_MakeShell.hxx>
67+
#include <BRepBuilderAPI_MakeSolid.hxx>
6068

6169
#include <TopoDS.hxx>
6270
#include <TopoDS_Wire.hxx>
6371
#include <TopoDS_Face.hxx>
6472
#include <TopExp_Explorer.hxx>
6573

66-
#include <BRepPrimAPI_MakePrism.hxx>
67-
#include <BRepBuilderAPI_MakeShell.hxx>
68-
#include <BRepBuilderAPI_MakeSolid.hxx>
69-
#include <BRepPrimAPI_MakeHalfSpace.hxx>
7074
#include <BRepAlgoAPI_Cut.hxx>
7175

7276
#include <ShapeFix_Shape.hxx>
@@ -76,6 +80,10 @@
7680
#include <TopLoc_Location.hxx>
7781
#include <BRepGProp_Face.hxx>
7882

83+
#include <Standard_Failure.hxx>
84+
85+
#include <BRep_Tool.hxx>
86+
7987
#include "../ifcgeom/IfcGeom.h"
8088

8189
bool IfcGeom::convert(const IfcSchema::IfcFace::ptr l, TopoDS_Face& face) {
@@ -183,11 +191,13 @@ bool IfcGeom::convert(const IfcSchema::IfcFace::ptr l, TopoDS_Face& face) {
183191
// return face_area(face) > 0.0001;
184192
return true;
185193
}
194+
186195
bool IfcGeom::convert(const IfcSchema::IfcArbitraryClosedProfileDef::ptr l, TopoDS_Face& face) {
187196
TopoDS_Wire wire;
188197
if ( ! IfcGeom::convert_wire(l->OuterCurve(),wire) ) return false;
189198
return IfcGeom::convert_wire_to_face(wire,face);
190199
}
200+
191201
bool IfcGeom::convert(const IfcSchema::IfcArbitraryProfileDefWithVoids::ptr l, TopoDS_Face& face) {
192202
TopoDS_Wire profile;
193203
if ( ! IfcGeom::convert_wire(l->OuterCurve(),profile) ) return false;
@@ -204,6 +214,7 @@ bool IfcGeom::convert(const IfcSchema::IfcArbitraryProfileDefWithVoids::ptr l, T
204214
face = TopoDS::Face(sfs.Shape());
205215
return true;
206216
}
217+
207218
bool IfcGeom::convert(const IfcSchema::IfcRectangleProfileDef::ptr l, TopoDS_Face& face) {
208219
const double x = l->XDim() / 2.0f * IfcGeom::GetValue(GV_LENGTH_UNIT);
209220
const double y = l->YDim() / 2.0f * IfcGeom::GetValue(GV_LENGTH_UNIT);
@@ -218,6 +229,7 @@ bool IfcGeom::convert(const IfcSchema::IfcRectangleProfileDef::ptr l, TopoDS_Fac
218229
double coords[8] = {-x,-y,x,-y,x,y,-x,y};
219230
return IfcGeom::profile_helper(4,coords,0,0,0,trsf2d,face);
220231
}
232+
221233
bool IfcGeom::convert(const IfcSchema::IfcRoundedRectangleProfileDef::ptr l, TopoDS_Face& face) {
222234
const double x = l->XDim() / 2.0f * IfcGeom::GetValue(GV_LENGTH_UNIT);
223235
const double y = l->YDim() / 2.0f * IfcGeom::GetValue(GV_LENGTH_UNIT);
@@ -235,6 +247,7 @@ bool IfcGeom::convert(const IfcSchema::IfcRoundedRectangleProfileDef::ptr l, Top
235247
double radii[4] = {r,r,r,r};
236248
return IfcGeom::profile_helper(4,coords,4,fillets,radii,trsf2d,face);
237249
}
250+
238251
bool IfcGeom::convert(const IfcSchema::IfcRectangleHollowProfileDef::ptr l, TopoDS_Face& face) {
239252
const double x = l->XDim() / 2.0f * IfcGeom::GetValue(GV_LENGTH_UNIT);
240253
const double y = l->YDim() / 2.0f * IfcGeom::GetValue(GV_LENGTH_UNIT);
@@ -281,6 +294,7 @@ bool IfcGeom::convert(const IfcSchema::IfcRectangleHollowProfileDef::ptr l, Topo
281294
face = TopoDS::Face(sfs.Shape());
282295
return true;
283296
}
297+
284298
bool IfcGeom::convert(const IfcSchema::IfcTrapeziumProfileDef::ptr l, TopoDS_Face& face) {
285299
const double x1 = l->BottomXDim() / 2.0f * IfcGeom::GetValue(GV_LENGTH_UNIT);
286300
const double w = l->TopXDim() * IfcGeom::GetValue(GV_LENGTH_UNIT);
@@ -297,6 +311,7 @@ bool IfcGeom::convert(const IfcSchema::IfcTrapeziumProfileDef::ptr l, TopoDS_Fac
297311
double coords[8] = {-x1,-y, x1,-y, dx+w-x1,y, dx-x1,y};
298312
return IfcGeom::profile_helper(4,coords,0,0,0,trsf2d,face);
299313
}
314+
300315
bool IfcGeom::convert(const IfcSchema::IfcIShapeProfileDef::ptr l, TopoDS_Face& face) {
301316
const double x = l->OverallWidth() / 2.0f * IfcGeom::GetValue(GV_LENGTH_UNIT);
302317
const double y = l->OverallDepth() / 2.0f * IfcGeom::GetValue(GV_LENGTH_UNIT);
@@ -321,6 +336,7 @@ bool IfcGeom::convert(const IfcSchema::IfcIShapeProfileDef::ptr l, TopoDS_Face&
321336
double radii[4] = {f,f,f,f};
322337
return IfcGeom::profile_helper(12,coords,doFillet ? 4 : 0,fillets,radii,trsf2d,face);
323338
}
339+
324340
bool IfcGeom::convert(const IfcSchema::IfcZShapeProfileDef::ptr l, TopoDS_Face& face) {
325341
const double x = l->FlangeWidth() * IfcGeom::GetValue(GV_LENGTH_UNIT);
326342
const double y = l->Depth() / 2.0f * IfcGeom::GetValue(GV_LENGTH_UNIT);
@@ -353,6 +369,7 @@ bool IfcGeom::convert(const IfcSchema::IfcZShapeProfileDef::ptr l, TopoDS_Face&
353369
double radii[4] = {f2,f1,f2,f1};
354370
return IfcGeom::profile_helper(8,coords,(doFillet || doEdgeFillet) ? 4 : 0,fillets,radii,trsf2d,face);
355371
}
372+
356373
bool IfcGeom::convert(const IfcSchema::IfcCShapeProfileDef::ptr l, TopoDS_Face& face) {
357374
const double y = l->Depth() / 2.0f * IfcGeom::GetValue(GV_LENGTH_UNIT);
358375
const double x = l->Width() / 2.0f * IfcGeom::GetValue(GV_LENGTH_UNIT);
@@ -379,6 +396,7 @@ bool IfcGeom::convert(const IfcSchema::IfcCShapeProfileDef::ptr l, TopoDS_Face&
379396
double radii[8] = {f2,f2,f1,f1,f1,f1,f2,f2};
380397
return IfcGeom::profile_helper(12,coords,doFillet ? 8 : 0,fillets,radii,trsf2d,face);
381398
}
399+
382400
bool IfcGeom::convert(const IfcSchema::IfcLShapeProfileDef::ptr l, TopoDS_Face& face) {
383401
const bool hasSlope = l->hasLegSlope();
384402
const bool doEdgeFillet = l->hasEdgeRadius();
@@ -447,6 +465,7 @@ bool IfcGeom::convert(const IfcSchema::IfcLShapeProfileDef::ptr l, TopoDS_Face&
447465
double radii[3] = {f2,f1,f2};
448466
return IfcGeom::profile_helper(6,coords,doFillet ? 3 : 0,fillets,radii,trsf2d,face);
449467
}
468+
450469
bool IfcGeom::convert(const IfcSchema::IfcUShapeProfileDef::ptr l, TopoDS_Face& face) {
451470
const bool doEdgeFillet = l->hasEdgeRadius();
452471
const bool doFillet = l->hasFilletRadius();
@@ -488,6 +507,7 @@ bool IfcGeom::convert(const IfcSchema::IfcUShapeProfileDef::ptr l, TopoDS_Face&
488507
double radii[4] = {f2,f1,f1,f2};
489508
return IfcGeom::profile_helper(8, coords, (doFillet || doEdgeFillet) ? 4 : 0, fillets, radii, trsf2d, face);
490509
}
510+
491511
bool IfcGeom::convert(const IfcSchema::IfcTShapeProfileDef::ptr l, TopoDS_Face& face) {
492512
const bool doFlangeEdgeFillet = l->hasFlangeEdgeRadius();
493513
const bool doWebEdgeFillet = l->hasWebEdgeRadius();
@@ -570,6 +590,7 @@ bool IfcGeom::convert(const IfcSchema::IfcTShapeProfileDef::ptr l, TopoDS_Face&
570590
double radii[6] = {f2,f1,f3,f3,f1,f2};
571591
return IfcGeom::profile_helper(8, coords, (doFillet || doWebEdgeFillet || doFlangeEdgeFillet) ? 6 : 0, fillets, radii, trsf2d, face);
572592
}
593+
573594
bool IfcGeom::convert(const IfcSchema::IfcCircleProfileDef::ptr l, TopoDS_Face& face) {
574595
const double r = l->Radius() * IfcGeom::GetValue(GV_LENGTH_UNIT);
575596
if ( r == 0.0f ) {
@@ -587,6 +608,7 @@ bool IfcGeom::convert(const IfcSchema::IfcCircleProfileDef::ptr l, TopoDS_Face&
587608
w.Add(edge);
588609
return IfcGeom::convert_wire_to_face(w,face);
589610
}
611+
590612
bool IfcGeom::convert(const IfcSchema::IfcCircleHollowProfileDef::ptr l, TopoDS_Face& face) {
591613
const double r = l->Radius() * IfcGeom::GetValue(GV_LENGTH_UNIT);
592614
const double t = l->WallThickness() * IfcGeom::GetValue(GV_LENGTH_UNIT);
@@ -615,6 +637,7 @@ bool IfcGeom::convert(const IfcSchema::IfcCircleHollowProfileDef::ptr l, TopoDS_
615637
face = TopoDS::Face(sfs.Shape());
616638
return true;
617639
}
640+
618641
bool IfcGeom::convert(const IfcSchema::IfcEllipseProfileDef::ptr l, TopoDS_Face& face) {
619642
double rx = l->SemiAxis1() * IfcGeom::GetValue(GV_LENGTH_UNIT);
620643
double ry = l->SemiAxis2() * IfcGeom::GetValue(GV_LENGTH_UNIT);
@@ -640,4 +663,53 @@ bool IfcGeom::convert(const IfcSchema::IfcEllipseProfileDef::ptr l, TopoDS_Face&
640663
TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(ellipse);
641664
w.Add(edge);
642665
return IfcGeom::convert_wire_to_face(w, face);
643-
}
666+
}
667+
668+
bool IfcGeom::convert(const IfcSchema::IfcCenterLineProfileDef::ptr l, TopoDS_Face& face) {
669+
const double d = l->Thickness() * IfcGeom::GetValue(GV_LENGTH_UNIT) / 2.;
670+
671+
TopoDS_Wire wire;
672+
if (!IfcGeom::convert_wire(l->Curve(), wire)) return false;
673+
674+
// BRepOffsetAPI_MakeOffset insists on creating circular arc
675+
// segments for joining the curves that constitute the center
676+
// line. This is probably not in accordance with the IFC spec.
677+
// Although it does not specify a method to join segments
678+
// explicitly, it does dictate 'a constant thickness along the
679+
// curve'. Therefore for simple singular wires a quick
680+
// alternative is provided that uses a straight join.
681+
682+
TopExp_Explorer exp(wire, TopAbs_EDGE);
683+
TopoDS_Edge edge = TopoDS::Edge(exp.Current());
684+
exp.Next();
685+
686+
if (!exp.More()) {
687+
double u1, u2;
688+
Handle(Geom_Curve) curve = BRep_Tool::Curve(edge, u1, u2);
689+
690+
Handle(Geom_TrimmedCurve) trim = new Geom_TrimmedCurve(curve, u1, u2);
691+
692+
Handle(Geom_OffsetCurve) c1 = new Geom_OffsetCurve(trim, d, gp::DZ());
693+
Handle(Geom_OffsetCurve) c2 = new Geom_OffsetCurve(trim, -d, gp::DZ());
694+
695+
gp_Pnt c1a, c1b, c2a, c2b;
696+
c1->D0(c1->FirstParameter(), c1a);
697+
c1->D0(c1->LastParameter(), c1b);
698+
c2->D0(c2->FirstParameter(), c2a);
699+
c2->D0(c2->LastParameter(), c2b);
700+
701+
BRepBuilderAPI_MakeWire mw;
702+
mw.Add(BRepBuilderAPI_MakeEdge(c1));
703+
mw.Add(BRepBuilderAPI_MakeEdge(c1a, c2a));
704+
mw.Add(BRepBuilderAPI_MakeEdge(c2));
705+
mw.Add(BRepBuilderAPI_MakeEdge(c2b, c1b));
706+
707+
face = BRepBuilderAPI_MakeFace(mw.Wire());
708+
} else {
709+
BRepOffsetAPI_MakeOffset offset(BRepBuilderAPI_MakeFace(gp_Pln(gp::Origin(), gp::DZ())));
710+
offset.AddWire(wire);
711+
offset.Perform(d);
712+
face = BRepBuilderAPI_MakeFace(TopoDS::Wire(offset));
713+
}
714+
return true;
715+
}

src/ifcgeom/IfcGeomFunctions.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,12 @@ bool IfcGeom::convert_wire_to_face(const TopoDS_Wire& wire, TopoDS_Face& face) {
317317
face = mf.Face();
318318
return true;
319319
}
320+
321+
bool IfcGeom::convert_curve_to_wire(const Handle(Geom_Curve)& curve, TopoDS_Wire& wire) {
322+
wire = BRepBuilderAPI_MakeWire(BRepBuilderAPI_MakeEdge(curve));
323+
return true;
324+
}
325+
320326
bool IfcGeom::profile_helper(int numVerts, double* verts, int numFillets, int* filletIndices, double* filletRadii, gp_Trsf2d trsf, TopoDS_Face& face) {
321327
TopoDS_Vertex* vertices = new TopoDS_Vertex[numVerts];
322328

src/ifcgeom/IfcGeomHelpers.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,15 @@ bool IfcGeom::convert(const IfcSchema::IfcAxis2Placement3D::ptr l, gp_Trsf& trsf
131131
CACHE(IfcAxis2Placement3D,l,trsf)
132132
return true;
133133
}
134+
bool IfcGeom::convert(const IfcSchema::IfcAxis1Placement::ptr l, gp_Ax1& ax) {
135+
IN_CACHE(IfcAxis1Placement,l,gp_Ax1,ax)
136+
gp_Pnt o;gp_Dir axis = gp_Dir(0,0,1);
137+
IfcGeom::convert(l->Location(),o);
138+
if ( l->hasAxis() ) IfcGeom::convert(l->Axis(), axis);
139+
ax = gp_Ax1(o, axis);
140+
CACHE(IfcAxis1Placement,l,ax)
141+
return true;
142+
}
134143
bool IfcGeom::convert(const IfcSchema::IfcCartesianTransformationOperator3D::ptr l, gp_Trsf& trsf) {
135144
IN_CACHE(IfcCartesianTransformationOperator3D,l,gp_Trsf,trsf)
136145
gp_Pnt origin;

0 commit comments

Comments
 (0)