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
d3a32949
Commit
d3a32949
authored
15 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
catch OCC exception in addShape
parent
c4f25e5d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Geo/GModelIO_OCC.cpp
+48
-43
48 additions, 43 deletions
Geo/GModelIO_OCC.cpp
Geo/GModelIO_OCC.h
+0
-1
0 additions, 1 deletion
Geo/GModelIO_OCC.h
with
48 additions
and
44 deletions
Geo/GModelIO_OCC.cpp
+
48
−
43
View file @
d3a32949
...
...
@@ -499,55 +499,60 @@ void GModel::addShape(std::string name, std::vector<double> &p,
else
if
(
op
==
"Fuse"
||
op
==
"Union"
)
o
=
OCC_Internals
::
Fuse
;
else
if
(
op
==
"Intersection"
)
o
=
OCC_Internals
::
Intersection
;
if
(
name
==
"Sphere"
){
if
(
p
.
size
()
!=
4
){
Msg
::
Error
(
"4 parameters have to be defined for a sphere"
);
return
;
}
_occ_internals
->
Sphere
(
SPoint3
(
p
[
0
],
p
[
1
],
p
[
2
]),
p
[
3
],
o
);
}
else
if
(
name
==
"Cylinder"
){
if
(
p
.
size
()
!=
8
){
Msg
::
Error
(
"8 parameters have to be defined for a Cylinder"
);
return
;
try
{
if
(
name
==
"Sphere"
){
if
(
p
.
size
()
!=
4
){
Msg
::
Error
(
"4 parameters have to be defined for a sphere"
);
return
;
}
_occ_internals
->
Sphere
(
SPoint3
(
p
[
0
],
p
[
1
],
p
[
2
]),
p
[
3
],
o
);
}
_occ_internals
->
Cylinder
(
SPoint3
(
p
[
0
],
p
[
1
],
p
[
2
]),
SVector3
(
p
[
3
],
p
[
4
],
p
[
5
]),
p
[
6
],
p
[
7
],
o
);
}
else
if
(
name
==
"Torus"
){
if
(
p
.
size
()
==
8
){
_occ_internals
->
Torus
(
SPoint3
(
p
[
0
],
p
[
1
],
p
[
2
]),
SVector3
(
p
[
3
],
p
[
4
],
p
[
5
]),
p
[
6
],
p
[
7
],
o
);
else
if
(
name
==
"Cylinder"
){
if
(
p
.
size
()
!=
8
){
Msg
::
Error
(
"8 parameters have to be defined for a Cylinder"
);
return
;
}
_occ_internals
->
Cylinder
(
SPoint3
(
p
[
0
],
p
[
1
],
p
[
2
]),
SVector3
(
p
[
3
],
p
[
4
],
p
[
5
]),
p
[
6
],
p
[
7
],
o
);
}
else
if
(
p
.
size
()
==
9
){
_occ_internals
->
Torus
(
SPoint3
(
p
[
0
],
p
[
1
],
p
[
2
]),
SVector3
(
p
[
3
],
p
[
4
],
p
[
5
]),
p
[
6
],
p
[
7
],
p
[
8
],
o
);
else
if
(
name
==
"Torus"
){
if
(
p
.
size
()
==
8
){
_occ_internals
->
Torus
(
SPoint3
(
p
[
0
],
p
[
1
],
p
[
2
]),
SVector3
(
p
[
3
],
p
[
4
],
p
[
5
]),
p
[
6
],
p
[
7
],
o
);
}
else
if
(
p
.
size
()
==
9
){
_occ_internals
->
Torus
(
SPoint3
(
p
[
0
],
p
[
1
],
p
[
2
]),
SVector3
(
p
[
3
],
p
[
4
],
p
[
5
]),
p
[
6
],
p
[
7
],
p
[
8
],
o
);
}
else
{
Msg
::
Error
(
"Wrong number of parameters for a Torus (8 or 9 is OK)"
);
return
;
}
}
else
{
Msg
::
Error
(
"Wrong number of parameters for a Torus (8 or 9 is OK)"
);
return
;
else
if
(
name
==
"Cone"
){
if
(
p
.
size
()
!=
9
){
Msg
::
Error
(
"9 parameters have to be defined for a Cone"
);
return
;
}
_occ_internals
->
Cone
(
SPoint3
(
p
[
0
],
p
[
1
],
p
[
2
]),
SVector3
(
p
[
3
],
p
[
4
],
p
[
5
]),
p
[
6
],
p
[
7
],
p
[
8
],
o
);
}
}
else
if
(
name
==
"Cone"
){
if
(
p
.
size
()
!=
9
){
Msg
::
Error
(
"9 parameters have to be defined for a Cone"
);
return
;
else
if
(
name
==
"Box"
){
if
(
p
.
size
()
!=
6
){
Msg
::
Error
(
"6 parameters have to be defined for a Box"
);
return
;
}
_occ_internals
->
Box
(
SPoint3
(
p
[
0
],
p
[
1
],
p
[
2
]),
SPoint3
(
p
[
3
],
p
[
4
],
p
[
5
]),
o
);
}
_occ_internals
->
Cone
(
SPoint3
(
p
[
0
],
p
[
1
],
p
[
2
]),
SVector3
(
p
[
3
],
p
[
4
],
p
[
5
]),
p
[
6
],
p
[
7
],
p
[
8
],
o
);
}
else
if
(
name
==
"Box"
){
if
(
p
.
size
()
!=
6
){
Msg
::
Error
(
"6 parameters have to be defined for a Box"
);
return
;
else
{
// we should that at the end, a test now !!
_occ_internals
->
buildLists
();
_occ_internals
->
buildGModel
(
this
);
}
_occ_internals
->
Box
(
SPoint3
(
p
[
0
],
p
[
1
],
p
[
2
]),
SPoint3
(
p
[
3
],
p
[
4
],
p
[
5
]),
o
);
}
else
{
// we should that at the end, a test now !!
_occ_internals
->
buildLists
();
_occ_internals
->
buildGModel
(
this
);
catch
(
Standard_Failure
&
err
){
Msg
::
Error
(
"%s"
,
err
.
GetMessageString
());
}
}
...
...
@@ -848,7 +853,7 @@ void OCC_Internals::Cone(const SPoint3 &p, const SVector3 &d, double R1,
gp_Pnt
aP
(
p
.
x
(),
p
.
y
(),
p
.
z
());
gp_Vec
aV
(
d
.
x
(),
d
.
y
(),
d
.
z
());
gp_Ax2
anAxes
(
aP
,
aV
);
BRepPrimAPI_MakeCone
MC
(
anAxes
,
R1
,
R2
,
H
);
BRepPrimAPI_MakeCone
MC
(
anAxes
,
R1
,
R2
,
H
);
MC
.
Build
();
if
(
!
MC
.
IsDone
())
{
Msg
::
Error
(
"Cone can't be computed from the given parameters"
);
...
...
This diff is collapsed.
Click to expand it.
Geo/GModelIO_OCC.h
+
0
−
1
View file @
d3a32949
...
...
@@ -48,7 +48,6 @@ class OCC_Internals {
void
buildLists
();
void
removeAllDuplicates
(
const
double
&
tolerance
);
void
Cone
(
const
SPoint3
&
p1
,
const
SPoint3
&
p2
,
const
BooleanOperator
&
op
);
void
Box
(
const
SPoint3
&
p1
,
const
SPoint3
&
p2
,
const
BooleanOperator
&
op
);
void
Sphere
(
const
SPoint3
&
center
,
const
double
&
radius
,
const
BooleanOperator
&
op
);
void
Cylinder
(
const
SPoint3
&
bottom_center
,
const
SVector3
&
dir
,
double
R
,
double
H
,
...
...
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