Skip to content
Snippets Groups Projects
Commit 217997df authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

cleanup

parent 367c5a7f
No related branches found
No related tags found
No related merge requests found
...@@ -184,7 +184,8 @@ GEdge *OCCFactory::addNURBS(GModel *gm, GVertex *start, GVertex *end, ...@@ -184,7 +184,8 @@ GEdge *OCCFactory::addNURBS(GModel *gm, GVertex *start, GVertex *end,
(ctrlPoints, _weights, _knots, _mult, degree, false); (ctrlPoints, _weights, _knots, _mult, degree, false);
TopoDS_Edge occEdge; TopoDS_Edge occEdge;
if (occv1 && occv2) if (occv1 && occv2)
occEdge = BRepBuilderAPI_MakeEdge(NURBS,occv1->getShape(),occv2->getShape()).Edge(); occEdge = BRepBuilderAPI_MakeEdge(NURBS, occv1->getShape(),
occv2->getShape()).Edge();
else else
occEdge = BRepBuilderAPI_MakeEdge(NURBS).Edge(); occEdge = BRepBuilderAPI_MakeEdge(NURBS).Edge();
return gm->_occ_internals->addEdgeToModel(gm, occEdge); return gm->_occ_internals->addEdgeToModel(gm, occEdge);
...@@ -276,7 +277,7 @@ GEntity *OCCFactory::addSphere(GModel *gm, double xc, double yc, double zc, doub ...@@ -276,7 +277,7 @@ GEntity *OCCFactory::addSphere(GModel *gm, double xc, double yc, double zc, doub
gm->destroy(); gm->destroy();
gm->_occ_internals->buildLists(); gm->_occ_internals->buildLists();
gm->_occ_internals->buildGModel(gm); gm->_occ_internals->buildGModel(gm);
return getOCCRegionByNativePtr(gm,TopoDS::Solid(shape)); return getOCCRegionByNativePtr(gm, TopoDS::Solid(shape));
} }
GEntity *OCCFactory::addCylinder(GModel *gm, std::vector<double> p1, GEntity *OCCFactory::addCylinder(GModel *gm, std::vector<double> p1,
...@@ -308,7 +309,7 @@ GEntity *OCCFactory::addCylinder(GModel *gm, std::vector<double> p1, ...@@ -308,7 +309,7 @@ GEntity *OCCFactory::addCylinder(GModel *gm, std::vector<double> p1,
gm->destroy(); gm->destroy();
gm->_occ_internals->buildLists(); gm->_occ_internals->buildLists();
gm->_occ_internals->buildGModel(gm); gm->_occ_internals->buildGModel(gm);
return getOCCRegionByNativePtr(gm,TopoDS::Solid(shape)); return getOCCRegionByNativePtr(gm, TopoDS::Solid(shape));
} }
GEntity *OCCFactory::addTorus(GModel *gm, std::vector<double> p1, GEntity *OCCFactory::addTorus(GModel *gm, std::vector<double> p1,
...@@ -340,7 +341,7 @@ GEntity *OCCFactory::addTorus(GModel *gm, std::vector<double> p1, ...@@ -340,7 +341,7 @@ GEntity *OCCFactory::addTorus(GModel *gm, std::vector<double> p1,
gm->destroy(); gm->destroy();
gm->_occ_internals->buildLists(); gm->_occ_internals->buildLists();
gm->_occ_internals->buildGModel(gm); gm->_occ_internals->buildGModel(gm);
return getOCCRegionByNativePtr(gm,TopoDS::Solid(shape)); return getOCCRegionByNativePtr(gm, TopoDS::Solid(shape));
} }
GEntity *OCCFactory::addCone(GModel *gm, std::vector<double> p1, GEntity *OCCFactory::addCone(GModel *gm, std::vector<double> p1,
...@@ -395,17 +396,17 @@ GEntity *OCCFactory::addBlock(GModel *gm, std::vector<double> p1, ...@@ -395,17 +396,17 @@ GEntity *OCCFactory::addBlock(GModel *gm, std::vector<double> p1,
gm->destroy(); gm->destroy();
gm->_occ_internals->buildLists(); gm->_occ_internals->buildLists();
gm->_occ_internals->buildGModel(gm); gm->_occ_internals->buildGModel(gm);
return getOCCRegionByNativePtr(gm,TopoDS::Solid(shape)); return getOCCRegionByNativePtr(gm, TopoDS::Solid(shape));
} }
GModel *OCCFactory::computeBooleanUnion(GModel* obj, GModel* tool, GModel *OCCFactory::computeBooleanUnion(GModel* obj, GModel* tool,
int createNewModel) int createNewModel)
{ {
try{ try{
OCC_Internals *occ_obj = obj->getOCCInternals(); OCC_Internals *occ_obj = obj->getOCCInternals();
OCC_Internals *occ_tool = tool->getOCCInternals(); OCC_Internals *occ_tool = tool->getOCCInternals();
if (!occ_obj || !occ_tool)return NULL; if (!occ_obj || !occ_tool) return NULL;
if (createNewModel){ if (createNewModel){
GModel *temp = new GModel; GModel *temp = new GModel;
...@@ -429,11 +430,11 @@ GModel *OCCFactory::computeBooleanUnion(GModel* obj, GModel* tool, ...@@ -429,11 +430,11 @@ GModel *OCCFactory::computeBooleanUnion(GModel* obj, GModel* tool,
GModel *OCCFactory::computeBooleanDifference(GModel* obj, GModel* tool, GModel *OCCFactory::computeBooleanDifference(GModel* obj, GModel* tool,
int createNewModel) int createNewModel)
{ {
try{ try{
OCC_Internals *occ_obj = obj->getOCCInternals(); OCC_Internals *occ_obj = obj->getOCCInternals();
OCC_Internals *occ_tool = tool->getOCCInternals(); OCC_Internals *occ_tool = tool->getOCCInternals();
if (!occ_obj || !occ_tool)return NULL; if (!occ_obj || !occ_tool) return NULL;
if (createNewModel){ if (createNewModel){
GModel *temp = new GModel; GModel *temp = new GModel;
...@@ -457,10 +458,10 @@ GModel *OCCFactory::computeBooleanIntersection(GModel* obj, GModel* tool, ...@@ -457,10 +458,10 @@ GModel *OCCFactory::computeBooleanIntersection(GModel* obj, GModel* tool,
int createNewModel) int createNewModel)
{ {
try{ try{
OCC_Internals *occ_obj = obj->getOCCInternals(); OCC_Internals *occ_obj = obj->getOCCInternals();
OCC_Internals *occ_tool = tool->getOCCInternals(); OCC_Internals *occ_tool = tool->getOCCInternals();
if (!occ_obj || !occ_tool)return NULL; if (!occ_obj || !occ_tool) return NULL;
if (createNewModel){ if (createNewModel){
GModel *temp = new GModel; GModel *temp = new GModel;
...@@ -484,14 +485,14 @@ void OCCFactory::fillet(GModel *gm, std::vector<int> edges, double radius) ...@@ -484,14 +485,14 @@ void OCCFactory::fillet(GModel *gm, std::vector<int> edges, double radius)
{ {
try{ try{
std::vector<TopoDS_Edge> edgesToFillet; std::vector<TopoDS_Edge> edgesToFillet;
for (int i=0;i<edges.size();i++){ for (int i = 0; i < edges.size(); i++){
GEdge *ed = gm->getEdgeByTag(edges[i]); GEdge *ed = gm->getEdgeByTag(edges[i]);
if (ed){ if (ed){
OCCEdge *occed = dynamic_cast<OCCEdge*>(ed); OCCEdge *occed = dynamic_cast<OCCEdge*>(ed);
if (occed)edgesToFillet.push_back(occed->getTopoDS_Edge()); if (occed)edgesToFillet.push_back(occed->getTopoDS_Edge());
}
} }
} gm->_occ_internals->fillet(edgesToFillet, radius);
gm->_occ_internals->fillet(edgesToFillet,radius);
gm->destroy(); gm->destroy();
gm->_occ_internals->buildLists(); gm->_occ_internals->buildLists();
gm->_occ_internals->buildGModel(gm); gm->_occ_internals->buildGModel(gm);
...@@ -530,13 +531,13 @@ void OCCFactory::rotate(GModel *gm, std::vector<double> p1,std::vector<double> p ...@@ -530,13 +531,13 @@ void OCCFactory::rotate(GModel *gm, std::vector<double> p1,std::vector<double> p
gp_Trsf transformation; gp_Trsf transformation;
gp_Vec direction (gp_Pnt (x1,y1,z1),gp_Pnt (x2,y2,z2)); gp_Vec direction(gp_Pnt(x1, y1, z1), gp_Pnt(x2, y2, z2));
gp_Ax1 axisOfRevolution (gp_Pnt (x1,y1,z1),direction); gp_Ax1 axisOfRevolution(gp_Pnt(x1, y1, z1), direction);
transformation.SetRotation(axisOfRevolution, angle); transformation.SetRotation(axisOfRevolution, angle);
BRepBuilderAPI_Transform aTransformation(gm->_occ_internals->getShape(), BRepBuilderAPI_Transform aTransformation(gm->_occ_internals->getShape(),
transformation, Standard_False); transformation, Standard_False);
TopoDS_Shape temp = aTransformation.Shape(); TopoDS_Shape temp = aTransformation.Shape();
if (!addToTheModel) gm->_occ_internals->loadShape(& temp); if (!addToTheModel) gm->_occ_internals->loadShape(&temp);
else gm->_occ_internals->buildShapeFromLists(temp); else gm->_occ_internals->buildShapeFromLists(temp);
gm->destroy(); gm->destroy();
gm->_occ_internals->buildLists(); gm->_occ_internals->buildLists();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment