bool IfcGeom::Kernel::convert(const IfcSchema::IfcEdgeLoop* l, TopoDS_Wire& result) {
	IfcSchema::IfcOrientedEdge::list::ptr li = l->EdgeList();
	BRepBuilderAPI_MakeWire mw;
	for (IfcSchema::IfcOrientedEdge::list::it it = li->begin(); it != li->end(); ++it) {
		IfcSchema::IfcOrientedEdge* e = *it;

		IfcSchema::IfcPoint* pnt1 = ((IfcSchema::IfcVertexPoint*) e->EdgeStart())->VertexGeometry();
		IfcSchema::IfcPoint* pnt2 = ((IfcSchema::IfcVertexPoint*) e->EdgeEnd())->VertexGeometry();
		if (!pnt1->is(IfcSchema::Type::IfcCartesianPoint) || !pnt2->is(IfcSchema::Type::IfcCartesianPoint)) {
			Logger::Message(Logger::LOG_ERROR, "Only IfcCartesianPoints are supported for VertexGeometry", l->entity);
			return false;
		}
	
		gp_Pnt p1, p2;
		if (!IfcGeom::Kernel::convert(((IfcSchema::IfcCartesianPoint*)pnt1), p1) ||
			!IfcGeom::Kernel::convert(((IfcSchema::IfcCartesianPoint*)pnt2), p2))
		{
			return false;
		}

		mw.Add(BRepBuilderAPI_MakeEdge(p1, p2));
		continue;
		
		IfcSchema::IfcEdge* base = e->EdgeElement();
		TopoDS_Wire w;
		if (convert_wire(e->EdgeElement(), w)) {
			if (!e->Orientation()) w.Reverse();
			mw.Add(w);
		}
	}
	result = mw;
	return true;
}
Example #2
0
bool IfcGeom::Kernel::convert(const IfcSchema::IfcEdgeLoop* l, TopoDS_Wire& result) {
	IfcSchema::IfcOrientedEdge::list::ptr li = l->EdgeList();
	BRepBuilderAPI_MakeWire mw;
	for (IfcSchema::IfcOrientedEdge::list::it it = li->begin(); it != li->end(); ++it) {
		TopoDS_Wire w;
		if (convert_wire(*it, w)) {
			if (!(*it)->Orientation()) w.Reverse();
			TopoDS_Iterator topoit(w, false);
			for (; topoit.More(); topoit.Next()) {
				const TopoDS_Edge& e = TopoDS::Edge(topoit.Value());
				mw.Add(e);
			}
			// mw.Add(w);
		}
	}
	result = mw;
	return true;
}