Commit b119f711 authored by Christophe Geuzaine's avatar Christophe Geuzaine

point constrainsts for SurfaceFilling

parent e0abd072
Pipeline #1201 failed with stage
in 35 minutes 29 seconds
......@@ -1398,7 +1398,10 @@ bool OCC_Internals::addPlaneSurface(int &tag, const std::vector<int> &wireTags)
return true;
}
bool OCC_Internals::addSurfaceFilling(int &tag, int wireTag)
bool OCC_Internals::addSurfaceFilling(int &tag, int wireTag,
const std::vector<int> &vertexTags,
const std::vector<int> &faceTags,
const std::vector<int> &faceContinuity)
{
if(tag >= 0 && _tagFace.IsBound(tag)){
Msg::Error("OpenCASCADE face with tag %d already exists", tag);
......@@ -1408,18 +1411,41 @@ bool OCC_Internals::addSurfaceFilling(int &tag, int wireTag)
TopoDS_Face result;
try{
BRepOffsetAPI_MakeFilling f;
// add edge constraints
// bounding edge constraints
if(!_tagWire.IsBound(wireTag)){
Msg::Error("Unknown OpenCASCADE line loop with tag %d", wireTag);
return false;
}
TopoDS_Wire wire = TopoDS::Wire(_tagWire.Find(wireTag));
TopExp_Explorer exp0;
int i = 0;
for(exp0.Init(wire, TopAbs_EDGE); exp0.More(); exp0.Next()){
TopoDS_Edge edge = TopoDS::Edge(exp0.Current());
f.Add(edge, GeomAbs_C0);
if(i < faceTags.size()){ // associated face constraint (does not seem to work...)
if(!_tagFace.IsBound(faceTags[i])){
Msg::Error("Unknown OpenCASCADE face with tag %d", faceTags[i]);
return false;
}
TopoDS_Face face = TopoDS::Face(_tagFace.Find(faceTags[i]));
if(i < faceContinuity.size() && faceContinuity[i] == 2)
f.Add(edge, face, GeomAbs_G2);
else
f.Add(edge, face, GeomAbs_G1);
}
else{
f.Add(edge, GeomAbs_C0);
}
i++;
}
// point constraints
for(unsigned int i = 0; i < vertexTags.size(); i++){
if(!_tagVertex.IsBound(vertexTags[i])){
Msg::Error("Unknown OpenCASCADE vertex with tag %d", vertexTags[i]);
return false;
}
TopoDS_Vertex vertex = TopoDS::Vertex(_tagVertex.Find(vertexTags[i]));
f.Add(BRep_Tool::Pnt(vertex));
}
// TODO: add optional point constraints using f.Add(gp_Pnt(x, y, z);
f.Build();
if(!f.IsDone()){
Msg::Error("Could not build surface filling");
......
......@@ -196,7 +196,10 @@ class OCC_Internals {
double dx, double dy, double roundedRadius = 0.);
bool addDisk(int &tag, double xc, double yc, double zc, double rx, double ry);
bool addPlaneSurface(int &tag, const std::vector<int> &wireTags);
bool addSurfaceFilling(int &tag, int wireTag);
bool addSurfaceFilling(int &tag, int wireTag,
const std::vector<int> &vertexTags = std::vector<int>(),
const std::vector<int> &faceTags = std::vector<int>(),
const std::vector<int> &faceContinuity = std::vector<int>());
bool addSurfaceLoop(int &tag, const std::vector<int> &faceTags);
bool addVolume(int &tag, const std::vector<int> &shellTags);
bool addSphere(int &tag, double xc, double yc, double zc, double radius,
......@@ -430,7 +433,10 @@ public:
{
return _error("add plane surface");
}
bool addSurfaceFilling(int &tag, int wireTag)
bool addSurfaceFilling(int &tag, int wireTag,
const std::vector<int> &vertexTags = std::vector<int>(),
const std::vector<int> &faceTags = std::vector<int>(),
const std::vector<int> &faceContinuity = std::vector<int>())
{
return _error("add surface filling");
}
......
......@@ -149,7 +149,6 @@ Call return tCall;
Catenary return tCatenary;
CatmullRom return tSpline;
Ceil return tCeil;
Chamfer return tChamfer;
Characteristic return tCharacteristic;
Circle return tCircle;
CodeName return tCodeName;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment