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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
029b6ef3
Commit
029b6ef3
authored
17 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
importOCCShape
parent
f426ce95
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Geo/GModel.h
+1
-0
1 addition, 0 deletions
Geo/GModel.h
Geo/GModelIO_OCC.cpp
+50
-30
50 additions, 30 deletions
Geo/GModelIO_OCC.cpp
Geo/GModelIO_OCC.h
+16
-10
16 additions, 10 deletions
Geo/GModelIO_OCC.h
Geo/OCCFace.cpp
+2
-2
2 additions, 2 deletions
Geo/OCCFace.cpp
with
69 additions
and
42 deletions
Geo/GModel.h
+
1
−
0
View file @
029b6ef3
...
@@ -240,6 +240,7 @@ class GModel
...
@@ -240,6 +240,7 @@ class GModel
int
readOCCBREP
(
const
std
::
string
&
name
);
int
readOCCBREP
(
const
std
::
string
&
name
);
int
readOCCIGES
(
const
std
::
string
&
name
);
int
readOCCIGES
(
const
std
::
string
&
name
);
int
readOCCSTEP
(
const
std
::
string
&
name
);
int
readOCCSTEP
(
const
std
::
string
&
name
);
int
importOCCShape
(
const
void
*
shape
,
const
void
*
options
=
0
);
// Gmsh mesh file format
// Gmsh mesh file format
int
readMSH
(
const
std
::
string
&
name
);
int
readMSH
(
const
std
::
string
&
name
);
...
...
This diff is collapsed.
Click to expand it.
Geo/GModelIO_OCC.cpp
+
50
−
30
View file @
029b6ef3
// $Id: GModelIO_OCC.cpp,v 1.3
2
2008-05-
04 08:31:13
geuzaine Exp $
// $Id: GModelIO_OCC.cpp,v 1.3
3
2008-05-
25 07:10:57
geuzaine Exp $
//
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -189,7 +189,7 @@ void OCC_Internals::buildLists()
...
@@ -189,7 +189,7 @@ void OCC_Internals::buildLists()
}
}
void
OCC_Internals
::
H
ealGeometry
(
double
tolerance
,
bool
fixsmalledges
,
void
OCC_Internals
::
h
ealGeometry
(
double
tolerance
,
bool
fixsmalledges
,
bool
fixspotstripfaces
,
bool
sewfaces
,
bool
fixspotstripfaces
,
bool
sewfaces
,
bool
makesolids
)
bool
makesolids
)
{
{
...
@@ -348,7 +348,6 @@ void OCC_Internals::HealGeometry(double tolerance, bool fixsmalledges,
...
@@ -348,7 +348,6 @@ void OCC_Internals::HealGeometry(double tolerance, bool fixsmalledges,
Msg
::
Info
(
" not possible"
);
Msg
::
Info
(
" not possible"
);
}
}
}
}
buildLists
();
}
}
void
OCC_Internals
::
loadBREP
(
const
char
*
fn
)
void
OCC_Internals
::
loadBREP
(
const
char
*
fn
)
...
@@ -356,12 +355,12 @@ void OCC_Internals::loadBREP(const char *fn)
...
@@ -356,12 +355,12 @@ void OCC_Internals::loadBREP(const char *fn)
BRep_Builder
aBuilder
;
BRep_Builder
aBuilder
;
BRepTools
::
Read
(
shape
,
(
char
*
)
fn
,
aBuilder
);
BRepTools
::
Read
(
shape
,
(
char
*
)
fn
,
aBuilder
);
BRepTools
::
Clean
(
shape
);
BRepTools
::
Clean
(
shape
);
buildLists
();
healGeometry
(
CTX
.
geom
.
tolerance
,
HealGeometry
(
CTX
.
geom
.
tolerance
,
CTX
.
geom
.
occ_fix_small_edges
,
CTX
.
geom
.
occ_fix_small_edges
,
CTX
.
geom
.
occ_fix_small_faces
,
CTX
.
geom
.
occ_fix_small_faces
,
CTX
.
geom
.
occ_sew_faces
);
CTX
.
geom
.
occ_sew_faces
);
BRepTools
::
Clean
(
shape
);
BRepTools
::
Clean
(
shape
);
buildLists
();
}
}
void
OCC_Internals
::
loadSTEP
(
const
char
*
fn
)
void
OCC_Internals
::
loadSTEP
(
const
char
*
fn
)
...
@@ -372,12 +371,12 @@ void OCC_Internals::loadSTEP(const char *fn)
...
@@ -372,12 +371,12 @@ void OCC_Internals::loadSTEP(const char *fn)
reader
.
TransferRoots
();
reader
.
TransferRoots
();
shape
=
reader
.
OneShape
();
shape
=
reader
.
OneShape
();
BRepTools
::
Clean
(
shape
);
BRepTools
::
Clean
(
shape
);
buildLists
();
healGeometry
(
CTX
.
geom
.
tolerance
,
HealGeometry
(
CTX
.
geom
.
tolerance
,
CTX
.
geom
.
occ_fix_small_edges
,
CTX
.
geom
.
occ_fix_small_edges
,
CTX
.
geom
.
occ_fix_small_faces
,
CTX
.
geom
.
occ_fix_small_faces
,
CTX
.
geom
.
occ_sew_faces
);
CTX
.
geom
.
occ_sew_faces
);
BRepTools
::
Clean
(
shape
);
BRepTools
::
Clean
(
shape
);
buildLists
();
}
}
void
OCC_Internals
::
loadIGES
(
const
char
*
fn
)
void
OCC_Internals
::
loadIGES
(
const
char
*
fn
)
...
@@ -388,12 +387,24 @@ void OCC_Internals::loadIGES(const char *fn)
...
@@ -388,12 +387,24 @@ void OCC_Internals::loadIGES(const char *fn)
reader
.
TransferRoots
();
reader
.
TransferRoots
();
shape
=
reader
.
OneShape
();
shape
=
reader
.
OneShape
();
BRepTools
::
Clean
(
shape
);
BRepTools
::
Clean
(
shape
);
healGeometry
(
CTX
.
geom
.
tolerance
,
CTX
.
geom
.
occ_fix_small_edges
,
CTX
.
geom
.
occ_fix_small_faces
,
CTX
.
geom
.
occ_sew_faces
);
BRepTools
::
Clean
(
shape
);
buildLists
();
buildLists
();
HealGeometry
(
CTX
.
geom
.
tolerance
,
}
void
OCC_Internals
::
loadShape
(
const
TopoDS_Shape
*
s
)
{
shape
=
*
s
;
BRepTools
::
Clean
(
shape
);
healGeometry
(
CTX
.
geom
.
tolerance
,
CTX
.
geom
.
occ_fix_small_edges
,
CTX
.
geom
.
occ_fix_small_edges
,
CTX
.
geom
.
occ_fix_small_faces
,
CTX
.
geom
.
occ_fix_small_faces
,
CTX
.
geom
.
occ_sew_faces
);
CTX
.
geom
.
occ_sew_faces
);
BRepTools
::
Clean
(
shape
);
BRepTools
::
Clean
(
shape
);
buildLists
();
}
}
void
OCC_Internals
::
buildGModel
(
GModel
*
model
)
void
OCC_Internals
::
buildGModel
(
GModel
*
model
)
...
@@ -437,12 +448,12 @@ void GModel::_deleteOCCInternals()
...
@@ -437,12 +448,12 @@ void GModel::_deleteOCCInternals()
_occ_internals
=
0
;
_occ_internals
=
0
;
}
}
int
GModel
::
readOCC
ST
EP
(
const
std
::
string
&
fn
)
int
GModel
::
readOCC
BR
EP
(
const
std
::
string
&
fn
)
{
{
_occ_internals
=
new
OCC_Internals
;
_occ_internals
=
new
OCC_Internals
;
_occ_internals
->
loadSTEP
(
fn
.
c_str
());
_occ_internals
->
loadBREP
(
fn
.
c_str
());
_occ_internals
->
buildLists
();
_occ_internals
->
buildGModel
(
this
);
_occ_internals
->
buildGModel
(
this
);
snapVertices
();
return
1
;
return
1
;
}
}
...
@@ -450,32 +461,33 @@ int GModel::readOCCIGES(const std::string &fn)
...
@@ -450,32 +461,33 @@ int GModel::readOCCIGES(const std::string &fn)
{
{
_occ_internals
=
new
OCC_Internals
;
_occ_internals
=
new
OCC_Internals
;
_occ_internals
->
loadIGES
(
fn
.
c_str
());
_occ_internals
->
loadIGES
(
fn
.
c_str
());
_occ_internals
->
buildLists
();
_occ_internals
->
buildGModel
(
this
);
_occ_internals
->
buildGModel
(
this
);
return
1
;
return
1
;
}
}
int
GModel
::
readOCC
BR
EP
(
const
std
::
string
&
fn
)
int
GModel
::
readOCC
ST
EP
(
const
std
::
string
&
fn
)
{
{
_occ_internals
=
new
OCC_Internals
;
_occ_internals
=
new
OCC_Internals
;
_occ_internals
->
loadBREP
(
fn
.
c_str
());
_occ_internals
->
loadSTEP
(
fn
.
c_str
());
_occ_internals
->
buildLists
();
_occ_internals
->
buildGModel
(
this
);
_occ_internals
->
buildGModel
(
this
);
snapVertices
();
return
1
;
return
1
;
}
}
/*
int
GModel
::
importOCCShape
(
const
void
*
shape
,
const
void
*
options
)
OCC Creation routines
{
*/
_occ_internals
=
new
OCC_Internals
;
_occ_internals
->
loadShape
((
TopoDS_Shape
*
)
shape
);
// This function has been inspired from SALOME
_occ_internals
->
buildGModel
(
this
);
// It removes all duplicates from the geometry, starting
return
1
;
// from vertices, edges, faces, shells and solids
// This
void
OCC_Internals
::
removeAllDuplicates
(
const
double
&
tolerance
){
}
}
// This function has been inspired from SALOME It removes all
// duplicates from the geometry, starting from vertices, edges, faces,
// shells and solids This
void
OCC_Internals
::
removeAllDuplicates
(
const
double
&
tolerance
)
{
}
void
AddSimpleShapes
(
TopoDS_Shape
theShape
,
TopTools_ListOfShape
&
theList
)
void
AddSimpleShapes
(
TopoDS_Shape
theShape
,
TopTools_ListOfShape
&
theList
)
{
{
...
@@ -494,7 +506,8 @@ void AddSimpleShapes(TopoDS_Shape theShape, TopTools_ListOfShape& theList)
...
@@ -494,7 +506,8 @@ void AddSimpleShapes(TopoDS_Shape theShape, TopTools_ListOfShape& theList)
if
(
aShape_i
.
ShapeType
()
==
TopAbs_COMPOUND
||
if
(
aShape_i
.
ShapeType
()
==
TopAbs_COMPOUND
||
aShape_i
.
ShapeType
()
==
TopAbs_COMPSOLID
)
{
aShape_i
.
ShapeType
()
==
TopAbs_COMPSOLID
)
{
AddSimpleShapes
(
aShape_i
,
theList
);
AddSimpleShapes
(
aShape_i
,
theList
);
}
else
{
}
else
{
theList
.
Append
(
aShape_i
);
theList
.
Append
(
aShape_i
);
}
}
}
}
...
@@ -609,4 +622,11 @@ int GModel::readOCCBREP(const std::string &fn)
...
@@ -609,4 +622,11 @@ int GModel::readOCCBREP(const std::string &fn)
return
0
;
return
0
;
}
}
int
GModel
::
importOCCShape
(
const
void
*
shape
,
const
void
*
options
)
{
Msg
::
Error
(
"Gmsh has to be compiled with OpenCascade support to import "
"a TopoDS_Shape"
);
return
0
;
}
#endif
#endif
This diff is collapsed.
Click to expand it.
Geo/GModelIO_OCC.h
+
16
−
10
View file @
029b6ef3
#ifndef _GMODELIO_OCC_H_
#ifndef _GMODELIO_OCC_H_
#define _GMODELIO_OCC_H_
#define _GMODELIO_OCC_H_
// $Id: GModelIO_OCC.h,v 1.
5
2008-0
3
-2
0 11:44:05
geuzaine Exp $
// $Id: GModelIO_OCC.h,v 1.
6
2008-0
5
-2
5 07:10:57
geuzaine Exp $
//
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -27,14 +27,19 @@
...
@@ -27,14 +27,19 @@
#if defined(HAVE_OCC)
#if defined(HAVE_OCC)
class
OCC_Options
{
private:
int
_dummy
;
public:
OCC_Options
(
int
dummy
)
:
_dummy
(
dummy
){}
};
class
OCC_Internals
{
class
OCC_Internals
{
protected
:
protected
:
TopoDS_Shape
shape
;
TopoDS_Shape
shape
;
TopTools_IndexedMapOfShape
fmap
,
emap
,
vmap
,
somap
,
shmap
,
wmap
;
TopTools_IndexedMapOfShape
fmap
,
emap
,
vmap
,
somap
,
shmap
,
wmap
;
public:
public:
enum
BooleanOperator
{
Add
,
Cut
};
enum
BooleanOperator
{
Add
,
Cut
};
OCC_Internals
()
OCC_Internals
()
{
{
somap
.
Clear
();
somap
.
Clear
();
...
@@ -44,12 +49,13 @@ class OCC_Internals {
...
@@ -44,12 +49,13 @@ class OCC_Internals {
emap
.
Clear
();
emap
.
Clear
();
vmap
.
Clear
();
vmap
.
Clear
();
}
}
void
H
ealGeometry
(
double
tolerance
,
bool
fixsmalledges
,
void
h
ealGeometry
(
double
tolerance
,
bool
fixsmalledges
,
bool
fixspotstripfaces
,
bool
sewfaces
,
bool
fixspotstripfaces
,
bool
sewfaces
,
bool
makesolids
=
false
);
bool
makesolids
=
false
);
void
loadBREP
(
const
char
*
);
void
loadSTEP
(
const
char
*
);
void
loadSTEP
(
const
char
*
);
void
loadIGES
(
const
char
*
);
void
loadIGES
(
const
char
*
);
void
load
BREP
(
const
char
*
);
void
load
Shape
(
const
TopoDS_Shape
*
);
void
buildGModel
(
GModel
*
gm
);
void
buildGModel
(
GModel
*
gm
);
void
buildLists
();
void
buildLists
();
void
removeAllDuplicates
(
const
double
&
tolerance
);
void
removeAllDuplicates
(
const
double
&
tolerance
);
...
...
This diff is collapsed.
Click to expand it.
Geo/OCCFace.cpp
+
2
−
2
View file @
029b6ef3
// $Id: OCCFace.cpp,v 1.4
0
2008-05-
04 08:31:13
geuzaine Exp $
// $Id: OCCFace.cpp,v 1.4
1
2008-05-
25 07:10:57
geuzaine Exp $
//
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -98,7 +98,7 @@ OCCFace::OCCFace(GModel *m, TopoDS_Face _s, int num, TopTools_IndexedMapOfShape
...
@@ -98,7 +98,7 @@ OCCFace::OCCFace(GModel *m, TopoDS_Face _s, int num, TopTools_IndexedMapOfShape
umax
+=
fabs
(
du
)
/
100.0
;
umax
+=
fabs
(
du
)
/
100.0
;
vmax
+=
fabs
(
dv
)
/
100.0
;
vmax
+=
fabs
(
dv
)
/
100.0
;
occface
=
BRep_Tool
::
Surface
(
s
);
occface
=
BRep_Tool
::
Surface
(
s
);
buildSTLTriangulation
();
if
(
!
CTX
.
batch
)
buildSTLTriangulation
();
}
}
Range
<
double
>
OCCFace
::
parBounds
(
int
i
)
const
Range
<
double
>
OCCFace
::
parBounds
(
int
i
)
const
...
...
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