Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
a743e275
Commit
a743e275
authored
8 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
OCC translate
parent
209efcf2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Geo/GModelIO_OCC.cpp
+30
-9
30 additions, 9 deletions
Geo/GModelIO_OCC.cpp
Geo/GModelIO_OCC.h
+12
-5
12 additions, 5 deletions
Geo/GModelIO_OCC.h
Parser/Gmsh.tab.cpp
+428
-421
428 additions, 421 deletions
Parser/Gmsh.tab.cpp
Parser/Gmsh.y
+8
-1
8 additions, 1 deletion
Parser/Gmsh.y
with
478 additions
and
436 deletions
Geo/GModelIO_OCC.cpp
+
30
−
9
View file @
a743e275
...
@@ -654,12 +654,12 @@ void OCC_Internals::getBoundary(std::vector<int> inTags[4],
...
@@ -654,12 +654,12 @@ void OCC_Internals::getBoundary(std::vector<int> inTags[4],
bool
combined
)
bool
combined
)
{
{
for
(
unsigned
int
i
=
0
;
i
<
inTags
[
3
].
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
inTags
[
3
].
size
();
i
++
){
TopExp_Explorer
exp0
,
exp1
;
if
(
!
_tagSolid
.
IsBound
(
inTags
[
3
][
i
])){
if
(
!
_tagSolid
.
IsBound
(
inTags
[
3
][
i
])){
Msg
::
Error
(
"Unknown OpenCASCADE region with tag %d"
,
inTags
[
3
][
i
]);
Msg
::
Error
(
"Unknown OpenCASCADE region with tag %d"
,
inTags
[
3
][
i
]);
return
;
return
;
}
}
TopoDS_Solid
solid
=
TopoDS
::
Solid
(
_tagSolid
.
Find
(
inTags
[
3
][
i
]));
TopoDS_Solid
solid
=
TopoDS
::
Solid
(
_tagSolid
.
Find
(
inTags
[
3
][
i
]));
TopExp_Explorer
exp0
,
exp1
;
for
(
exp0
.
Init
(
solid
,
TopAbs_SHELL
);
exp0
.
More
();
exp0
.
Next
()){
for
(
exp0
.
Init
(
solid
,
TopAbs_SHELL
);
exp0
.
More
();
exp0
.
Next
()){
TopoDS_Shell
shell
=
TopoDS
::
Shell
(
exp0
.
Current
());
TopoDS_Shell
shell
=
TopoDS
::
Shell
(
exp0
.
Current
());
for
(
exp1
.
Init
(
shell
,
TopAbs_FACE
);
exp1
.
More
();
exp1
.
Next
()){
for
(
exp1
.
Init
(
shell
,
TopAbs_FACE
);
exp1
.
More
();
exp1
.
Next
()){
...
@@ -687,17 +687,38 @@ void OCC_Internals::getBoundary(std::vector<int> inTags[4],
...
@@ -687,17 +687,38 @@ void OCC_Internals::getBoundary(std::vector<int> inTags[4],
}
}
}
}
/*
void
OCC_Internals
::
translate
(
std
::
vector
<
int
>
inTags
[
4
],
void OCC_Internals::translate(std::std::vector<double> dx, int addToTheModel)
double
dx
,
double
dy
,
double
dz
)
{
gp_Trsf
t
;
t
.
SetTranslation
(
gp_Pnt
(
0
,
0
,
0
),
gp_Pnt
(
dx
,
dy
,
dz
));
BRepBuilderAPI_Transform
tfo
(
t
);
for
(
unsigned
int
i
=
0
;
i
<
inTags
[
3
].
size
();
i
++
){
if
(
!
_tagSolid
.
IsBound
(
inTags
[
3
][
i
])){
Msg
::
Error
(
"Unknown OpenCASCADE region with tag %d"
,
inTags
[
3
][
i
]);
return
;
}
TopoDS_Solid
solid
=
TopoDS
::
Solid
(
_tagSolid
.
Find
(
inTags
[
3
][
i
]));
tfo
.
Perform
(
solid
,
Standard_False
);
if
(
!
tfo
.
IsDone
()){
Msg
::
Error
(
"Could not apply translation"
);
return
;
}
TopoDS_Solid
result
=
TopoDS
::
Solid
(
tfo
.
Shape
());
bind
(
result
,
inTags
[
3
][
i
]);
}
if
(
inTags
[
2
].
size
()
||
inTags
[
1
].
size
()
||
inTags
[
0
].
size
()){
Msg
::
Error
(
"OCC TODO translation of surfaces, curves and vertices"
);
}
}
void
OCC_Internals
::
copy
(
std
::
vector
<
int
>
inTags
[
4
],
std
::
vector
<
int
>
outTags
[
4
])
{
{
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);
TopoDS_Shape temp = aTransformation.Shape();
}
}
*/
void
OCC_Internals
::
importShapes
(
const
std
::
string
&
fileName
,
void
OCC_Internals
::
importShapes
(
const
std
::
string
&
fileName
,
std
::
vector
<
int
>
outTags
[
4
])
std
::
vector
<
int
>
outTags
[
4
])
...
...
This diff is collapsed.
Click to expand it.
Geo/GModelIO_OCC.h
+
12
−
5
View file @
a743e275
...
@@ -71,6 +71,10 @@ class OCC_Internals {
...
@@ -71,6 +71,10 @@ class OCC_Internals {
{
{
std
::
vector
<
int
>
tags
[
4
];
importShapes
(
s
,
tags
);
std
::
vector
<
int
>
tags
[
4
];
importShapes
(
s
,
tags
);
}
}
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
);
// *** FIXME end of stuff that will be removed ***
// *** FIXME end of stuff that will be removed ***
public
:
public
:
...
@@ -125,6 +129,10 @@ class OCC_Internals {
...
@@ -125,6 +129,10 @@ class OCC_Internals {
void
getBoundary
(
std
::
vector
<
int
>
inTags
[
4
],
std
::
vector
<
int
>
outTags
[
4
],
void
getBoundary
(
std
::
vector
<
int
>
inTags
[
4
],
std
::
vector
<
int
>
outTags
[
4
],
bool
combined
=
false
);
bool
combined
=
false
);
// apply transformations
void
translate
(
std
::
vector
<
int
>
inTags
[
4
],
double
dx
,
double
dy
,
double
dz
);
void
copy
(
std
::
vector
<
int
>
inTags
[
4
],
std
::
vector
<
int
>
outTags
[
4
]);
// import shapes from file
// import shapes from file
void
importShapes
(
const
std
::
string
&
fileName
,
std
::
vector
<
int
>
outTags
[
4
]);
void
importShapes
(
const
std
::
string
&
fileName
,
std
::
vector
<
int
>
outTags
[
4
]);
...
@@ -134,17 +142,14 @@ class OCC_Internals {
...
@@ -134,17 +142,14 @@ class OCC_Internals {
// export all tagged shapes to file
// export all tagged shapes to file
void
exportShapes
(
const
std
::
string
&
fileName
);
void
exportShapes
(
const
std
::
string
&
fileName
);
// synchronize
all shapes in maps
with the given GModel
// synchronize
internal CAD data
with the given GModel
void
synchronize
(
GModel
*
model
);
void
synchronize
(
GModel
*
model
);
// get the GEntity corresponding to an OCC shape
GVertex
*
getOCCVertexByNativePtr
(
GModel
*
model
,
TopoDS_Vertex
toFind
);
GVertex
*
getOCCVertexByNativePtr
(
GModel
*
model
,
TopoDS_Vertex
toFind
);
GEdge
*
getOCCEdgeByNativePtr
(
GModel
*
model
,
TopoDS_Edge
toFind
);
GEdge
*
getOCCEdgeByNativePtr
(
GModel
*
model
,
TopoDS_Edge
toFind
);
GFace
*
getOCCFaceByNativePtr
(
GModel
*
model
,
TopoDS_Face
toFind
);
GFace
*
getOCCFaceByNativePtr
(
GModel
*
model
,
TopoDS_Face
toFind
);
GRegion
*
getOCCRegionByNativePtr
(
GModel
*
model
,
TopoDS_Solid
toFind
);
GRegion
*
getOCCRegionByNativePtr
(
GModel
*
model
,
TopoDS_Solid
toFind
);
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
);
};
};
#else
#else
...
@@ -174,6 +179,8 @@ public:
...
@@ -174,6 +179,8 @@ public:
bool
removeTool
=
true
){}
bool
removeTool
=
true
){}
void
getBoundary
(
std
::
vector
<
int
>
inTags
[
4
],
std
::
vector
<
int
>
outTags
[
4
],
void
getBoundary
(
std
::
vector
<
int
>
inTags
[
4
],
std
::
vector
<
int
>
outTags
[
4
],
bool
combined
=
false
){}
bool
combined
=
false
){}
void
translate
(
std
::
vector
<
int
>
inTags
[
4
],
double
dx
,
double
dy
,
double
dz
){}
void
copy
(
std
::
vector
<
int
>
inTags
[
4
],
std
::
vector
<
int
>
outTags
[
4
]){}
void
importShapes
(
const
std
::
string
&
fileName
,
std
::
vector
<
int
>
outTags
[
4
]){}
void
importShapes
(
const
std
::
string
&
fileName
,
std
::
vector
<
int
>
outTags
[
4
]){}
void
exportShapes
(
const
std
::
string
&
fileName
){}
void
exportShapes
(
const
std
::
string
&
fileName
){}
void
synchronize
(
GModel
*
model
){}
void
synchronize
(
GModel
*
model
){}
...
...
This diff is collapsed.
Click to expand it.
Parser/Gmsh.tab.cpp
+
428
−
421
View file @
a743e275
This diff is collapsed.
Click to expand it.
Parser/Gmsh.y
+
8
−
1
View file @
a743e275
...
@@ -2554,7 +2554,14 @@ Transform :
...
@@ -2554,7 +2554,14 @@ Transform :
tTranslate VExpr '{' MultipleShape '}'
tTranslate VExpr '{' MultipleShape '}'
{
{
if(factory == "OpenCASCADE" && GModel::current()->getOCCInternals()){
if(factory == "OpenCASCADE" && GModel::current()->getOCCInternals()){
Msg::Error("TODO OCC Translate");
std::vector<int> in[4];
Shape TheShape;
for(int i = 0; i < List_Nbr($4); i++){
List_Read($4, i, &TheShape);
int dim = TheShape.Type / 100 - 1;
if(dim >= 0 && dim <= 3) in[dim].push_back(TheShape.Num);
}
GModel::current()->getOCCInternals()->translate(in, $2[0], $2[1], $2[2]);
}
}
else{
else{
TranslateShapes($2[0], $2[1], $2[2], $4);
TranslateShapes($2[0], $2[1], $2[2], $4);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment