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

OCC Duplicata

parent c979abf9
No related branches found
No related tags found
No related merge requests found
...@@ -756,7 +756,24 @@ void OCC_Internals::rotate(std::vector<int> inTags[4], ...@@ -756,7 +756,24 @@ void OCC_Internals::rotate(std::vector<int> inTags[4],
void OCC_Internals::copy(std::vector<int> inTags[4], std::vector<int> outTags[4]) void OCC_Internals::copy(std::vector<int> inTags[4], std::vector<int> outTags[4])
{ {
for(unsigned int dim = 0; dim < 4; dim++){
for(unsigned int i = 0; i < inTags[dim].size(); i++){
int tag = inTags[dim][i];
if(!isBound(dim, tag)){
Msg::Error("Unknown OpenCASCADE entity with tag %d", tag);
return;
}
TopoDS_Shape result = BRepBuilderAPI_Copy(find(dim, tag)).Shape();
int newtag = getMaxTag(dim) + 1;
switch(dim){
case 0: bind(TopoDS::Vertex(result), newtag); break;
case 1: bind(TopoDS::Edge(result), newtag); break;
case 2: bind(TopoDS::Face(result), newtag); break;
case 3: bind(TopoDS::Solid(result), newtag); break;
}
outTags[dim].push_back(newtag);
}
}
} }
void OCC_Internals::importShapes(const std::string &fileName, void OCC_Internals::importShapes(const std::string &fileName,
......
This diff is collapsed.
...@@ -2620,18 +2620,34 @@ Transform : ...@@ -2620,18 +2620,34 @@ Transform :
{ {
$$ = List_Create(3, 3, sizeof(Shape)); $$ = List_Create(3, 3, sizeof(Shape));
if(!strcmp($1, "Duplicata")){ if(!strcmp($1, "Duplicata")){
for(int i = 0; i < List_Nbr($3); i++){ if(factory == "OpenCASCADE" && GModel::current()->getOCCInternals()){
std::vector<int> in[4], out[4];
Shape TheShape; Shape TheShape;
for(int i = 0; i < List_Nbr($3); i++){
List_Read($3, i, &TheShape); List_Read($3, i, &TheShape);
if(factory == "OpenCASCADE" && GModel::current()->getOCCInternals()){ int dim = TheShape.Type / 100 - 1;
Msg::Error("TODO OCC Copy"); if(dim >= 0 && dim <= 3) in[dim].push_back(TheShape.Num);
}
GModel::current()->getOCCInternals()->copy(in, out);
for(int dim = 0; dim < 4; dim++){
TheShape.Type = (dim == 3) ? MSH_VOLUME_FROM_GMODEL :
(dim == 2) ? MSH_SURF_FROM_GMODEL :
(dim == 1) ? MSH_SEGM_FROM_GMODEL : MSH_POINT_FROM_GMODEL;
for(unsigned int i = 0; i < out[dim].size(); i++){
TheShape.Num = out[dim][i];
List_Add($$, &TheShape);
}
}
} }
else{ else{
for(int i = 0; i < List_Nbr($3); i++){
Shape TheShape;
List_Read($3, i, &TheShape);
CopyShape(TheShape.Type, TheShape.Num, &TheShape.Num); CopyShape(TheShape.Type, TheShape.Num, &TheShape.Num);
}
List_Add($$, &TheShape); List_Add($$, &TheShape);
} }
} }
}
else if(!strcmp($1, "Boundary") || !strcmp($1, "CombinedBoundary")){ else if(!strcmp($1, "Boundary") || !strcmp($1, "CombinedBoundary")){
if(factory == "OpenCASCADE" && GModel::current()->getOCCInternals()){ if(factory == "OpenCASCADE" && GModel::current()->getOCCInternals()){
std::vector<int> in[4], out[4]; std::vector<int> in[4], out[4];
......
...@@ -27,3 +27,5 @@ Rotate { {1,0,0}, {0,0,0}, Pi/3 } { Volume{1}; } ...@@ -27,3 +27,5 @@ Rotate { {1,0,0}, {0,0,0}, Pi/3 } { Volume{1}; }
Rotate { {0,1,0}, {0,0,0}, Pi/3 } { Volume{1}; } Rotate { {0,1,0}, {0,0,0}, Pi/3 } { Volume{1}; }
f() = BooleanFragments { Volume{1}; Delete; }{ Volume{2}; Delete; }; f() = BooleanFragments { Volume{1}; Delete; }{ Volume{2}; Delete; };
Translate{5,0.2,0.2}{ Duplicata{ Volume{1}; } }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment