diff --git a/Fltk/contextWindow.cpp b/Fltk/contextWindow.cpp index bb891a9fd34c1d79ce6f9d057aaa2dc9707720be..645cbf1a53712abc9856c01a0ab7d2b2590adf8f 100644 --- a/Fltk/contextWindow.cpp +++ b/Fltk/contextWindow.cpp @@ -82,7 +82,7 @@ geometryContextWindow::geometryContextWindow(int deltaFontSize) input[3]->value("0"); input[4] = new Fl_Input(2 * WB, 2 * WB + 3 * BH, IW, BH, "Z coordinate"); input[4]->value("0"); - input[5] = new Fl_Input(2 * WB, 2 * WB + 4 * BH, IW, BH, "Prescribed element size at point"); + input[5] = new Fl_Input(2 * WB, 2 * WB + 4 * BH, IW, BH, "Prescribed mesh element size at point"); input[5]->value("1.0"); for(int i = 2; i < 6; i++) { input[i]->align(FL_ALIGN_RIGHT); diff --git a/Geo/GModel.h b/Geo/GModel.h index f97b9854bfbdf00e6f947a83a568bf9ac91bdb62..dfea73d39f0a9b5538e81727d8a15e4c13aa3d0b 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -352,13 +352,13 @@ class GModel // mesh the model int mesh(int dimension); - // glue entities in the model - // assume a tolerance eps and merge vertices that are too close, - // then merge edges, faces and regions. - // the gluer changes the geometric model, so that some pointers - // could become invalid !! I think that using references to some - // tables of pointers for bindings e.g. could be better. FIXME !! - void glue (double eps); + // glue entities in the model (assume a tolerance eps and merge + // vertices that are too close, then merge edges, faces and + // regions). Warning: the gluer changes the geometric model, so that + // some pointers could become invalid. FIXME: using references to + // some tables of pointers for bindings e.g. could be better. + void glue(double eps); + // change the entity creation factory void setFactory(std::string name); @@ -373,7 +373,8 @@ class GModel std::vector<double> knots, std::vector<double> weights, std::vector<int> mult); - GEntity *revolve(GEntity *e, std::vector<double> p1, std::vector<double> p2, double angle); + GEntity *revolve(GEntity *e, std::vector<double> p1, std::vector<double> p2, + double angle); GEntity *extrude(GEntity *e, std::vector<double> p1, std::vector<double> p2); // create solid geometry primitives using the factory @@ -390,13 +391,6 @@ class GModel GModel *computeBooleanIntersection(GModel *tool, int createNewModel); GModel *computeBooleanDifference(GModel *tool, int createNewModel); - // glue entities in the model (i.e., assume a tolerance eps and - // merge vertices that are too close, then merge edges, faces and - // regions). Warning: the gluer changes the geometric model, so that - // some pointers could become invalid! I think that using references - // to some tables of pointers for bindings e.g. could be better - void glue(const double &eps); - // build a new GModel by cutting the elements crossed by the levelset ls // if cutElem is set to false, split the model without cutting the elements GModel *buildCutGModel(gLevelset *ls, bool cutElem = true); diff --git a/Geo/GModelFactory.cpp b/Geo/GModelFactory.cpp index a5a801d0d360c4dd4ecb1690fdf9f5ecabbe0a74..b0987bb061f179746416c0082a19a9285ac63c81 100644 --- a/Geo/GModelFactory.cpp +++ b/Geo/GModelFactory.cpp @@ -64,16 +64,16 @@ GEdge *OCCFactory::addLine(GModel *gm, GVertex *start, GVertex *end) return gm->_occ_internals->addEdgeToModel(gm,occEdge); } -GEdge *OCCFactory::addCircleArc (GModel *gm, const arcCreationMethod &method, - GVertex *start, - GVertex *end, - const SPoint3 &aPoint) { +GEdge *OCCFactory::addCircleArc(GModel *gm, const arcCreationMethod &method, + GVertex *start, GVertex *end, + const SPoint3 &aPoint) +{ if (!gm->_occ_internals) gm->_occ_internals = new OCC_Internals; - gp_Pnt aP1 (start->x(), start->y(), start->z()); - gp_Pnt aP2 (aPoint.x(), aPoint.y(), aPoint.z()); - gp_Pnt aP3 (end->x(), end->y(), end->z()); + gp_Pnt aP1(start->x(), start->y(), start->z()); + gp_Pnt aP2(aPoint.x(), aPoint.y(), aPoint.z()); + gp_Pnt aP3(end->x(), end->y(), end->z()); TopoDS_Edge occEdge; OCCVertex *occv1 = dynamic_cast<OCCVertex*>(start); @@ -82,7 +82,8 @@ GEdge *OCCFactory::addCircleArc (GModel *gm, const arcCreationMethod &method, if (method == GModelFactory::THREE_POINTS){ GC_MakeArcOfCircle arc(aP1, aP2, aP3); if (occv1 && occv2) - occEdge = BRepBuilderAPI_MakeEdge(arc,occv1->getShape(),occv2->getShape()).Edge(); + occEdge = BRepBuilderAPI_MakeEdge(arc,occv1->getShape(), + occv2->getShape()).Edge(); else occEdge = BRepBuilderAPI_MakeEdge(arc).Edge(); } @@ -95,7 +96,8 @@ GEdge *OCCFactory::addCircleArc (GModel *gm, const arcCreationMethod &method, Handle(Geom_Circle) C = new Geom_Circle(Circ); Handle(Geom_TrimmedCurve) arc = new Geom_TrimmedCurve(C, Alpha1, Alpha2, false); if (occv1 && occv2) - occEdge = BRepBuilderAPI_MakeEdge(arc,occv1->getShape(),occv2->getShape()).Edge(); + occEdge = BRepBuilderAPI_MakeEdge(arc, occv1->getShape(), + occv2->getShape()).Edge(); else occEdge = BRepBuilderAPI_MakeEdge(arc).Edge(); } @@ -135,30 +137,26 @@ GEdge *OCCFactory::addSpline(GModel *gm, const splineType &type, } -GEdge *OCCFactory::addNURBS(GModel *gm, - GVertex *start, GVertex *end, +GEdge *OCCFactory::addNURBS(GModel *gm, GVertex *start, GVertex *end, std::vector<std::vector<double> > points, std::vector<double> knots, std::vector<double> weights, - std::vector<int> mult){ + std::vector<int> mult) +{ try{ if (!gm->_occ_internals) gm->_occ_internals = new OCC_Internals; - - OCCVertex *occv1 = dynamic_cast<OCCVertex*>(start); OCCVertex *occv2 = dynamic_cast<OCCVertex*>(end); int nbControlPoints = points.size() + 2; TColgp_Array1OfPnt ctrlPoints(1, nbControlPoints); - - TColStd_Array1OfReal _knots (1, knots.size()); - TColStd_Array1OfReal _weights (1, weights.size()); - TColStd_Array1OfInteger _mult (1, mult.size()); + TColStd_Array1OfReal _knots(1, knots.size()); + TColStd_Array1OfReal _weights(1, weights.size()); + TColStd_Array1OfInteger _mult(1, mult.size()); - for (int i = 0; i < knots.size(); i++) { _knots.SetValue(i+1, knots[i]); } @@ -172,7 +170,8 @@ GEdge *OCCFactory::addNURBS(GModel *gm, } const int degree = totKnots - nbControlPoints - 1; - printf("creation of a nurbs of degree %d with %d control points\n",degree,nbControlPoints); + printf("creation of a nurbs of degree %d with %d control points\n", + degree,nbControlPoints); int index = 1; ctrlPoints.SetValue(index++, gp_Pnt(start->x(), start->y(), start->z())); @@ -181,13 +180,14 @@ GEdge *OCCFactory::addNURBS(GModel *gm, ctrlPoints.SetValue(index++, aP); } ctrlPoints.SetValue(index++, gp_Pnt(end->x(), end->y(), end->z())); - Handle(Geom_BSplineCurve) NURBS = new Geom_BSplineCurve(ctrlPoints,_weights,_knots,_mult,degree,false); + Handle(Geom_BSplineCurve) NURBS = new Geom_BSplineCurve + (ctrlPoints, _weights, _knots, _mult, degree, false); TopoDS_Edge occEdge; if (occv1 && occv2) occEdge = BRepBuilderAPI_MakeEdge(NURBS,occv1->getShape(),occv2->getShape()).Edge(); else occEdge = BRepBuilderAPI_MakeEdge(NURBS).Edge(); - return gm->_occ_internals->addEdgeToModel(gm,occEdge); + return gm->_occ_internals->addEdgeToModel(gm, occEdge); } catch(Standard_Failure &err){ Msg::Error("%s", err.GetMessageString()); @@ -195,9 +195,10 @@ GEdge *OCCFactory::addNURBS(GModel *gm, return 0; } -GEntity *OCCFactory::revolve (GModel *gm, GEntity* base, - std::vector<double> p1, - std::vector<double> p2, double angle){ +GEntity *OCCFactory::revolve(GModel *gm, GEntity* base, + std::vector<double> p1, + std::vector<double> p2, double angle) +{ if (!gm->_occ_internals) gm->_occ_internals = new OCC_Internals; @@ -228,8 +229,9 @@ GEntity *OCCFactory::revolve (GModel *gm, GEntity* base, return ret; } -GEntity *OCCFactory::extrude (GModel *gm, GEntity* base, - std::vector<double> p1, std::vector<double> p2){ +GEntity *OCCFactory::extrude(GModel *gm, GEntity* base, + std::vector<double> p1, std::vector<double> p2) +{ if (!gm->_occ_internals) gm->_occ_internals = new OCC_Internals; @@ -396,7 +398,9 @@ GEntity *OCCFactory::addBlock(GModel *gm, std::vector<double> p1, return getOCCRegionByNativePtr(gm,TopoDS::Solid(shape)); } -GModel *OCCFactory::computeBooleanUnion (GModel* obj, GModel* tool, int createNewModel){ +GModel *OCCFactory::computeBooleanUnion(GModel* obj, GModel* tool, + int createNewModel) +{ try{ OCC_Internals *occ_obj = obj->getOCCInternals(); OCC_Internals *occ_tool = tool->getOCCInternals(); @@ -409,7 +413,8 @@ GModel *OCCFactory::computeBooleanUnion (GModel* obj, GModel* tool, int createNe temp->_occ_internals->addShapeToLists(occ_obj->getShape()); obj = temp; } - obj->_occ_internals->applyBooleanOperator(occ_tool->getShape(),OCC_Internals::Fuse); + obj->_occ_internals->applyBooleanOperator(occ_tool->getShape(), + OCC_Internals::Fuse); obj->destroy(); obj->_occ_internals->buildLists(); obj->_occ_internals->buildGModel(obj); @@ -421,7 +426,9 @@ GModel *OCCFactory::computeBooleanUnion (GModel* obj, GModel* tool, int createNe return obj; } -GModel *OCCFactory::computeBooleanDifference (GModel* obj, GModel* tool, int createNewModel){ +GModel *OCCFactory::computeBooleanDifference(GModel* obj, GModel* tool, + int createNewModel) +{ try{ OCC_Internals *occ_obj = obj->getOCCInternals(); OCC_Internals *occ_tool = tool->getOCCInternals(); @@ -434,7 +441,8 @@ GModel *OCCFactory::computeBooleanDifference (GModel* obj, GModel* tool, int cre temp->_occ_internals->addShapeToLists(occ_obj->getShape()); obj = temp; } - obj->getOCCInternals()->applyBooleanOperator(occ_tool->getShape(),OCC_Internals::Cut); + obj->getOCCInternals()->applyBooleanOperator(occ_tool->getShape(), + OCC_Internals::Cut); obj->destroy(); obj->_occ_internals->buildLists(); obj->_occ_internals->buildGModel(obj); @@ -445,12 +453,13 @@ GModel *OCCFactory::computeBooleanDifference (GModel* obj, GModel* tool, int cre return obj; } -GModel *OCCFactory::computeBooleanIntersection (GModel* obj, GModel* tool, int createNewModel){ +GModel *OCCFactory::computeBooleanIntersection(GModel* obj, GModel* tool, + int createNewModel) +{ try{ OCC_Internals *occ_obj = obj->getOCCInternals(); OCC_Internals *occ_tool = tool->getOCCInternals(); - if (!occ_obj || !occ_tool)return NULL; if (createNewModel){ @@ -459,7 +468,8 @@ GModel *OCCFactory::computeBooleanIntersection (GModel* obj, GModel* tool, int c temp->_occ_internals->addShapeToLists(occ_obj->getShape()); obj = temp; } - obj->getOCCInternals()->applyBooleanOperator(occ_tool->getShape(),OCC_Internals::Intersection); + obj->getOCCInternals()->applyBooleanOperator(occ_tool->getShape(), + OCC_Internals::Intersection); obj->destroy(); obj->_occ_internals->buildLists(); obj->_occ_internals->buildGModel(obj); @@ -470,7 +480,8 @@ GModel *OCCFactory::computeBooleanIntersection (GModel* obj, GModel* tool, int c return obj; } -void OCCFactory::fillet (GModel *gm, std::vector<int> edges, double radius){ +void OCCFactory::fillet(GModel *gm, std::vector<int> edges, double radius) +{ try{ std::vector<TopoDS_Edge> edgesToFillet; for (int i=0;i<edges.size();i++){ @@ -480,7 +491,7 @@ void OCCFactory::fillet (GModel *gm, std::vector<int> edges, double radius){ if (occed)edgesToFillet.push_back(occed->getTopoDS_Edge()); } } - gm->_occ_internals->Fillet(edgesToFillet,radius); + gm->_occ_internals->fillet(edgesToFillet,radius); gm->destroy(); gm->_occ_internals->buildLists(); gm->_occ_internals->buildGModel(gm); @@ -490,10 +501,12 @@ void OCCFactory::fillet (GModel *gm, std::vector<int> edges, double radius){ } } -void OCCFactory::translate (GModel *gm, std::vector<double> dx, int addToTheModel){ +void OCCFactory::translate(GModel *gm, std::vector<double> dx, int addToTheModel) +{ gp_Trsf transformation; transformation.SetTranslation(gp_Pnt (0,0,0),gp_Pnt (dx[0],dx[1],dx[2])); - BRepBuilderAPI_Transform aTransformation(gm->_occ_internals->getShape(), transformation, Standard_False); + BRepBuilderAPI_Transform aTransformation(gm->_occ_internals->getShape(), + transformation, Standard_False); TopoDS_Shape temp = aTransformation.Shape(); if (!addToTheModel)gm->_occ_internals->loadShape(& temp); else gm->_occ_internals->buildShapeFromLists(temp); @@ -502,7 +515,9 @@ void OCCFactory::translate (GModel *gm, std::vector<double> dx, int addToTheMode gm->_occ_internals->buildGModel(gm); } -void OCCFactory::rotate (GModel *gm, std::vector<double> p1,std::vector<double> p2, double angle, int addToTheModel){ +void OCCFactory::rotate(GModel *gm, std::vector<double> p1,std::vector<double> p2, + double angle, int addToTheModel) +{ const double x1 =p1[0]; const double y1 =p1[1]; const double z1 =p1[2]; @@ -518,7 +533,8 @@ void OCCFactory::rotate (GModel *gm, std::vector<double> p1,std::vector<double> gp_Vec direction (gp_Pnt (x1,y1,z1),gp_Pnt (x2,y2,z2)); gp_Ax1 axisOfRevolution (gp_Pnt (x1,y1,z1),direction); transformation.SetRotation(axisOfRevolution, angle); - BRepBuilderAPI_Transform aTransformation(gm->_occ_internals->getShape(), transformation, Standard_False); + BRepBuilderAPI_Transform aTransformation(gm->_occ_internals->getShape(), + transformation, Standard_False); TopoDS_Shape temp = aTransformation.Shape(); if (!addToTheModel)gm->_occ_internals->loadShape(& temp); else gm->_occ_internals->buildShapeFromLists(temp); @@ -527,6 +543,4 @@ void OCCFactory::rotate (GModel *gm, std::vector<double> p1,std::vector<double> gm->_occ_internals->buildGModel(gm); } - #endif - diff --git a/Geo/GModelFactory.h b/Geo/GModelFactory.h index d58a6748e5b97e746d7fafd28a3d587be98f3415..cad242d0246a03669e6fbff0c72590b7009ebc01 100644 --- a/Geo/GModelFactory.h +++ b/Geo/GModelFactory.h @@ -21,6 +21,7 @@ class GModelFactory { public: GModelFactory (){} virtual ~GModelFactory(){} + // brep primitives enum arcCreationMethod {THREE_POINTS=1, CENTER_START_END=2}; enum splineType {BEZIER=1, BSPLINE=2}; @@ -60,16 +61,19 @@ class GModelFactory { // here, we should give a list of GEdges. Yet, I still can't figure out how // to get those automatically ... wait and see - virtual void fillet (GModel *gm, std::vector<int> edges, double radius) = 0; + virtual void fillet(GModel *gm, std::vector<int> edges, double radius) = 0; // rigid body motions - virtual void translate (GModel *gm, std::vector<double> dx, int addToTheModel) = 0; - virtual void rotate (GModel *gm, std::vector<double> p1,std::vector<double> p2, double angle, int addToTheModel) = 0; + virtual void translate(GModel *gm, std::vector<double> dx, int addToTheModel) = 0; + virtual void rotate(GModel *gm, std::vector<double> p1,std::vector<double> p2, + double angle, int addToTheModel) = 0; - // boolean operators acting on 2 GEntities - virtual GModel * computeBooleanUnion (GModel *obj, GModel*tool, int createNewModel) = 0; - virtual GModel * computeBooleanIntersection (GModel *obj, GModel*tool, int createNewModel) = 0; - virtual GModel * computeBooleanDifference (GModel *obj, GModel*tool, int createNewModel) = 0; + // boolean operators acting on 2 GModels + virtual GModel *computeBooleanUnion(GModel *obj, GModel*tool, int createNewModel) = 0; + virtual GModel *computeBooleanIntersection(GModel *obj, GModel*tool, + int createNewModel) = 0; + virtual GModel *computeBooleanDifference(GModel *obj, GModel*tool, + int createNewModel) = 0; }; #if defined(HAVE_OCC) @@ -79,13 +83,11 @@ class OCCFactory : public GModelFactory { OCCFactory (){} GVertex *addVertex (GModel *gm,double x, double y, double z, double lc); virtual GEdge *addLine (GModel *gm,GVertex *v1, GVertex *v2); - GEdge *addCircleArc (GModel *gm,const arcCreationMethod &method, - GVertex *start, - GVertex *end, + GEdge *addCircleArc (GModel *gm,const arcCreationMethod &method, + GVertex *start, GVertex *end, const SPoint3 &aPoint); GEdge *addSpline (GModel *gm,const splineType &type, - GVertex *start, - GVertex *end, + GVertex *start, GVertex *end, std::vector<std::vector<double> > controlPoints); GEdge *addNURBS(GModel *gm, GVertex *start, GVertex *end, @@ -93,26 +95,25 @@ class OCCFactory : public GModelFactory { std::vector<double> knots, std::vector<double> weights, std::vector<int> multiplicity); - - GEntity* revolve (GModel *gm, GEntity*,std::vector<double> p1,std::vector<double> p2, double angle); - GEntity* extrude (GModel *gm, GEntity*,std::vector<double> p1,std::vector<double> p2); - - GEntity * addSphere (GModel *gm,double cx, double cy, double cz, double radius); - GEntity * addCylinder (GModel *gm,std::vector<double> p1, std::vector<double> p2, - double radius); - GEntity * addTorus (GModel *gm,std::vector<double> p1, std::vector<double> p2, + GEntity *revolve(GModel *gm, GEntity*,std::vector<double> p1, + std::vector<double> p2, double angle); + GEntity *extrude (GModel *gm, GEntity*,std::vector<double> p1, + std::vector<double> p2); + GEntity *addSphere(GModel *gm,double cx, double cy, double cz, double radius); + GEntity *addCylinder(GModel *gm,std::vector<double> p1, std::vector<double> p2, + double radius); + GEntity *addTorus(GModel *gm,std::vector<double> p1, std::vector<double> p2, double radius1, double radius2); - GEntity * addBlock (GModel *gm,std::vector<double> p1, std::vector<double> p2); - GEntity * addCone (GModel *gm,std::vector<double> p1, std::vector<double> p2, double radius1, double radius2); - // rigid body motions - void translate (GModel *gm, std::vector<double> dx, int addToTheModel); - void rotate (GModel *gm, std::vector<double> p1,std::vector<double> p2, double angle, int addToTheModel); - // booleans - GModel * computeBooleanUnion (GModel *obj, GModel*tool, int createNewModel); - GModel * computeBooleanIntersection (GModel *obj, GModel*tool, int createNewModel); - GModel * computeBooleanDifference (GModel *obj, GModel*tool, int createNewModel); - // advanced - void fillet (GModel *gm, std::vector<int> edges, double radius); + GEntity *addBlock(GModel *gm,std::vector<double> p1, std::vector<double> p2); + GEntity *addCone(GModel *gm,std::vector<double> p1, std::vector<double> p2, + double radius1, double radius2); + void translate(GModel *gm, std::vector<double> dx, int addToTheModel); + void rotate(GModel *gm, std::vector<double> p1,std::vector<double> p2, + double angle, int addToTheModel); + GModel *computeBooleanUnion(GModel *obj, GModel *tool, int createNewModel); + GModel *computeBooleanIntersection(GModel *obj, GModel *tool, int createNewModel); + GModel *computeBooleanDifference(GModel *obj, GModel *tool, int createNewModel); + void fillet(GModel *gm, std::vector<int> edges, double radius); }; #endif diff --git a/Geo/GModelIO_ACIS.cpp b/Geo/GModelIO_ACIS.cpp index 7052d0e7d57c275e9a9c1b0511321b67ca88a279..3c0421bed407bdb7ae00450163e3468212289237 100644 --- a/Geo/GModelIO_ACIS.cpp +++ b/Geo/GModelIO_ACIS.cpp @@ -1,3 +1,8 @@ +// Gmsh - Copyright (C) 1997-2010 C. Geuzaine, J.-F. Remacle +// +// See the LICENSE.txt file for license information. Please report all +// bugs and problems to <gmsh@geuz.org>. + #include "GmshConfig.h" #include "GModel.h" #include "GmshMessage.h" @@ -6,9 +11,6 @@ #include "ACISEdge.h" #if defined(HAVE_ACIS) -#define MacX 1 -#define mac 1 -#define ANSI 1 #include <acis.hxx> #include <base.hxx> @@ -21,66 +23,71 @@ #include <lists.hxx> #include <acistype.hxx> - class ACIS_Internals { public: ENTITY_LIST entities; ACIS_Internals(); ~ACIS_Internals(); - void loadSAT ( std::string fileName, GModel*); - void addVertices (GModel *gm, ENTITY_LIST &l); - void addEdges (GModel *gm, ENTITY_LIST &l); - // void addFaces (GModel *gm, ENTITY_LIST &l); + void loadSAT(std::string fileName, GModel*); + void addVertices(GModel *gm, ENTITY_LIST &l); + void addEdges(GModel *gm, ENTITY_LIST &l); + // void addFaces(GModel *gm, ENTITY_LIST &l); }; -ACIS_Internals::ACIS_Internals() { - // put your acis unlock string here ... +ACIS_Internals::ACIS_Internals() +{ + // put your acis unlock string here... #include "ACISLICENSE.h" - spa_unlock_result out = spa_unlock_products( unlock_str ); - + spa_unlock_result out = spa_unlock_products(unlock_str); outcome prout = api_start_modeller(0); if (!prout.ok()){ Msg::Error("Unable to start ACIS"); } } -ACIS_Internals::~ACIS_Internals(){ + +ACIS_Internals::~ACIS_Internals() +{ outcome prout = api_stop_modeller(); if (!prout.ok()){ Msg::Error("Unable to stop ACIS"); } } -void ACIS_Internals :: addVertices (GModel *gm, ENTITY_LIST &l){ +void ACIS_Internals::addVertices (GModel *gm, ENTITY_LIST &l) +{ l.init(); ENTITY *e; while(e = l.next()){ VERTEX *av = dynamic_cast<VERTEX*>(e); if (av){ - GVertex *v = getACISVertexByNativePtr(gm,av); + GVertex *v = getACISVertexByNativePtr(gm, av); if (!v) - gm->add(new ACISVertex (gm,gm->maxVertexNum()+1,av)); + gm->add(new ACISVertex (gm,gm->maxVertexNum() + 1, av)); } } } -void ACIS_Internals :: addEdges (GModel *gm, ENTITY_LIST &l){ +void ACIS_Internals::addEdges (GModel *gm, ENTITY_LIST &l) +{ l.init(); ENTITY *e; while(e = l.next()){ EDGE *av = dynamic_cast<EDGE*>(e); if (av){ - GEdge *v = getACISEdgeByNativePtr(gm,av); + GEdge *v = getACISEdgeByNativePtr(gm, av); if (!v){ - GVertex *v1 = getACISVertexByNativePtr(gm,av->start()); - GVertex *v2 = getACISVertexByNativePtr(gm,av->end()); - gm->add(new ACISEdge(gm,av,gm->maxEdgeNum()+1,v1,v2)); + GVertex *v1 = getACISVertexByNativePtr(gm, av->start()); + GVertex *v2 = getACISVertexByNativePtr(gm, av->end()); + gm->add(new ACISEdge(gm,av,gm->maxEdgeNum() + 1, v1, v2)); } } } } + /* -void ACIS_Internals :: addFaces (GModel *gm, ENTITY_LIST &l){ +void ACIS_Internals::addFaces (GModel *gm, ENTITY_LIST &l) +{ l.init(); ENTITY *e; while(e = l.next()){ @@ -97,7 +104,8 @@ void ACIS_Internals :: addFaces (GModel *gm, ENTITY_LIST &l){ } */ -void ACIS_Internals::loadSAT (std::string fileName, GModel *gm) { +void ACIS_Internals::loadSAT(std::string fileName, GModel *gm) +{ FILE *f = fopen (fileName.c_str(), "r"); if (!f){ return; @@ -139,11 +147,14 @@ int GModel::readACISSAT(const std::string &fn) _acis_internals->loadSAT(fn,this); return 1; } + #else + int GModel::readACISSAT(const std::string &fn) { Msg::Error("Gmsh must be compiled with ACIS support to load '%s'", fn.c_str()); return 0; } + #endif diff --git a/Geo/GModelIO_OCC.cpp b/Geo/GModelIO_OCC.cpp index fef6327e6c534ca3c57be61b760a97d59ea97905..05dac368959d110bf5912c74181f19d948a9b2ed 100644 --- a/Geo/GModelIO_OCC.cpp +++ b/Geo/GModelIO_OCC.cpp @@ -743,7 +743,7 @@ void OCC_Internals::applyBooleanOperator(TopoDS_Shape tool, const BooleanOperato } } -void OCC_Internals::Fillet(std::vector<TopoDS_Edge> &edgesToFillet, +void OCC_Internals::fillet(std::vector<TopoDS_Edge> &edgesToFillet, double Radius) { // create a tool for fillet diff --git a/Geo/GModelIO_OCC.h b/Geo/GModelIO_OCC.h index d986ec8a94f00d3db39bcf3dca85ce0a4a6a000e..d649d33f70896bdc110c4db4e8747203faaf9c46 100644 --- a/Geo/GModelIO_OCC.h +++ b/Geo/GModelIO_OCC.h @@ -43,22 +43,11 @@ class OCC_Internals { void loadIGES(const char *); void loadShape(const TopoDS_Shape *); void buildGModel(GModel *gm); - GVertex * addVertexToModel(GModel *model, TopoDS_Vertex v); - GEdge * addEdgeToModel (GModel *model, TopoDS_Edge e); - GFace * addFaceToModel (GModel *model, TopoDS_Face f); - GRegion * addRegionToModel (GModel *model, TopoDS_Solid r); - - void Box(const SPoint3 &p1, const SPoint3 &p2, const BooleanOperator &op); - void Sphere(const SPoint3 ¢er, const double &radius, const BooleanOperator &op); - void Cylinder(const SPoint3 &bottom_center, const SVector3 &dir, double R, double H, - const BooleanOperator &op); - void Cone(const SPoint3 &bottom_center, const SVector3 &dir, double R1, double R2, - double H, const BooleanOperator &op); - void Torus(const SPoint3 &bottom_center, const SVector3 &dir, double R1, double R2, - const BooleanOperator &op); - void Torus(const SPoint3 &bottom_center, const SVector3 &dir, double R1, double R2, - double angle, const BooleanOperator &op); - void Fillet(std::vector<TopoDS_Edge> &shapes, double radius); + GVertex *addVertexToModel(GModel *model, TopoDS_Vertex v); + GEdge *addEdgeToModel(GModel *model, TopoDS_Edge e); + GFace *addFaceToModel(GModel *model, TopoDS_Face f); + GRegion *addRegionToModel(GModel *model, TopoDS_Solid r); + void fillet(std::vector<TopoDS_Edge> &shapes, double radius); void applyBooleanOperator(TopoDS_Shape tool, const BooleanOperator &op); };