MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / extractFace

Method extractFace

src/Mod/TechDraw/App/DrawGeomHatch.cpp:537–568  ·  view source on GitHub ↗

static */ get TopoDS_Face(iface) from DVP TODO: DVP can serve these up ready to use

Source from the content-addressed store, hash-verified

535//! get TopoDS_Face(iface) from DVP
536//! TODO: DVP can serve these up ready to use
537TopoDS_Face DrawGeomHatch::extractFace(DrawViewPart* source, int iface )
538{
539 std::vector<TopoDS_Wire> faceWires = source->getWireForFace(iface);
540
541 //build face(s) from geometry
542 gp_Pnt gOrg(0.0, 0.0, 0.0);
543 gp_Dir gDir(0.0, 0.0, 1.0);
544 gp_Pln plane(gOrg, gDir);
545
546 BRepBuilderAPI_MakeFace mkFace(plane, faceWires.front(), true);
547 std::vector<TopoDS_Wire>::iterator itWire = ++faceWires.begin(); //starting with second wire
548 for (; itWire != faceWires.end(); itWire++) {
549 mkFace.Add(*itWire);
550 }
551 if (!mkFace.IsDone()) {
552 return TopoDS_Face();
553 }
554 TopoDS_Face face = mkFace.Face();
555
556 TopoDS_Shape temp;
557 try {
558 // mirror about the Y axis
559 gp_Trsf mirrorTransform;
560 mirrorTransform.SetMirror( gp_Ax2(gp_Pnt(0.0, 0.0, 0.0), gp_Dir(0, 1, 0)) );
561 BRepBuilderAPI_Transform mkTrf(face, mirrorTransform);
562 temp = mkTrf.Shape();
563 }
564 catch (...) {
565 return TopoDS_Face();
566 }
567 return TopoDS::Face(temp);
568}
569
570//! get a translated label string from the context (ex TaskActiveView), the base name (ex ActiveView) and
571//! the unique name within the document (ex ActiveView001), and use it to update the Label property.

Callers

nothing calls this directly

Calls 13

getWireForFaceMethod · 0.80
IsDoneMethod · 0.80
TopoDS_FaceClass · 0.70
gp_Ax2Class · 0.70
gp_PntClass · 0.70
gp_DirClass · 0.70
FaceClass · 0.70
frontMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
AddMethod · 0.45
FaceMethod · 0.45

Tested by

no test coverage detected