Part & PartDesign Cone: allow equal radii (#12219)
* PartDesign_Cone: allow equal radii * fix R2 < R1 * Part_Cone: allow equal radii
This commit is contained in:
committed by
GitHub
parent
51f546f1f6
commit
1eb0444bd5
@@ -658,12 +658,21 @@ App::DocumentObjectExecReturn *Cone::execute()
|
||||
if (Height.getValue() < Precision::Confusion())
|
||||
return new App::DocumentObjectExecReturn("Height of cone too small");
|
||||
try {
|
||||
// Build a cone
|
||||
BRepPrimAPI_MakeCone mkCone(Radius1.getValue(),
|
||||
Radius2.getValue(),
|
||||
Height.getValue(),
|
||||
Angle.getValue()/180.0f*M_PI);
|
||||
TopoDS_Shape ResultShape = mkCone.Shape();
|
||||
TopoDS_Shape ResultShape;
|
||||
if (std::abs(Radius1.getValue() - Radius2.getValue()) < Precision::Confusion()){
|
||||
//Build a cylinder
|
||||
BRepPrimAPI_MakeCylinder mkCylr(Radius1.getValue(),
|
||||
Height.getValue(),
|
||||
2.0 * M_PI);
|
||||
ResultShape = mkCylr.Shape();
|
||||
} else {
|
||||
// Build a cone
|
||||
BRepPrimAPI_MakeCone mkCone(Radius1.getValue(),
|
||||
Radius2.getValue(),
|
||||
Height.getValue(),
|
||||
Angle.getValue()/180.0f*M_PI);
|
||||
ResultShape = mkCone.Shape();
|
||||
}
|
||||
this->Shape.setValue(ResultShape);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
|
||||
Reference in New Issue
Block a user