File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8080#include " ../ifcgeom/IfcGeom.h"
8181
8282bool IfcGeom::convert (const Ifc2x3::IfcCompositeCurve::ptr l, TopoDS_Wire& wire) {
83+ if ( ! Ifc::hasPlaneAngleUnit ) {
84+ Ifc::LogMessage (" Warning" ," Creating a composite curve without unit information:" ,l->entity );
85+ Ifc::hasPlaneAngleUnit = true ;
86+ // First try radians
87+ Ifc::PlaneAngleUnit = 1 .0f ;
88+ bool succes_radians = IfcGeom::convert (l,wire);
89+ bool succes_degrees;
90+ if ( succes_radians ) {
91+ Ifc::LogMessage (" Notice" ," Used radians to create composite curve" );
92+ } else {
93+ // Now try degrees
94+ Ifc::PlaneAngleUnit = 0 .0174532925199433f ;
95+ succes_degrees = IfcGeom::convert (l,wire);
96+ if ( succes_degrees ) {
97+ Ifc::LogMessage (" Notice" ," Used degrees to create composite curve" );
98+ }
99+ // Restore to radians
100+ Ifc::PlaneAngleUnit = 1 .0f ;
101+ }
102+ Ifc::hasPlaneAngleUnit = false ;
103+ return succes_radians || succes_degrees;
104+ }
83105 Ifc2x3::IfcCompositeCurveSegment::list segments = l->Segments ();
84106 BRepBuilderAPI_MakeWire w;
85107 // TopoDS_Vertex last_vertex;
Original file line number Diff line number Diff line change @@ -672,6 +672,7 @@ bool Ifc::Init(IfcParse::File* f) {
672672 Ifc::LengthUnit = value;
673673 } else if ( type == Ifc2x3::IfcUnitEnum::PLANEANGLEUNIT ) {
674674 Ifc::PlaneAngleUnit = value;
675+ Ifc::hasPlaneAngleUnit = true ;
675676 }
676677 }
677678 }
@@ -765,6 +766,7 @@ unsigned int Ifc::lastId = 0;
765766Tokens* Ifc::tokens = 0 ;
766767float Ifc::LengthUnit = 1 .0f ;
767768float Ifc::PlaneAngleUnit = 1 .0f ;
769+ bool Ifc::hasPlaneAngleUnit = false ;
768770int Ifc::CircleSegments = 32 ;
769771MapEntitiesByType Ifc::bytype;
770772MapEntityById Ifc::byid;
Original file line number Diff line number Diff line change @@ -247,6 +247,7 @@ class Ifc {
247247 static bool Init (IfcParse::File* f);
248248 static std::string GetLog ();
249249 static void Dispose ();
250+ static bool hasPlaneAngleUnit;
250251 static float LengthUnit;
251252 static float PlaneAngleUnit;
252253 static int CircleSegments;
You can’t perform that action at this time.
0 commit comments