PNamedShape CTiglAbstractGeometricComponent::GetMirroredLoft(void) { if (mySymmetryAxis == TIGL_NO_SYMMETRY) { PNamedShape nullShape; nullShape.reset(); return nullShape; } gp_Ax2 mirrorPlane; if (mySymmetryAxis == TIGL_X_Z_PLANE) { mirrorPlane = gp_Ax2(gp_Pnt(0,0,0),gp_Dir(0.,1.,0.)); } else if (mySymmetryAxis == TIGL_X_Y_PLANE) { mirrorPlane = gp_Ax2(gp_Pnt(0,0,0),gp_Dir(0.,0.,1.)); } else if (mySymmetryAxis == TIGL_Y_Z_PLANE) { mirrorPlane = gp_Ax2(gp_Pnt(0,0,0),gp_Dir(1.,0.,0.)); } gp_Trsf theTransformation; theTransformation.SetMirror(mirrorPlane); BRepBuilderAPI_Transform myBRepTransformation(GetLoft()->Shape(), theTransformation); std::string mirrorName = GetLoft()->Name(); mirrorName += "M"; std::string mirrorShortName = GetLoft()->ShortName(); mirrorShortName += "M"; TopoDS_Shape mirroredShape = myBRepTransformation.Shape(); PNamedShape mirroredPNamedShape(new CNamedShape(*GetLoft())); mirroredPNamedShape->SetShape(mirroredShape); mirroredPNamedShape->SetName(mirrorName.c_str()); mirroredPNamedShape->SetShortName(mirrorShortName.c_str()); return mirroredPNamedShape; }
void CFace::ModifyByMatrix(const double *m){ if(GetParentBody() == NULL) { gp_Trsf mat = make_matrix(m); BRepBuilderAPI_Transform myBRepTransformation(m_topods_face,mat); m_topods_face = TopoDS::Face(myBRepTransformation.Shape()); } }
void CreateExtrusions(const std::list<TopoDS_Shape> &faces_or_wires, std::list<TopoDS_Shape>& new_shapes, const gp_Vec& extrude_vector, double taper_angle, bool solid_if_possible) { try{ for(std::list<TopoDS_Shape>::const_iterator It = faces_or_wires.begin(); It != faces_or_wires.end(); It++) { const TopoDS_Shape& face_or_wire = *It; if(fabs(taper_angle) > 0.0000001) { // make an offset face double distance = tan(taper_angle * M_PI/180) * extrude_vector.Magnitude(); bool wire = (face_or_wire.ShapeType() == TopAbs_WIRE); BRepOffsetAPI_MakeOffset offset; if(wire) offset = BRepOffsetAPI_MakeOffset(TopoDS::Wire(face_or_wire)); else continue; // can't do CreateRuledSurface on faces yet offset.Perform(distance); // parallel std::list<TopoDS_Wire> wire_list; wire_list.push_back(TopoDS::Wire(face_or_wire)); wire_list.push_back(TopoDS::Wire(offset.Shape())); gp_Trsf mat; mat.SetTranslation(extrude_vector); BRepBuilderAPI_Transform myBRepTransformation(wire_list.back(),mat); wire_list.back() = TopoDS::Wire(myBRepTransformation.Shape()); TopoDS_Shape new_shape; if(CreateRuledSurface(wire_list, new_shape, solid_if_possible)) { new_shapes.push_back(new_shape); } } else { BRepPrimAPI_MakePrism generator( face_or_wire, extrude_vector ); generator.Build(); new_shapes.push_back(generator.Shape()); } } } catch (Standard_Failure) { Handle_Standard_Failure e = Standard_Failure::Caught(); wxMessageBox(wxString(_("Error making extruded solid")) + _T(": ") + Ctt(e->GetMessageString())); } catch(...) { wxMessageBox(_("Fatal error making extruded solid")); } }
void CShape::MakeTransformedShape(const gp_Trsf &mat) { BRepBuilderAPI_Transform myBRepTransformation(m_shape,mat); m_shape = myBRepTransformation.Shape(); }