-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
gp_Pnt aP;
gp_Vec aV;
- if (aType == CYLINDER_R_H) {
+ if (aType == CYLINDER_R_H || aType == CYLINDER_R_H_A) {
aP = gp::Origin();
aV = gp::DZ();
}
- else if (aType == CYLINDER_PNT_VEC_R_H) {
+ else if (aType == CYLINDER_PNT_VEC_R_H || aType == CYLINDER_PNT_VEC_R_H_A) {
Handle(GEOM_Function) aRefPoint = aCI.GetPoint();
Handle(GEOM_Function) aRefVector = aCI.GetVector();
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
if (aCI.GetH() < 0.0) aV.Reverse();
gp_Ax2 anAxes (aP, aV);
- BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()));
- MC.Build();
- if (!MC.IsDone()) {
- StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
+ TopoDS_Shape aShape;
+
+ switch (aType) {
+ case CYLINDER_R_H:
+ case CYLINDER_PNT_VEC_R_H:
+ {
+ BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()));
+ MC.Build();
+ if (!MC.IsDone()) {
+ StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
+ }
+ aShape = MC.Shape();
+ break;
+ }
+ case CYLINDER_R_H_A:
+ case CYLINDER_PNT_VEC_R_H_A:
+ {
+ BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()), aCI.GetA());
+ MC.Build();
+ if (!MC.IsDone()) {
+ StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters. Failure.");
+ }
+ aShape = MC.Shape();
+ break;
+ }
+ default:
+ break;
}
-
- TopoDS_Shape aShape = MC.Shape();
+
if (aShape.IsNull()) return 0;
-
aFunction->SetValue(aShape);
log.SetTouched(Label());
-
return 1;
}