FeaturesPlugin_RevolutionBoolean.h
FeaturesPlugin_RevolutionCut.h
FeaturesPlugin_RevolutionFuse.h
- FeaturesPlugin_ValidatorExtrusionBase.h
FeaturesPlugin_ValidatorTransform.h
FeaturesPlugin_Validators.h
)
FeaturesPlugin_RevolutionBoolean.cpp
FeaturesPlugin_RevolutionCut.cpp
FeaturesPlugin_RevolutionFuse.cpp
- FeaturesPlugin_ValidatorExtrusionBase.cpp
FeaturesPlugin_ValidatorTransform.cpp
FeaturesPlugin_Validators.cpp
)
{
// Check that algo is done.
if(!theMakeShape->isDone()) {
- setError("Error:" + getKind() + "algorithm failed.");
+ setError("Error: " + getKind() + " algorithm failed.");
return false;
}
#include <GeomAlgoAPI_Prism.h>
+#include <GeomAPI_Dir.h>
+#include <GeomAPI_Edge.h>
+#include <GeomAPI_Lin.h>
+
//=================================================================================================
FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion()
{
// Getting base shapes.
getBaseShapes(theBaseShapes);
+ //Getting direction.
+ std::shared_ptr<GeomAPI_Dir> aDir;
+ std::shared_ptr<GeomAPI_Edge> anEdge;
+ AttributeSelectionPtr aSelection = selection(DIRECTION_OBJECT_ID());
+ if(aSelection.get() && aSelection->value().get() && aSelection->value()->isEdge()) {
+ anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->value()));
+ } else if(aSelection->context().get() &&
+ aSelection->context()->shape().get() &&
+ aSelection->context()->shape()->isEdge()) {
+ anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->context()->shape()));
+ }
+ if(anEdge.get()) {
+ if(anEdge->isLine()) {
+ aDir = anEdge->line()->direction();
+ }
+ }
+
// Getting sizes.
double aToSize = 0.0;
double aFromSize = 0.0;
GeomShapePtr aFromShape;
if(string(CREATION_METHOD())->value() == "ByPlanesAndOffsets") {
- AttributeSelectionPtr aSelection = selection(TO_OBJECT_ID());
+ aSelection = selection(TO_OBJECT_ID());
if(aSelection.get()) {
aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(aSelection->value());
if(!aToShape.get() && aSelection->context().get()) {
for(ListOfShape::const_iterator anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) {
std::shared_ptr<GeomAPI_Shape> aBaseShape = *anIter;
- std::shared_ptr<GeomAlgoAPI_Prism> aPrismAlgo(new GeomAlgoAPI_Prism(aBaseShape,
+ std::shared_ptr<GeomAlgoAPI_Prism> aPrismAlgo(new GeomAlgoAPI_Prism(aBaseShape, aDir,
aToShape, aToSize,
aFromShape, aFromSize));
if(!isMakeShapeValid(aPrismAlgo)) {
#include <FeaturesPlugin_RevolutionFuse.h>
#include <FeaturesPlugin_Rotation.h>
#include <FeaturesPlugin_ValidatorTransform.h>
-#include <FeaturesPlugin_ValidatorExtrusionBase.h>
#include <FeaturesPlugin_Validators.h>
#include <ModelAPI_Session.h>
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
aFactory->registerValidator("FeaturesPlugin_ValidatorTransform",
new FeaturesPlugin_ValidatorTransform);
- aFactory->registerValidator("FeaturesPlugin_ValidatorExtrusionBase",
- new FeaturesPlugin_ValidatorExtrusionBase);
+ aFactory->registerValidator("FeaturesPlugin_ValidatorCompositeLauncher",
+ new FeaturesPlugin_ValidatorCompositeLauncher);
aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGeneration",
new FeaturesPlugin_ValidatorBaseForGeneration);
- aFactory->registerValidator("FeaturesPlugin_PipeLocationsValidator",
- new FeaturesPlugin_PipeLocationsValidator);
+ aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocations",
+ new FeaturesPlugin_ValidatorPipeLocations);
+ aFactory->registerValidator("FeaturesPlugin_ValidatorCanBeEmpty",
+ new FeaturesPlugin_ValidatorCanBeEmpty);
// register this plugin
ModelAPI_Session::get()->registerPlugin(this);
anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->context()->shape()));
}
if(anEdge.get()) {
- anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
- anEdge->line()->direction()));
+ if(anEdge->isLine()) {
+ anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
+ anEdge->line()->direction()));
+ }
+ }
+
+ if(!anAxis.get()) {
+ return false;
}
// Getting angles.
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-#include "FeaturesPlugin_ValidatorExtrusionBase.h"
-
-#include "GeomValidators_FeatureKind.h"
-#include "GeomValidators_ShapeType.h"
-
-#include "ModelAPI_AttributeSelectionList.h"
-#include "ModelAPI_ResultPart.h"
-#include "ModelAPI_ResultBody.h"
-#include "ModelAPI_ResultCompSolid.h"
-#include "ModelAPI_Session.h"
-
-bool FeaturesPlugin_ValidatorExtrusionBase::isValid(const AttributePtr& theAttribute,
- const std::list<std::string>& theArguments,
- std::string& theError) const
-{
- bool aValid = true;
-
- /*GeomValidators_FeatureKind* aValidator = new GeomValidators_FeatureKind();
- // check whether the selection is on the sketch
- bool aFeatureKindValid = aValidator->isValid(theAttribute, theArguments, theError);
- if (!aFeatureKindValid) {
- // check if selection has Face selected
- GeomValidators_ShapeType* aShapeType = new GeomValidators_ShapeType();
- std::list<std::string> anArguments;
- anArguments.push_back("face");
- aValid = aShapeType->isValid(theAttribute, anArguments, theError);
- }*/
- return aValid;
-}
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: FeaturesPlugin_ValidatorExtrusionBase.h
-// Created: 16 Sep 2015
-// Author: Natalia ERMOLAEVA
-
-#ifndef FeaturesPlugin_ValidatorExtrusionBase_H
-#define FeaturesPlugin_ValidatorExtrusionBase_H
-
-#include "ModelAPI_AttributeValidator.h"
-
-/** \class FeaturesPlugin_ValidatorExtrusionBase
- * \ingroup Validators
- * \brief A validator of selection
- */
-class FeaturesPlugin_ValidatorExtrusionBase : public ModelAPI_AttributeValidator
-{
- public:
- /** \return true if attribute is valid
- * \param theAttribute the checked attribute
- * \param theArguments arguments of the attribute
- * \param theError error message
- */
- virtual bool isValid(const AttributePtr& theAttribute,
- const std::list<std::string>& theArguments,
- std::string& theError) const;
-};
-
-#endif
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_ResultConstruction.h>
+#include <GeomValidators_ShapeType.h>
+
//=================================================================================================
-bool FeaturesPlugin_PipeLocationsValidator::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+bool FeaturesPlugin_ValidatorPipeLocations::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<std::string>& theArguments,
std::string& theError) const
{
}
//=================================================================================================
-bool FeaturesPlugin_PipeLocationsValidator::isNotObligatory(std::string theFeature, std::string theAttribute)
+bool FeaturesPlugin_ValidatorPipeLocations::isNotObligatory(std::string theFeature, std::string theAttribute)
{
return false;
}
const std::list<std::string>& theArguments,
std::string& theError) const
{
+ if(theArguments.empty()) {
+ theError = "Validator parameters is empty.";
+ return false;
+ }
+
// Checking attribute.
- if(!isValidAttribute(theAttribute, theError)) {
+ if(!isValidAttribute(theAttribute, theArguments, theError)) {
if(theError.empty()) {
- theError = "Attribute contains shape with unacceptable type.";
+ theError = "Attribute contains unacceptable shape.";
}
return false;
}
//=================================================================================================
bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const AttributePtr& theAttribute,
+ const std::list<std::string>& theArguments,
std::string& theError) const
{
if(!theAttribute.get()) {
AttributeSelectionListPtr aListAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
for(int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) {
// If at least one attribute is invalid, the result is false.
- if(!isValidAttribute(aListAttr->value(anIndex), theError)) {
+ if(!isValidAttribute(aListAttr->value(anIndex), theArguments, theError)) {
return false;
}
}
}
// Check that object is a shape with allowed type.
- aShape = aContext->shape();
- GeomAPI_Shape::ShapeType aShapeType = aShape->shapeType();
- if(aShapeType != GeomAPI_Shape::VERTEX &&
- aShapeType != GeomAPI_Shape::EDGE &&
- aShapeType != GeomAPI_Shape::WIRE &&
- aShapeType != GeomAPI_Shape::FACE) {
+ GeomValidators_ShapeType aShapeTypeValidator;
+ if(!aShapeTypeValidator.isValid(anAttr, theArguments, theError)) {
theError = "Selected shape has unacceptable type. Acceptable types are: faces or wires on sketch, \
- whole sketch(if it has at least one face), and following objects: vertex, edge, wire, face.";
+ whole sketch(if it has at least one face), and whole objects with shape types: ";
+ std::list<std::string>::const_iterator anIt = theArguments.cbegin();
+ theError += *anIt;
+ for(++anIt; anIt != theArguments.cend(); ++anIt) {
+ theError += ", " + *anIt;
+ }
return false;
}
}
return true;
-}
\ No newline at end of file
+}
+
+//=================================================================================================
+bool FeaturesPlugin_ValidatorCompositeLauncher::isValid(const AttributePtr& theAttribute,
+ const std::list<std::string>& theArguments,
+ std::string& theError) const
+{
+ FeaturesPlugin_ValidatorBaseForGeneration aBaseValidator;
+
+ if(aBaseValidator.isValid(theAttribute, theArguments, theError)) {
+ return true;
+ }
+
+ // Check that face selected.
+ GeomValidators_ShapeType aShapeType;
+ std::list<std::string> anArguments;
+ anArguments.push_back("face");
+ if(aShapeType.isValid(theAttribute, anArguments, theError)) {
+ return true;
+ }
+
+ theError = "Selected shape is not suitable for this operation";
+
+ return false;
+}
+
+//=================================================================================================
+bool FeaturesPlugin_ValidatorCanBeEmpty::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<std::string>& theArguments,
+ std::string& theError) const
+{
+ if(theArguments.size() != 5 && theArguments.size() != 6) {
+ theError = "Validator should be used with 6 parameters for extrusion and with 5 for revolution.";
+ return false;
+ }
+
+ std::list<std::string>::const_iterator anArgsIt = theArguments.begin(), aLast = theArguments.end();
+
+ std::string aSelectedMethod;
+ if(theFeature->string(*anArgsIt)) {
+ aSelectedMethod = theFeature->string(*anArgsIt)->value();
+ }
+ ++anArgsIt;
+ std::string aCreationMethod = *anArgsIt;
+ ++anArgsIt;
+
+ AttributePtr aCheckAttribute = theFeature->attribute(*anArgsIt);
+ ++anArgsIt;
+
+ if(isShapesCanBeEmpty(aCheckAttribute, theError)) {
+ return true;
+ }
+
+ if(aSelectedMethod == aCreationMethod) {
+ ++anArgsIt;
+ ++anArgsIt;
+ }
+
+ for(; anArgsIt != theArguments.cend(); ++anArgsIt) {
+ AttributeSelectionPtr aSelAttr = theFeature->selection(*anArgsIt);
+ if(!aSelAttr.get()) {
+ theError = "Could not get selection attribute \"" + *anArgsIt + "\".";
+ return false;
+ }
+
+ GeomShapePtr aShape = aSelAttr->value();
+ if(!aShape.get()) {
+ ResultPtr aContext = aSelAttr->context();
+ if(!aContext.get()) {
+ theError = "Selection attribute \"" + *anArgsIt + "\" can not be empty.";
+ return false;
+ }
+
+ aShape = aContext->shape();
+ }
+
+ if(!aShape.get()) {
+ theError = "Selection attribute \"" + *anArgsIt + "\" can not be empty.";
+ return false;
+ }
+ }
+
+ return true;
+}
+
+//=================================================================================================
+bool FeaturesPlugin_ValidatorCanBeEmpty::isNotObligatory(std::string theFeature, std::string theAttribute)
+{
+ return false;
+}
+
+//=================================================================================================
+bool FeaturesPlugin_ValidatorCanBeEmpty::isShapesCanBeEmpty(const AttributePtr& theAttribute,
+ std::string& theError) const
+{
+ if(!theAttribute.get()) {
+ return true;
+ }
+
+ std::string anAttributeType = theAttribute->attributeType();
+ if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) {
+ AttributeSelectionListPtr aListAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
+ for(int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) {
+ // If at least one attribute is invalid, the result is false.
+ if(!isShapesCanBeEmpty(aListAttr->value(anIndex), theError)) {
+ return false;
+ }
+ }
+ } else if(anAttributeType == ModelAPI_AttributeSelection::typeId()) {
+ // Getting context.
+ AttributeSelectionPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
+ ResultPtr aContext = anAttr->context();
+ if(!aContext.get()) {
+ return false;
+ }
+
+ GeomShapePtr aShape = anAttr->value();
+ GeomShapePtr aContextShape = aContext->shape();
+ if(!aShape.get()) {
+ aShape = aContextShape;
+ }
+ if(!aShape.get()) {
+ return false;
+ }
+
+ if(aShape->shapeType() == GeomAPI_Shape::VERTEX ||
+ aShape->shapeType() == GeomAPI_Shape::EDGE ||
+ !aShape->isPlanar()) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+
+ return true;
+}
#include <ModelAPI_AttributeValidator.h>
#include <ModelAPI_FeatureValidator.h>
-/// \class FeaturesPlugin_PipeLocationsValidator
+/// \class FeaturesPlugin_ValidatorPipeLocations
/// \ingroup Validators
/// \brief Validator for the pipe locations.
-class FeaturesPlugin_PipeLocationsValidator : public ModelAPI_FeatureValidator
+class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_FeatureValidator
{
public:
//! \return true if number of selected locations the same as number of selected bases, or empty.
/// \ingroup Validators
/// \brief A validator for selection base for generation. Allows to select faces on sketch,
/// whole sketch(if it has at least one face), and following objects: vertex, edge, wire, face.
-class FeaturesPlugin_ValidatorBaseForGeneration : public ModelAPI_AttributeValidator
+class FeaturesPlugin_ValidatorBaseForGeneration: public ModelAPI_AttributeValidator
{
public:
//! Returns true if attribute has selection type listed in the parameter arguments.
private:
bool isValidAttribute(const AttributePtr& theAttribute,
+ const std::list<std::string>& theArguments,
+ std::string& theError) const;
+};
+
+/// \class FeaturesPlugin_ValidatorCompositeLauncher
+/// \ingroup Validators
+/// \brief A validator for selection at composite feature start
+class FeaturesPlugin_ValidatorCompositeLauncher: public ModelAPI_AttributeValidator
+{
+public:
+ //! Returns true if attribute has selection type listed in the parameter arguments.
+ //! \param[in] theAttribute the checked attribute.
+ //! \param[in] theArguments arguments of the attribute.
+ //! \param[out] theError error message.
+ virtual bool isValid(const AttributePtr& theAttribute,
+ const std::list<std::string>& theArguments,
std::string& theError) const;
};
+/// \class FeaturesPlugin_ValidatorCanBeEmpty
+/// \ingroup Validators
+/// \brief A validator for extrusion direction attribute and bounding planes for extrusion and
+/// revolution. Allows them to be empty if base objects are planar and do not contain
+/// vertices and edges.
+class FeaturesPlugin_ValidatorCanBeEmpty: public ModelAPI_FeatureValidator
+{
+public:
+ //! Returns true if attribute listed in the parameter arguments are planar.
+ //! \param[in] theFeature the checked feature.
+ //! \param[in] theArguments arguments of the attribute.
+ //! \param[out] theError error message.
+ virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<std::string>& theArguments,
+ std::string& theError) const;
+
+ /// Returns true if the attribute in feature is not obligatory for the feature execution
+ virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
+
+private:
+ bool isShapesCanBeEmpty(const AttributePtr& theAttribute,
+ std::string& theError) const;
+};
+
#endif
label="Base objects:"
tooltip="Select a base objects"
type_choice="faces objects">
- <validator id="FeaturesPlugin_ValidatorExtrusionBase" parameters="Sketch"/>
+ <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="vertex,edge,wire,face,shell"/>
</composite_multi_selector>
<shape_selector id="direction_object"
icon=":icons/axis.png"
</box>
</toolbox>
<validator id="GeomValidators_ZeroOffset" parameters="CreationMethod,BySizes,base,to_size,from_size,to_object,to_offset,from_object,from_offset"/>
+ <validator id="FeaturesPlugin_ValidatorCanBeEmpty" parameters="CreationMethod,BySizes,base,to_object,from_object,direction_object"/>
</source>
icon=":icons/sketch.png"
tooltip="Select a sketch face"
type_choice="Faces Objects">
- <validator id="FeaturesPlugin_ValidatorExtrusionBase" parameters="Sketch"/>
+ <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="face,shell"/>
</composite_multi_selector>
<shape_selector id="direction_object"
icon=":icons/axis.png"
<validator id="GeomValidators_ShapeType" parameters="solid"/>
</multi_selector>
<validator id="GeomValidators_ZeroOffset" parameters="CreationMethod,BySizes,sketch_selection,to_size,from_size,to_object,to_offset,from_object,from_offset"/>
+ <validator id="FeaturesPlugin_ValidatorCanBeEmpty" parameters="CreationMethod,BySizes,base,to_object,from_object,direction_object"/>
</source>
icon=":icons/sketch.png"
tooltip="Select a sketch face"
type_choice="Faces Objects">
- <validator id="FeaturesPlugin_ValidatorExtrusionBase" parameters="Sketch"/>
+ <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="vertex,edge,wire,face,shell"/>
</composite_multi_selector>
<shape_selector id="direction_object"
icon=":icons/axis.png"
<validator id="GeomValidators_ShapeType" parameters="solid"/>
</multi_selector>
<validator id="GeomValidators_ZeroOffset" parameters="CreationMethod,BySizes,sketch_selection,to_size,from_size,to_object,to_offset,from_object,from_offset"/>
+ <validator id="FeaturesPlugin_ValidatorCanBeEmpty" parameters="CreationMethod,BySizes,base,to_object,from_object,direction_object"/>
</source>
</multi_selector>
</box>
</toolbox>
- <validator id="FeaturesPlugin_PipeLocationsValidator"/>
+ <validator id="FeaturesPlugin_ValidatorPipeLocations"/>
</source>
label="Base objects:"
tooltip="Select a base objects"
type_choice="faces objects">
- <validator id="FeaturesPlugin_ValidatorExtrusionBase" parameters="Sketch"/>
+ <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="vertex,edge,wire,face,shell"/>
</composite_multi_selector>
<shape_selector id="axis_object"
icon=":icons/axis.png"
</box>
</toolbox>
<validator id="GeomValidators_ZeroOffset" parameters="CreationMethod,ByAngles,base,to_angle,from_angle,to_object,to_offset,from_object,from_offset"/>
+ <validator id="FeaturesPlugin_ValidatorCanBeEmpty" parameters="CreationMethod,ByAngles,base,to_object,from_object"/>
</source>
icon=":icons/sketch.png"
tooltip="Select a sketch face"
type_choice="Faces Objects">
- <validator id="FeaturesPlugin_ValidatorExtrusionBase" parameters="Sketch"/>
+ <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="face,shell"/>
</composite_multi_selector>
<shape_selector id="axis_object"
icon=":icons/axis.png"
<validator id="GeomValidators_ShapeType" parameters="solid"/>
</multi_selector>
<validator id="GeomValidators_ZeroOffset" parameters="CreationMethod,ByAngles,sketch_selection,to_angle,from_angle,to_object,to_offset,from_object,from_offset"/>
+ <validator id="FeaturesPlugin_ValidatorCanBeEmpty" parameters="CreationMethod,ByAngles,base,to_object,from_object"/>
</source>
icon=":icons/sketch.png"
tooltip="Select a sketch face"
type_choice="Faces Objects">
- <validator id="FeaturesPlugin_ValidatorExtrusionBase" parameters="Sketch"/>
+ <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="vertex,edge,wire,face,shell"/>
</composite_multi_selector>
<shape_selector id="axis_object"
icon=":icons/axis.png"
<validator id="GeomValidators_ShapeType" parameters="solid"/>
</multi_selector>
<validator id="GeomValidators_ZeroOffset" parameters="CreationMethod,ByAngles,sketch_selection,to_angle,from_angle,to_object,to_offset,from_object,from_offset"/>
+ <validator id="FeaturesPlugin_ValidatorCanBeEmpty" parameters="CreationMethod,ByAngles,base,to_object,from_object"/>
</source>
// Created: 2 Dec 2014
// Author: Artem ZHIDKOV
-#include <GeomAPI_Face.h>
-#include <GeomAPI_Dir.h>
-#include <GeomAPI_Pln.h>
-#include <GeomAPI_Pnt.h>
+#include "GeomAPI_Face.h"
+
+#include "GeomAPI_Dir.h"
+#include "GeomAPI_Pln.h"
+#include "GeomAPI_Pnt.h"
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <Geom_Surface.hxx>
-#include <Geom_Plane.hxx>
#include <Geom_CylindricalSurface.hxx>
-#include <GeomLib_IsPlanarSurface.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Face.hxx>
GeomAPI_Face::GeomAPI_Face()
: GeomAPI_Shape()
return true;
}
-bool GeomAPI_Face::isPlanar() const
-{
- const TopoDS_Shape& aShape = const_cast<GeomAPI_Face*>(this)->impl<TopoDS_Shape>();
- Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape));
- Handle(Geom_RectangularTrimmedSurface) aTrimmed =
- Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf);
- if (!aTrimmed.IsNull())
- aSurf = aTrimmed->BasisSurface();
- GeomLib_IsPlanarSurface isPlanar(aSurf);
- return isPlanar.IsPlanar() == Standard_True;
-}
-
bool GeomAPI_Face::isCylindrical() const
{
const TopoDS_Shape& aShape = const_cast<GeomAPI_Face*>(this)->impl<TopoDS_Shape>();
GEOMAPI_EXPORT
virtual bool isEqual(const std::shared_ptr<GeomAPI_Shape> theFace) const;
- /// Returns true if the face is a planar face
- GEOMAPI_EXPORT
- bool isPlanar() const;
-
/// Returns true if the face is a cylindrical face
GEOMAPI_EXPORT
bool isCylindrical() const;
return std::shared_ptr<GeomAPI_Dir>();
}
+bool GeomAPI_PlanarEdges::isPlanar() const
+{
+ return true;
+}
+
void GeomAPI_PlanarEdges::setPlane(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
const std::shared_ptr<GeomAPI_Dir>& theDirX,
const std::shared_ptr<GeomAPI_Dir>& theNorm)
/// Returns Z direction vector
GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Dir> norm() const;
+ /// Returns whether the shape is planar
+ GEOMAPI_EXPORT virtual bool isPlanar() const;
+
/// Set working plane
/// \param theOrigin origin of the plane axis
/// \param theDirX X direction of the plane axis
// Created: 23 Apr 2014
// Author: Mikhail PONIKAROV
-#include<GeomAPI_Shape.h>
+#include "GeomAPI_Shape.h"
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Iterator.hxx>
+#include <BRep_Tool.hxx>
#include <BRepBndLib.hxx>
-#include <Bnd_Box.hxx>
+#include <BRepBuilderAPI_FindPlane.hxx>
#include <BRepTools.hxx>
+#include <Bnd_Box.hxx>
+#include <Geom_Plane.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
#include <sstream>
return !aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPSOLID;
}
+bool GeomAPI_Shape::isPlanar() const
+{
+ const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
+
+ if(aShape.IsNull()) {
+ return false;
+ }
+
+ TopAbs_ShapeEnum aShapeType = aShape.ShapeType();
+
+ if(aShapeType == TopAbs_VERTEX) {
+ return true;
+ } else if(aShapeType == TopAbs_EDGE || aShapeType == TopAbs_WIRE || aShapeType == TopAbs_SHELL) {
+ BRepBuilderAPI_FindPlane aFindPlane(aShape);
+ return aFindPlane.Found() == Standard_True;
+ } else if(aShapeType == TopAbs_FACE) {
+ const Handle(Geom_Surface)& aSurface = BRep_Tool::Surface(TopoDS::Face(aShape));
+ Handle(Standard_Type) aType = aSurface->DynamicType();
+
+ if(aType == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
+ Handle(Geom_RectangularTrimmedSurface) aTrimSurface = Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface);
+ aType = aTrimSurface->BasisSurface()->DynamicType();
+ }
+ return (aType == STANDARD_TYPE(Geom_Plane));
+ } else {
+ return false;
+ }
+}
+
GeomAPI_Shape::ShapeType GeomAPI_Shape::shapeType() const
{
const TopoDS_Shape& aShape = impl<TopoDS_Shape>();
- return (ShapeType)aShape.ShapeType();
+
+ ShapeType aST = GeomAPI_Shape::SHAPE;
+
+ switch(aShape.ShapeType()) {
+ case TopAbs_COMPOUND:
+ aST = GeomAPI_Shape::COMPOUND;
+ break;
+ case TopAbs_COMPSOLID:
+ aST = GeomAPI_Shape::COMPSOLID;
+ break;
+ case TopAbs_SOLID:
+ aST = GeomAPI_Shape::SOLID;
+ break;
+ case TopAbs_SHELL:
+ aST = GeomAPI_Shape::SHELL;
+ break;
+ case TopAbs_FACE:
+ aST = GeomAPI_Shape::FACE;
+ break;
+ case TopAbs_WIRE:
+ aST = GeomAPI_Shape::WIRE;
+ break;
+ case TopAbs_EDGE:
+ aST = GeomAPI_Shape::EDGE;
+ break;
+ case TopAbs_VERTEX:
+ aST = GeomAPI_Shape::VERTEX;
+ break;
+ case TopAbs_SHAPE:
+ aST = GeomAPI_Shape::SHAPE;
+ break;
+ }
+
+ return aST;
}
std::string GeomAPI_Shape::shapeTypeStr() const
GEOMAPI_EXPORT
virtual bool isCompSolid() const;
+ /// Returns whether the shape is planar
+ GEOMAPI_EXPORT
+ virtual bool isPlanar() const;
+
/// Returns the shape type
GEOMAPI_EXPORT
virtual ShapeType shapeType() const;
static bool getBase(TopoDS_Shape& theBaseOut,
TopAbs_ShapeEnum& theBaseTypeOut,
- const std::shared_ptr<GeomAPI_Shape> theBaseShape);
+ const GeomShapePtr theBaseShape);
static bool getPath(TopoDS_Wire& thePathOut,
- const std::shared_ptr<GeomAPI_Shape> thePathShape);
+ const GeomShapePtr thePathShape);
static bool buildPipe(BRepOffsetAPI_MakePipeShell* thePipeBuilder);
//=================================================================================================
-GeomAlgoAPI_Pipe::GeomAlgoAPI_Pipe(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
- const std::shared_ptr<GeomAPI_Shape> thePathShape)
+GeomAlgoAPI_Pipe::GeomAlgoAPI_Pipe(const GeomShapePtr theBaseShape,
+ const GeomShapePtr thePathShape)
: /*myIsPipeShellUsed(false),*/
myBaseShape(theBaseShape),
myPathShape(thePathShape)
}
//=================================================================================================
-GeomAlgoAPI_Pipe::GeomAlgoAPI_Pipe(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
- const std::shared_ptr<GeomAPI_Shape> thePathShape,
- const std::shared_ptr<GeomAPI_Shape> theBiNormal)
+GeomAlgoAPI_Pipe::GeomAlgoAPI_Pipe(const GeomShapePtr theBaseShape,
+ const GeomShapePtr thePathShape,
+ const GeomShapePtr theBiNormal)
//: myIsPipeShellUsed(true)
{
build(theBaseShape, thePathShape, theBiNormal);
//=================================================================================================
GeomAlgoAPI_Pipe::GeomAlgoAPI_Pipe(const ListOfShape& theBaseShapes,
const ListOfShape& theLocations,
- const std::shared_ptr<GeomAPI_Shape> thePathShape)
+ const GeomShapePtr thePathShape)
//: myIsPipeShellUsed(true)
{
build(theBaseShapes, theLocations, thePathShape);
}
//=================================================================================================
-void GeomAlgoAPI_Pipe::build(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
- const std::shared_ptr<GeomAPI_Shape> thePathShape)
+void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape,
+ const GeomShapePtr thePathShape)
{
// Getting base shape.
if(!theBaseShape.get()) {
this->initialize(aPipeBuilder);
// Setting naming.
- std::shared_ptr<GeomAPI_Shape> aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
+ GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
aFromShape->setImpl(new TopoDS_Shape(aPipeBuilder->FirstShape()));
aToShape->setImpl(new TopoDS_Shape(aPipeBuilder->LastShape()));
this->addFromShape(aFromShape);
// Setting result.
TopoDS_Shape aResultShape = aPipeBuilder->Shape();
- std::shared_ptr<GeomAPI_Shape> aResultGeomShape(new GeomAPI_Shape());
+ GeomShapePtr aResultGeomShape(new GeomAPI_Shape());
aResultGeomShape->setImpl(new TopoDS_Shape(aResultShape));
this->setShape(aResultGeomShape);
this->setDone(true);
}
//=================================================================================================
-void GeomAlgoAPI_Pipe::build(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
- const std::shared_ptr<GeomAPI_Shape> thePathShape,
- const std::shared_ptr<GeomAPI_Shape> theBiNormal)
+void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape,
+ const GeomShapePtr thePathShape,
+ const GeomShapePtr theBiNormal)
{
// Getting base shape.
TopoDS_Shape aBaseShape;
}
// Setting naming.
- std::shared_ptr<GeomAPI_Shape> aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
+ GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
aFromShape->setImpl(new TopoDS_Shape(aPipeBuilder->FirstShape()));
aToShape->setImpl(new TopoDS_Shape(aPipeBuilder->LastShape()));
this->addFromShape(aFromShape);
// Setting result.
TopoDS_Shape aResultShape = aPipeBuilder->Shape();
- std::shared_ptr<GeomAPI_Shape> aResultGeomShape(new GeomAPI_Shape());
+ GeomShapePtr aResultGeomShape(new GeomAPI_Shape());
aResultGeomShape->setImpl(new TopoDS_Shape(aResultShape));
this->setShape(aResultGeomShape);
this->setDone(true);
//=================================================================================================
void GeomAlgoAPI_Pipe::build(const ListOfShape& theBaseShapes,
const ListOfShape& theLocations,
- const std::shared_ptr<GeomAPI_Shape> thePathShape)
+ const GeomShapePtr thePathShape)
{
if(theBaseShapes.empty() || (!theLocations.empty() && theLocations.size() != theBaseShapes.size())) {
return;
ListOfShape::const_iterator aBaseIt = theBaseShapes.cbegin();
ListOfShape::const_iterator aLocIt = theLocations.cbegin();
while(aBaseIt != theBaseShapes.cend()) {
- std::shared_ptr<GeomAPI_Shape> aBase = *aBaseIt;
+ GeomShapePtr aBase = *aBaseIt;
TopoDS_Shape aBaseShape;
TopAbs_ShapeEnum aBaseShapeType;
if(!getBase(aBaseShape, aBaseShapeType, aBase)) {
}
if(aHasLocations) {
- std::shared_ptr<GeomAPI_Shape> aLocation = *aLocIt;
+ GeomShapePtr aLocation = *aLocIt;
if(!aLocation.get() || aLocation->shapeType() != GeomAPI_Shape::VERTEX) {
delete aPipeBuilder;
return;
}
// Setting naming.
- std::shared_ptr<GeomAPI_Shape> aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
+ GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
aFromShape->setImpl(new TopoDS_Shape(aPipeBuilder->FirstShape()));
aToShape->setImpl(new TopoDS_Shape(aPipeBuilder->LastShape()));
this->addFromShape(aFromShape);
// Setting result.
TopoDS_Shape aResultShape = aPipeBuilder->Shape();
- std::shared_ptr<GeomAPI_Shape> aResultGeomShape(new GeomAPI_Shape());
+ GeomShapePtr aResultGeomShape(new GeomAPI_Shape());
aResultGeomShape->setImpl(new TopoDS_Shape(aResultShape));
this->setShape(aResultGeomShape);
this->setDone(true);
}
//=================================================================================================
-void GeomAlgoAPI_Pipe::generated(const std::shared_ptr<GeomAPI_Shape> theShape,
+void GeomAlgoAPI_Pipe::generated(const GeomShapePtr theShape,
ListOfShape& theHistory)
{
GeomAlgoAPI_MakeShape::generated(theShape, theHistory);
-
- //if(myIsPipeShellUsed) {
- // GeomAlgoAPI_MakeShape::generated(theShape, theHistory);
- // return;
- //}
-
- //BRepOffsetAPI_MakePipe* aMakePipe = implPtr<BRepOffsetAPI_MakePipe>();
- //const TopoDS_Shape& aProfile = theShape->impl<TopoDS_Shape>();
- //const TopAbs_ShapeEnum aProfileShapeType = aProfile.ShapeType();
- //if(aProfileShapeType != TopAbs_VERTEX && aProfileShapeType != TopAbs_EDGE) {
- // return;
- //}
- //const TopoDS_Shape& aBaseShape = myBaseShape->impl<TopoDS_Shape>();
- //TopExp_Explorer anExp(aBaseShape, aProfileShapeType);
- //Standard_Boolean ahasShape = Standard_False;
- //for(; anExp.More(); anExp.Next()) {
- // if(anExp.Current().IsSame(aProfile)) {
- // ahasShape = Standard_True;
- // break;
- // }
- //}
- //if(!ahasShape) {
- // return;
- //}
- //TopExp_Explorer aShapeExplorer(myPathShape->impl<TopoDS_Shape>(), TopAbs_EDGE);
- //for(; aShapeExplorer.More(); aShapeExplorer.Next ()) {
- // const TopoDS_Shape& aSpine = aShapeExplorer.Current();
- // const TopoDS_Shape& aGeneratedShape = aMakePipe->Generated(aSpine, aProfile);
- // if(aGeneratedShape.IsNull()) {
- // continue;
- // }
- // std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
- // aShape->setImpl(new TopoDS_Shape(aGeneratedShape));
- // theHistory.push_back(aShape);
- //}
}
// Auxilary functions:
//=================================================================================================
bool getBase(TopoDS_Shape& theBaseOut,
TopAbs_ShapeEnum& theBaseTypeOut,
- const std::shared_ptr<GeomAPI_Shape> theBaseShape)
+ const GeomShapePtr theBaseShape)
{
if(!theBaseShape.get()) {
return false;
//=================================================================================================
bool getPath(TopoDS_Wire& thePathOut,
- const std::shared_ptr<GeomAPI_Shape> thePathShape)
+ const GeomShapePtr thePathShape)
{
if(!thePathShape.get()) {
return false;
/// \brief Creates extrusion for the given shape along a path.
/// \param[in] theBaseShape base shape(vertex, edge, wire of face).
/// \param[in] thePathShape path shape(edge or wire).
- GEOMALGOAPI_EXPORT GeomAlgoAPI_Pipe(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
- const std::shared_ptr<GeomAPI_Shape> thePathShape);
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_Pipe(const GeomShapePtr theBaseShape,
+ const GeomShapePtr thePathShape);
/// \brief Creates extrusion for the given shape along a path.
/// \param[in] theBaseShape base shape(vertex, edge, wire of face).
/// \param[in] thePathShape path shape(edge or wire).
/// \param[in] theBiNormal edge or wire to preserve the constant angle between the normal vector
/// to the base object and the BiNormal vector.
- GEOMALGOAPI_EXPORT GeomAlgoAPI_Pipe(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
- const std::shared_ptr<GeomAPI_Shape> thePathShape,
- const std::shared_ptr<GeomAPI_Shape> theBiNormal);
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_Pipe(const GeomShapePtr theBaseShape,
+ const GeomShapePtr thePathShape,
+ const GeomShapePtr theBiNormal);
/// \brief Creates extrusion for the given shape along a path.
/// \param[in] theBaseShapes base shape(vertex, edge, wire of face).
/// to the base object and the BiNormal vector.
GEOMALGOAPI_EXPORT GeomAlgoAPI_Pipe(const ListOfShape& theBaseShapes,
const ListOfShape& theLocations,
- const std::shared_ptr<GeomAPI_Shape> thePathShape);
+ const GeomShapePtr thePathShape);
/// \return the list of shapes generated from theShape.
/// \param[in] theShape base shape.
/// \param[out] theHistory generated shapes.
- GEOMALGOAPI_EXPORT void generated(const std::shared_ptr<GeomAPI_Shape> theShape,
+ GEOMALGOAPI_EXPORT void generated(const GeomShapePtr theShape,
ListOfShape& theHistory);
private:
- void build(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
- const std::shared_ptr<GeomAPI_Shape> thePathShape);
+ void build(const GeomShapePtr theBaseShape,
+ const GeomShapePtr thePathShape);
- void build(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
- const std::shared_ptr<GeomAPI_Shape> thePathShape,
- const std::shared_ptr<GeomAPI_Shape> theBiNormal);
+ void build(const GeomShapePtr theBaseShape,
+ const GeomShapePtr thePathShape,
+ const GeomShapePtr theBiNormal);
void build(const ListOfShape& theBaseShapes,
const ListOfShape& theLocations,
- const std::shared_ptr<GeomAPI_Shape> thePathShape);
+ const GeomShapePtr thePathShape);
private:
//bool myIsPipeShellUsed;
- std::shared_ptr<GeomAPI_Shape> myBaseShape;
- std::shared_ptr<GeomAPI_Shape> myPathShape;
+ GeomShapePtr myBaseShape;
+ GeomShapePtr myPathShape;
};
#endif
#include <BRep_Builder.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepBndLib.hxx>
+#include <BRepBuilderAPI_FindPlane.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
+#include <Geom_Plane.hxx>
#include <gp_Pln.hxx>
#include <IntAna_IntConicQuad.hxx>
#include <IntAna_Quadric.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
//=================================================================================================
-GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(std::shared_ptr<GeomAPI_Shape> theBaseShape,
- double theToSize,
- double theFromSize)
+GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape,
+ const double theToSize,
+ const double theFromSize)
{
- build(theBaseShape, std::shared_ptr<GeomAPI_Shape>(), theToSize, std::shared_ptr<GeomAPI_Shape>(), theFromSize);
+ build(theBaseShape, std::shared_ptr<GeomAPI_Dir>(), GeomShapePtr(), theToSize, GeomShapePtr(), theFromSize);
}
//=================================================================================================
-GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(std::shared_ptr<GeomAPI_Shape> theBaseShape,
- std::shared_ptr<GeomAPI_Shape> theToShape,
- double theToSize,
- std::shared_ptr<GeomAPI_Shape> theFromShape,
- double theFromSize)
+GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape,
+ const std::shared_ptr<GeomAPI_Dir> theDirection,
+ const double theToSize,
+ const double theFromSize)
{
- build(theBaseShape, theToShape, theToSize, theFromShape, theFromSize);
+ build(theBaseShape, theDirection, GeomShapePtr(), theToSize, GeomShapePtr(), theFromSize);
}
//=================================================================================================
-void GeomAlgoAPI_Prism::build(const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
- const std::shared_ptr<GeomAPI_Shape>& theToShape,
- double theToSize,
- const std::shared_ptr<GeomAPI_Shape>& theFromShape,
- double theFromSize)
+GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape,
+ const GeomShapePtr theToShape,
+ const double theToSize,
+ const GeomShapePtr theFromShape,
+ const double theFromSize)
{
- if(!theBaseShape ||
- (((!theFromShape && !theToShape) || (theFromShape && theToShape && theFromShape->isEqual(theToShape)))
+ build(theBaseShape, std::shared_ptr<GeomAPI_Dir>(), theToShape, theToSize, theFromShape, theFromSize);
+}
+
+//=================================================================================================
+GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape,
+ const std::shared_ptr<GeomAPI_Dir> theDirection,
+ const GeomShapePtr theToShape,
+ const double theToSize,
+ const GeomShapePtr theFromShape,
+ const double theFromSize)
+{
+ build(theBaseShape, theDirection, theToShape, theToSize, theFromShape, theFromSize);
+}
+
+//=================================================================================================
+void GeomAlgoAPI_Prism::build(const GeomShapePtr& theBaseShape,
+ const std::shared_ptr<GeomAPI_Dir> theDirection,
+ const GeomShapePtr& theToShape,
+ const double theToSize,
+ const GeomShapePtr& theFromShape,
+ const double theFromSize)
+{
+ if(!theBaseShape.get() ||
+ (((!theFromShape.get() && !theToShape.get()) || (theFromShape.get() && theToShape.get() && theFromShape->isEqual(theToShape)))
&& (theFromSize == -theToSize))) {
return;
}
- // Getting base plane.
+ // Getting base shape.
const TopoDS_Shape& aBaseShape = theBaseShape->impl<TopoDS_Shape>();
- std::shared_ptr<GeomAPI_Face> aBaseFace;
- if(theBaseShape->shapeType() == GeomAPI_Shape::FACE) {
- aBaseFace = std::shared_ptr<GeomAPI_Face>(new GeomAPI_Face(theBaseShape));
- } else if(theBaseShape->shapeType() == GeomAPI_Shape::SHELL){
- GeomAPI_ShapeExplorer anExp(theBaseShape, GeomAPI_Shape::FACE);
- if(anExp.more()) {
- std::shared_ptr<GeomAPI_Shape> aFaceOnShell = anExp.current();
- aBaseFace = std::shared_ptr<GeomAPI_Face>(new GeomAPI_Face(aFaceOnShell));
+
+ // Getting direction.
+ gp_Vec aDirVec;
+ std::shared_ptr<GeomAPI_Pnt> aBaseLoc;
+ std::shared_ptr<GeomAPI_Dir> aBaseDir;
+ GeomShapePtr aBasePlane;
+ if(theDirection.get()) {
+ aDirVec = theDirection->impl<gp_Dir>();
+ } else {
+ BRepBuilderAPI_FindPlane aFindPlane(aBaseShape);
+ if(aBaseShape.ShapeType() == TopAbs_VERTEX ||
+ aBaseShape.ShapeType() == TopAbs_EDGE ||
+ aFindPlane.Found() != Standard_True) {
+ return;
}
- }
- if(!aBaseFace.get()) {
- return;
- }
- std::shared_ptr<GeomAPI_Pln> aBasePln = aBaseFace->getPlane();
- std::shared_ptr<GeomAPI_Dir> aBaseDir = aBasePln->direction();
- std::shared_ptr<GeomAPI_Pnt> aBaseLoc = aBasePln->location();
- std::shared_ptr<GeomAPI_Shape> aBasePlane = GeomAlgoAPI_FaceBuilder::planarFace(aBaseLoc, aBaseDir);
+ Handle(Geom_Plane) aPlane = aFindPlane.Plane();
+ gp_Pnt aLoc = aPlane->Axis().Location();
+ aDirVec = aPlane->Axis().Direction();
+
+ aBaseLoc.reset(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z()));
+ aBaseDir.reset(new GeomAPI_Dir(aDirVec.X(), aDirVec.Y(), aDirVec.Z()));
+ aBasePlane = GeomAlgoAPI_FaceBuilder::planarFace(aBaseLoc, aBaseDir);
+ }
- gp_Vec aBaseVec(aBaseDir->impl<gp_Dir>());
- const gp_Pnt& aBasePnt = aBaseLoc->impl<gp_Pnt>();
+ //std::shared_ptr<GeomAPI_Face> aBaseFace;
+ //if(theBaseShape->shapeType() == GeomAPI_Shape::FACE) {
+ // aBaseFace = std::shared_ptr<GeomAPI_Face>(new GeomAPI_Face(theBaseShape));
+ //} else if(theBaseShape->shapeType() == GeomAPI_Shape::SHELL){
+ // GeomAPI_ShapeExplorer anExp(theBaseShape, GeomAPI_Shape::FACE);
+ // if(anExp.more()) {
+ // GeomShapePtr aFaceOnShell = anExp.current();
+ // aBaseFace = std::shared_ptr<GeomAPI_Face>(new GeomAPI_Face(aFaceOnShell));
+ // }
+ //}
TopoDS_Shape aResult;
bool isBoundingShapesSet = theFromShape || theToShape;
if(!isBoundingShapesSet) {
// Moving base shape.
gp_Trsf aTrsf;
- aTrsf.SetTranslation(aBaseVec * -theFromSize);
+ aTrsf.SetTranslation(aDirVec * -theFromSize);
BRepBuilderAPI_Transform* aTransformBuilder = new BRepBuilderAPI_Transform(aBaseShape, aTrsf);
if(!aTransformBuilder) {
return;
TopoDS_Shape aMovedBase = aTransformBuilder->Shape();
// Making prism.
- BRepPrimAPI_MakePrism* aPrismBuilder = new BRepPrimAPI_MakePrism(aMovedBase, aBaseVec * (theFromSize + theToSize));
+ BRepPrimAPI_MakePrism* aPrismBuilder = new BRepPrimAPI_MakePrism(aMovedBase, aDirVec * (theFromSize + theToSize));
if(!aPrismBuilder) {
return;
}
// Setting naming.
for(TopExp_Explorer anExp(aMovedBase, TopAbs_FACE); anExp.More(); anExp.Next()) {
const TopoDS_Shape& aFace = anExp.Current();
- std::shared_ptr<GeomAPI_Shape> aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
+ GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
aFromShape->setImpl(new TopoDS_Shape(aPrismBuilder->FirstShape(aFace)));
aToShape->setImpl(new TopoDS_Shape(aPrismBuilder->LastShape(aFace)));
this->addFromShape(aFromShape);
this->addToShape(aToShape);
}
} else {
- std::shared_ptr<GeomAPI_Shape> aBoundingFromShape = theFromShape ? theFromShape : aBasePlane;
- std::shared_ptr<GeomAPI_Shape> aBoundingToShape = theToShape ? theToShape : aBasePlane;
+ GeomShapePtr aBoundingFromShape = theFromShape ? theFromShape : aBasePlane;
+ GeomShapePtr aBoundingToShape = theToShape ? theToShape : aBasePlane;
// Moving prism bounding faces according to "from" and "to" sizes.
std::shared_ptr<GeomAPI_Face> aFromFace(new GeomAPI_Face(aBoundingFromShape));
IntAna_Quadric aBndFromQuadric(gp_Pln(aFromPnt->impl<gp_Pnt>(), aFromDir->impl<gp_Dir>()));
Standard_Real aMaxToDist = 0, aMaxFromDist = 0;
for(int i = 0; i < 8; i++) {
- gp_Lin aLine(aPoints[i], aBaseVec);
+ gp_Lin aLine(aPoints[i], aDirVec);
IntAna_IntConicQuad aToIntAna(aLine, aBndToQuadric);
IntAna_IntConicQuad aFromIntAna(aLine, aBndFromQuadric);
if(aToIntAna.NbPoints() == 0 || aFromIntAna.NbPoints() == 0) {
// Moving base shape.
gp_Trsf aTrsf;
- aTrsf.SetTranslation(aBaseVec * -aPrismLength);
+ aTrsf.SetTranslation(aDirVec * -aPrismLength);
BRepBuilderAPI_Transform* aTransformBuilder = new BRepBuilderAPI_Transform(aBaseShape, aTrsf);
if(!aTransformBuilder) {
return;
TopoDS_Shape aMovedBase = aTransformBuilder->Shape();
// Making prism.
- BRepPrimAPI_MakePrism* aPrismBuilder = new BRepPrimAPI_MakePrism(aMovedBase, aBaseVec * 2 * aPrismLength);
+ BRepPrimAPI_MakePrism* aPrismBuilder = new BRepPrimAPI_MakePrism(aMovedBase, aDirVec * 2 * aPrismLength);
if(!aPrismBuilder) {
return;
}
// Orienting bounding planes.
std::shared_ptr<GeomAPI_Pnt> aCentreOfMass = GeomAlgoAPI_ShapeTools::centreOfMass(theBaseShape);
const gp_Pnt& aCentrePnt = aCentreOfMass->impl<gp_Pnt>();
- gp_Lin aLine(aCentrePnt, aBaseVec);
+ gp_Lin aLine(aCentrePnt, aDirVec);
IntAna_IntConicQuad aToIntAna(aLine, aBndToQuadric);
IntAna_IntConicQuad aFromIntAna(aLine, aBndFromQuadric);
Standard_Real aToParameter = aToIntAna.ParamOnConic(1);
Standard_Real aFromParameter = aFromIntAna.ParamOnConic(1);
if(aToParameter > aFromParameter) {
gp_Vec aVec = aToDir->impl<gp_Dir>();
- if((aVec * aBaseVec) > 0) {
+ if((aVec * aDirVec) > 0) {
aToDir->setImpl(new gp_Dir(aVec.Reversed()));
aBoundingToShape = GeomAlgoAPI_FaceBuilder::planarFace(aToPnt, aToDir);
}
aVec = aFromDir->impl<gp_Dir>();
- if((aVec * aBaseVec) < 0) {
+ if((aVec * aDirVec) < 0) {
aFromDir->setImpl(new gp_Dir(aVec.Reversed()));
aBoundingFromShape = GeomAlgoAPI_FaceBuilder::planarFace(aFromPnt, aFromDir);
}
} else {
gp_Vec aVec = aToDir->impl<gp_Dir>();
- if((aVec * aBaseVec) < 0) {
+ if((aVec * aDirVec) < 0) {
aToDir->setImpl(new gp_Dir(aVec.Reversed()));
aBoundingToShape = GeomAlgoAPI_FaceBuilder::planarFace(aToPnt, aToDir);
}
aVec = aFromDir->impl<gp_Dir>();
- if((aVec * aBaseVec) > 0) {
+ if((aVec * aDirVec) > 0) {
aFromDir->setImpl(new gp_Dir(aVec.Reversed()));
aBoundingFromShape = GeomAlgoAPI_FaceBuilder::planarFace(aFromPnt, aFromDir);
}
const TopoDS_Shape& aFromShape = aBoundingFromShape->impl<TopoDS_Shape>();
BRep_Builder aBoundingBuilder;
aBoundingBuilder.MakeShell(aToShell);
- aBoundingBuilder.MakeShell(aFromShell);
aBoundingBuilder.Add(aToShell, aToShape);
+ aBoundingBuilder.MakeShell(aFromShell);
aBoundingBuilder.Add(aFromShell, aFromShape);
aBoundingBuilder.MakeSolid(aToSolid);
- aBoundingBuilder.MakeSolid(aFromSolid);
aBoundingBuilder.Add(aToSolid, aToShell);
+ aBoundingBuilder.MakeSolid(aFromSolid);
aBoundingBuilder.Add(aFromSolid, aFromShell);
// Cutting with to plane.
this->appendAlgo(std::shared_ptr<GeomAlgoAPI_MakeShape>(new GeomAlgoAPI_MakeShape(aToCutBuilder)));
const TopTools_ListOfShape& aToShapes = aToCutBuilder->Modified(aToShape);
for(TopTools_ListIteratorOfListOfShape anIt(aToShapes); anIt.More(); anIt.Next()) {
- std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ GeomShapePtr aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(anIt.Value()));
this->addToShape(aShape);
}
this->appendAlgo(std::shared_ptr<GeomAlgoAPI_MakeShape>(new GeomAlgoAPI_MakeShape(aFromCutBuilder)));
const TopTools_ListOfShape& aFromShapes = aFromCutBuilder->Modified(aFromShape);
for(TopTools_ListIteratorOfListOfShape anIt(aFromShapes); anIt.More(); anIt.Next()) {
- std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ GeomShapePtr aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(anIt.Value()));
this->addFromShape(aShape);
}
aResult = GeomAlgoAPI_DFLoader::refineResult(aResult);
}
if(aResult.ShapeType() == TopAbs_COMPOUND) {
- std::shared_ptr<GeomAPI_Shape> aCompound(new GeomAPI_Shape);
+ GeomShapePtr aCompound(new GeomAPI_Shape);
aCompound->setImpl(new TopoDS_Shape(aResult));
ListOfShape aCompSolids, aFreeSolids;
GeomAlgoAPI_ShapeTools::combineShapes(aCompound, GeomAPI_Shape::COMPSOLID, aCompSolids, aFreeSolids);
if(aResult.IsNull()) {
return;
}
- std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ GeomShapePtr aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(aResult));
this->setShape(aShape);
this->setDone(true);
#ifndef GeomAlgoAPI_Prism_H_
#define GeomAlgoAPI_Prism_H_
-#include <GeomAlgoAPI.h>
+#include "GeomAlgoAPI.h"
+
+#include "GeomAlgoAPI_MakeSweep.h"
+
+#include <GeomAPI_Dir.h>
#include <GeomAPI_Shape.h>
-#include <GeomAlgoAPI_MakeSweep.h>
#include <memory>
{
public:
/// \brief Creates extrusion for the given shape along the normal for this shape.
- /// \param[in] theBaseShape face or wire to be extruded.
+ /// \param[in] theBaseShape planar face or wire to be extruded.
+ /// \param[in] theToSize offset for "to" plane.
+ /// \param[in] theFromSize offset for "from" plane.
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape,
+ const double theToSize,
+ const double theFromSize);
+
+ /// \brief Creates extrusion for the given shape along the normal for this shape.
+ /// \param[in] theBaseShape vertex, edge, wire, face or shell.
+ /// \param[in] theDirection direction of extrusion. Can be empty if theBaseShape is planar wire or face.
/// \param[in] theToSize offset for "to" plane.
/// \param[in] theFromSize offset for "from" plane.
- GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(std::shared_ptr<GeomAPI_Shape> theBaseShape,
- double theToSize,
- double theFromSize);
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape,
+ const std::shared_ptr<GeomAPI_Dir> theDirection,
+ const double theToSize,
+ const double theFromSize);
+
+ /// \brief Creates extrusion for the given shape along the normal for this shape.
+ /// \param[in] theBaseShape planar face or wire to be extruded.
+ /// \param[in] theToShape top bounding shape. Can be empty. In this case offset will be applied to the basis.
+ /// \param[in] theToSize offset for "to" plane.
+ /// \param[in] theFromShape bottom bounding shape. Can be empty. In this case offset will be applied to the basis.
+ /// \param[in] theFromSize offset for "from" plane.
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape,
+ const GeomShapePtr theToShape,
+ const double theToSize,
+ const GeomShapePtr theFromShape,
+ const double theFromSize);
/// \brief Creates extrusion for the given shape along the normal for this shape.
- /// \param[in] theBaseShape face or wire to be extruded.
- /// \param[in] theToShape top bounding shape. Can be empty. In this case offset will be applied to the basis.
+ /// \param[in] theBaseShape planar face or wire to be extruded.
+ /// \param[in] theDirection direction of extrusion. Can be empty if theBaseShape is planar wire or face.
+ /// \param[in] theToShape top bounding shape. Can be empty. In this case offset will be applied to the basis.
/// \param[in] theToSize offset for "to" plane.
/// \param[in] theFromShape bottom bounding shape. Can be empty. In this case offset will be applied to the basis.
/// \param[in] theFromSize offset for "from" plane.
- GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(std::shared_ptr<GeomAPI_Shape> theBaseShape,
- std::shared_ptr<GeomAPI_Shape> theToShape,
- double theToSize,
- std::shared_ptr<GeomAPI_Shape> theFromShape,
- double theFromSize);
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape,
+ const std::shared_ptr<GeomAPI_Dir> theDirection,
+ const GeomShapePtr theToShape,
+ const double theToSize,
+ const GeomShapePtr theFromShape,
+ const double theFromSize);
private:
/// Builds resulting shape.
- void build(const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
- const std::shared_ptr<GeomAPI_Shape>& theToShape,
- double theToSize,
- const std::shared_ptr<GeomAPI_Shape>& theFromShape,
- double theFromSize);
+ void build(const GeomShapePtr& theBaseShape,
+ const std::shared_ptr<GeomAPI_Dir> theDirection,
+ const GeomShapePtr& theToShape,
+ const double theToSize,
+ const GeomShapePtr& theFromShape,
+ const double theFromSize);
};
#endif
static TopoDS_Shape findClosest(const TopoDS_Shape& theShape, const gp_Pnt& thePoint);
//=================================================================================================
-GeomAlgoAPI_Revolution::GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBaseShape,
- std::shared_ptr<GeomAPI_Ax1> theAxis,
- double theToAngle,
- double theFromAngle)
+GeomAlgoAPI_Revolution::GeomAlgoAPI_Revolution(const GeomShapePtr theBaseShape,
+ const std::shared_ptr<GeomAPI_Ax1> theAxis,
+ const double theToAngle,
+ const double theFromAngle)
{
- build(theBaseShape, theAxis, std::shared_ptr<GeomAPI_Shape>(), theToAngle, std::shared_ptr<GeomAPI_Shape>(), theFromAngle);
+ build(theBaseShape, theAxis, GeomShapePtr(), theToAngle, GeomShapePtr(), theFromAngle);
}
//=================================================================================================
-GeomAlgoAPI_Revolution::GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBaseShape,
- std::shared_ptr<GeomAPI_Ax1> theAxis,
- std::shared_ptr<GeomAPI_Shape> theToShape,
- double theToAngle,
- std::shared_ptr<GeomAPI_Shape> theFromShape,
- double theFromAngle)
+GeomAlgoAPI_Revolution::GeomAlgoAPI_Revolution(const GeomShapePtr theBaseShape,
+ const std::shared_ptr<GeomAPI_Ax1> theAxis,
+ const GeomShapePtr theToShape,
+ const double theToAngle,
+ const GeomShapePtr theFromShape,
+ const double theFromAngle)
{
build(theBaseShape, theAxis, theToShape, theToAngle, theFromShape, theFromAngle);
}
//=================================================================================================
-void GeomAlgoAPI_Revolution::build(const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
- const std::shared_ptr<GeomAPI_Ax1>& theAxis,
- const std::shared_ptr<GeomAPI_Shape>& theToShape,
- double theToAngle,
- const std::shared_ptr<GeomAPI_Shape>& theFromShape,
- double theFromAngle)
+void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseShape,
+ const std::shared_ptr<GeomAPI_Ax1>& theAxis,
+ const GeomShapePtr& theToShape,
+ const double theToAngle,
+ const GeomShapePtr& theFromShape,
+ const double theFromAngle)
{
if(!theBaseShape || !theAxis ||
(((!theFromShape && !theToShape) || (theFromShape && theToShape && theFromShape->isEqual(theToShape)))
} else if(theBaseShape->shapeType() == GeomAPI_Shape::SHELL) {
GeomAPI_ShapeExplorer anExp(theBaseShape, GeomAPI_Shape::FACE);
if(anExp.more()) {
- std::shared_ptr<GeomAPI_Shape> aFaceOnShell = anExp.current();
+ GeomShapePtr aFaceOnShell = anExp.current();
aBaseFace = TopoDS::Face(aFaceOnShell->impl<TopoDS_Shape>());
}
}
// Setting naming.
for(TopExp_Explorer anExp(aRotatedBase, TopAbs_FACE); anExp.More(); anExp.Next()) {
const TopoDS_Shape& aFace = anExp.Current();
- std::shared_ptr<GeomAPI_Shape> aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
+ GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
aFromShape->setImpl(new TopoDS_Shape(aRevolBuilder->FirstShape(aFace)));
aToShape->setImpl(new TopoDS_Shape(aRevolBuilder->LastShape(aFace)));
this->addFromShape(aFromShape);
aResult = GeomAlgoAPI_DFLoader::refineResult(aResult);
}
if(aResult.ShapeType() == TopAbs_COMPOUND) {
- std::shared_ptr<GeomAPI_Shape> aCompound(new GeomAPI_Shape);
+ GeomShapePtr aCompound(new GeomAPI_Shape);
aCompound->setImpl(new TopoDS_Shape(aResult));
ListOfShape aCompSolids, aFreeSolids;
GeomAlgoAPI_ShapeTools::combineShapes(aCompound, GeomAPI_Shape::COMPSOLID, aCompSolids, aFreeSolids);
Handle(Geom_Surface) aFromSurface = BRep_Tool::Surface(TopoDS::Face(aRotatedFromFace));
Handle(Geom_Surface) aToSurface = BRep_Tool::Surface(TopoDS::Face(aRotatedToFace));
if(aFaceSurface == aFromSurface) {
- std::shared_ptr<GeomAPI_Shape> aFSHape(new GeomAPI_Shape);
+ GeomShapePtr aFSHape(new GeomAPI_Shape);
aFSHape->setImpl(new TopoDS_Shape(aFaceOnResult));
this->addFromShape(aFSHape);
}
if(aFaceSurface == aToSurface) {
- std::shared_ptr<GeomAPI_Shape> aTSHape(new GeomAPI_Shape);
+ GeomShapePtr aTSHape(new GeomAPI_Shape);
aTSHape->setImpl(new TopoDS_Shape(aFaceOnResult));
this->addToShape(aTSHape);
}
// Setting naming.
const TopTools_ListOfShape& aBndShapes = aBoundingCutBuilder->Modified(aBoundingFace);
for(TopTools_ListIteratorOfListOfShape anIt(aBndShapes); anIt.More(); anIt.Next()) {
- std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ GeomShapePtr aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(anIt.Value()));
isFromFaceSet ? this->addFromShape(aShape) : this->addToShape(aShape);
}
const TopTools_ListOfShape& aBsShapes = aBaseCutBuilder->Modified(aBoundingFace);
for(TopTools_ListIteratorOfListOfShape anIt(aBsShapes); anIt.More(); anIt.Next()) {
- std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ GeomShapePtr aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(anIt.Value()));
isFromFaceSet ? this->addToShape(aShape) : this->addFromShape(aShape);
}
aResult = GeomAlgoAPI_DFLoader::refineResult(aResult);
}
if(aResult.ShapeType() == TopAbs_COMPOUND) {
- std::shared_ptr<GeomAPI_Shape> aCompound(new GeomAPI_Shape);
+ GeomShapePtr aCompound(new GeomAPI_Shape);
aCompound->setImpl(new TopoDS_Shape(aResult));
ListOfShape aCompSolids, aFreeSolids;
GeomAlgoAPI_ShapeTools::combineShapes(aCompound, GeomAPI_Shape::COMPSOLID, aCompSolids, aFreeSolids);
Handle(Geom_Surface) aFaceSurface = BRep_Tool::Surface(TopoDS::Face(aFaceOnResult));
Handle(Geom_Surface) aBoundingSurface = BRep_Tool::Surface(TopoDS::Face(aRotatedBoundingFace));
if(aFaceSurface == aBoundingSurface) {
- std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ GeomShapePtr aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(aFaceOnResult));
isFromFaceSet ? this->addFromShape(aShape) : this->addToShape(aShape);
}
if(aResult.IsNull()) {
return;
}
- std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ GeomShapePtr aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(aResult));
this->setShape(aShape);
this->setDone(true);
#ifndef GeomAlgoAPI_Revolution_H_
#define GeomAlgoAPI_Revolution_H_
-#include <GeomAlgoAPI.h>
-#include <GeomAlgoAPI_MakeSweep.h>
+#include "GeomAlgoAPI.h"
+
+#include "GeomAlgoAPI_MakeSweep.h"
+
#include <GeomAPI_Ax1.h>
/// \class GeomAlgoAPI_Revolution
/// \param[in] theAxis axis for revolution.
/// \param[in] theToAngle to angle.
/// \param[in] theFromAngle from angle.
- GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBaseShape,
- std::shared_ptr<GeomAPI_Ax1> theAxis,
- double theToAngle,
- double theFromAngle);
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(const GeomShapePtr theBaseShape,
+ const std::shared_ptr<GeomAPI_Ax1> theAxis,
+ const double theToAngle,
+ const double theFromAngle);
/// \brief Creates revolution for the given shape.
/// \param[in] theBaseShape face for revolution.
/// \param[in] theToAngle to angle.
/// \param[in] theFromShape from bounding shape. Can be empty. In this case offset will be applied to the basis.
/// \param[in] theFromAngle from angle.
- GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBaseShape,
- std::shared_ptr<GeomAPI_Ax1> theAxis,
- std::shared_ptr<GeomAPI_Shape> theToShape,
- double theToAngle,
- std::shared_ptr<GeomAPI_Shape> theFromShape,
- double theFromAngle);
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(const GeomShapePtr theBaseShape,
+ const std::shared_ptr<GeomAPI_Ax1> theAxis,
+ const GeomShapePtr theToShape,
+ const double theToAngle,
+ const GeomShapePtr theFromShape,
+ const double theFromAngle);
private:
/// Builds resulting shape.
- void build(const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
- const std::shared_ptr<GeomAPI_Ax1>& theAxis,
- const std::shared_ptr<GeomAPI_Shape>& theToShape,
- double theToAngle,
- const std::shared_ptr<GeomAPI_Shape>& theFromShape,
- double theFromAngle);
+ void build(const GeomShapePtr& theBaseShape,
+ const std::shared_ptr<GeomAPI_Ax1>& theAxis,
+ const GeomShapePtr& theToShape,
+ const double theToAngle,
+ const GeomShapePtr& theFromShape,
+ const double theFromAngle);
};
#endif
\ No newline at end of file
MyShapeTypes["edge"] = Edge;
MyShapeTypes["line"] = Line;
MyShapeTypes["circle"] = Circle;
+ MyShapeTypes["wire"] = Wire;
MyShapeTypes["face"] = Face;
MyShapeTypes["solid"] = Solid;
MyShapeTypes["plane"] = Plane;
}
else {
switch (theShapeType) {
+ case Vertex:
+ aValid = theShape->isVertex();
+ break;
case Edge:
aValid = theShape->isEdge();
break;
- case Line:
- aValid = theShape->isEdge() && !GeomAPI_Curve(theShape).isCircle();
+ case Line:
+ aValid = theShape->isEdge() && !GeomAPI_Curve(theShape).isCircle();
break;
- case Circle:
- aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isCircle();
+ case Circle:
+ aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isCircle();
break;
- case Vertex:
- aValid = theShape->isVertex();
+ case Wire:
+ aValid = theShape->shapeType() == GeomAPI_Shape::WIRE;
+ break;
+ case Face:
+ aValid = theShape->isFace();
+ break;
+ case Solid:
+ aValid = theShape->isSolid() || theShape->isCompSolid() ||
+ theShape->isCompoundOfSolids();
+ break;
+ case Compound:
+ aValid = theShape->isCompound();
+ break;
+ default:
+ aValid = false;
break;
- case Solid:
- aValid = theShape->isSolid() || theShape->isCompSolid() ||
- theShape->isCompoundOfSolids();
- break;
- case Face:
- aValid = theShape->isFace();
- break;
- case Compound:
- aValid = theShape->isCompound();
- break;
- default:
- aValid = false;
- break;
}
}
return aValid;
Edge,
Line,
Circle,
+ Wire,
Face,
+ Plane,
Solid,
Compound,
- Plane,
AnyShape
};