Some changes in icons placement on toolbar.
FeaturesPlugin_ExtrusionBoolean.h
FeaturesPlugin_ExtrusionCut.h
FeaturesPlugin_ExtrusionFuse.h
+ FeaturesPlugin_RevolutionBoolean.h
+ FeaturesPlugin_RevolutionCut.h
+ FeaturesPlugin_RevolutionFuse.h
)
SET(PROJECT_SOURCES
FeaturesPlugin_Placement.cpp
FeaturesPlugin_CompositeBoolean.cpp
FeaturesPlugin_ExtrusionBoolean.cpp
+ FeaturesPlugin_RevolutionBoolean.cpp
)
SET(XML_RESOURCES
extrusioncut_widget.xml
extrusionfuse_widget.xml
revolution_widget.xml
+ revolutioncut_widget.xml
+ revolutionfuse_widget.xml
rotation_widget.xml
movement_widget.xml
boolean_widget.xml
// Extrude faces.
ListOfShape anExtrusionList;
for(ListOfShape::const_iterator aFacesIt = theFaces.begin(); aFacesIt != theFaces.end(); aFacesIt++) {
- std::shared_ptr<GeomAPI_Shape> aBaseFace = *aFacesIt;
- GeomAlgoAPI_Prism aPrismAlgo(aBaseFace, aFromShape, aFromSize, aToShape, aToSize);
+ std::shared_ptr<GeomAPI_Shape> aBaseShape = *aFacesIt;
+ GeomAlgoAPI_Prism aPrismAlgo(aBaseShape, aFromShape, aFromSize, aToShape, aToSize);
// Checking that the algorithm worked properly.
if(!aPrismAlgo.isDone() || aPrismAlgo.shape()->isNull() || !aPrismAlgo.isValid()) {
anObjects.push_back(anObject);
}
- //Getting axe.
+ //Getting axis.
std::shared_ptr<GeomAPI_Ax1> anAxis;
std::shared_ptr<GeomAPI_Edge> anEdge;
std::shared_ptr<ModelAPI_AttributeSelection> anObjRef = selection(FeaturesPlugin_Movement::AXIS_OBJECT_ID());
#include <FeaturesPlugin_Movement.h>
#include <FeaturesPlugin_Placement.h>
#include <FeaturesPlugin_Revolution.h>
+#include <FeaturesPlugin_RevolutionCut.H>
+#include <FeaturesPlugin_RevolutionFuse.h>
#include <FeaturesPlugin_Rotation.h>
#include <ModelAPI_Session.h>
return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
} else if (theFeatureID == FeaturesPlugin_ExtrusionFuse::ID()) {
return FeaturePtr(new FeaturesPlugin_ExtrusionFuse);
+ } else if (theFeatureID == FeaturesPlugin_RevolutionCut::ID()) {
+ return FeaturePtr(new FeaturesPlugin_RevolutionCut);
+ } else if (theFeatureID == FeaturesPlugin_RevolutionFuse::ID()) {
+ return FeaturePtr(new FeaturesPlugin_RevolutionFuse);
}
// feature of such kind is not found
return FeaturePtr();
{
AttributeSelectionListPtr aFaceRefs = selectionList(FeaturesPlugin_Revolution::LIST_ID());
- //Getting axe.
+ //Getting axis.
std::shared_ptr<GeomAPI_Ax1> anAxis;
std::shared_ptr<GeomAPI_Edge> anEdge;
std::shared_ptr<ModelAPI_AttributeSelection> anObjRef = selection(FeaturesPlugin_Revolution::AXIS_OBJECT_ID());
return MY_GROUP_LIST_ID;
}
- /// Attribute name of an object to which the extrusion grows.
+ /// Attribute name of an revolution axis.
inline static const std::string& AXIS_OBJECT_ID()
{
- static const std::string MY_TO_OBJECT_ID("axis_object");
- return MY_TO_OBJECT_ID;
+ static const std::string MY_AXIS_ID("axis_object");
+ return MY_AXIS_ID;
}
/// Attribute name of revolution angle.
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesPlugin_RevolutionBoolean.h
+// Created: 11 June 2015
+// Author: Dmitry Bobylev
+
+#include <FeaturesPlugin_RevolutionBoolean.h>
+
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Validator.h>
+
+#include <GeomAlgoAPI_Revolution.h>
+#include <GeomAPI_Edge.h>
+#include <GeomAPI_Lin.h>
+
+//=================================================================================================
+void FeaturesPlugin_RevolutionBoolean::initMakeSolidsAttributes()
+{
+ data()->addAttribute(FeaturesPlugin_RevolutionBoolean::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+
+ data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(FROM_ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
+
+ data()->addAttribute(TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(TO_ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
+
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TO_OBJECT_ID());
+}
+
+//=================================================================================================
+ListOfShape FeaturesPlugin_RevolutionBoolean::MakeSolids(const ListOfShape& theFaces)
+{
+ //Getting axis.
+ std::shared_ptr<GeomAPI_Ax1> anAxis;
+ std::shared_ptr<GeomAPI_Edge> anEdge;
+ std::shared_ptr<ModelAPI_AttributeSelection> anObjRef = selection(FeaturesPlugin_RevolutionBoolean::AXIS_OBJECT_ID());
+ if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
+ anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
+ }
+ if(anEdge) {
+ anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(), anEdge->line()->direction()));
+ }
+
+ // Getting revolution bounding planes.
+ std::shared_ptr<GeomAPI_Shape> aFromShape;
+ std::shared_ptr<GeomAPI_Shape> aToShape;
+ anObjRef = selection(FROM_OBJECT_ID());
+ if (anObjRef) {
+ aFromShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
+ }
+ anObjRef = selection(TO_OBJECT_ID());
+ if (anObjRef) {
+ aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
+ }
+
+ // Getting revolution angles.
+ double aFromAngle = real(FROM_ANGLE_ID())->value();
+ double aToAngle = real(TO_ANGLE_ID())->value();
+
+ // Revol faces.
+ ListOfShape aRevolutionList;
+ for(ListOfShape::const_iterator aFacesIt = theFaces.begin(); aFacesIt != theFaces.end(); aFacesIt++) {
+ std::shared_ptr<GeomAPI_Shape> aBaseShape = *aFacesIt;
+ GeomAlgoAPI_Revolution aRevolAlgo(aBaseShape, anAxis, aFromShape, aFromAngle, aToShape, aToAngle);
+
+ // Checking that the algorithm worked properly.
+ if(!aRevolAlgo.isDone() || aRevolAlgo.shape()->isNull() || !aRevolAlgo.isValid()) {
+ setError("Revolution algorithm failed");
+ return ListOfShape();
+ }
+ aRevolutionList.push_back(aRevolAlgo.shape());
+ }
+
+ return aRevolutionList;
+}
\ No newline at end of file
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesPlugin_RevolutionBoolean.h
+// Created: 11 June 2015
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesPlugin_RevolutionBoolean_H_
+#define FeaturesPlugin_RevolutionBoolean_H_
+
+#include <FeaturesPlugin_CompositeBoolean.h>
+
+/** \class FeaturesPlugin_RevolutionBoolean
+ * \ingroup Plugins
+ */
+class FeaturesPlugin_RevolutionBoolean : public FeaturesPlugin_CompositeBoolean
+{
+public:
+ /// Attribute name of an revolution axis.
+ inline static const std::string& AXIS_OBJECT_ID()
+ {
+ static const std::string MY_AXIS_ID("axis_object");
+ return MY_AXIS_ID;
+ }
+
+ /// Attribute name of an object from which the revolution grows.
+ inline static const std::string& FROM_OBJECT_ID()
+ {
+ static const std::string MY_FROM_OBJECT_ID("from_object");
+ return MY_FROM_OBJECT_ID;
+ }
+
+ /// Attribute name of revolution from angle.
+ inline static const std::string& FROM_ANGLE_ID()
+ {
+ static const std::string MY_FROM_ANGLE_ID("from_angle");
+ return MY_FROM_ANGLE_ID;
+ }
+
+ /// attribute name of an object to which the revolution grows.
+ inline static const std::string& TO_OBJECT_ID()
+ {
+ static const std::string MY_TO_OBJECT_ID("to_object");
+ return MY_TO_OBJECT_ID;
+ }
+
+ /// Attribute name of revolution to angle.
+ inline static const std::string& TO_ANGLE_ID()
+ {
+ static const std::string MY_TO_ANGLE_ID("to_angle");
+ return MY_TO_ANGLE_ID;
+ }
+
+protected:
+ /// Init attributes for revolution.
+ virtual void initMakeSolidsAttributes();
+
+ /// Create solids from faces with revolution.
+ virtual ListOfShape MakeSolids(const ListOfShape& theFaces);
+
+protected:
+ FeaturesPlugin_RevolutionBoolean(){};
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesPlugin_RevolutionCut.h
+// Created: 11 June 2015
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesPlugin_RevolutionCut_H_
+#define FeaturesPlugin_RevolutionCut_H_
+
+#include <FeaturesPlugin_RevolutionBoolean.h>
+
+/** \class FeaturesPlugin_RevolutionCut
+ * \ingroup Plugins
+ */
+class FeaturesPlugin_RevolutionCut : public FeaturesPlugin_RevolutionBoolean
+{
+ public:
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_REVOLUTION_ID("RevolutionCut");
+ return MY_REVOLUTION_ID;
+ }
+
+ /// \return the kind of a feature
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_RevolutionCut::ID();
+ return MY_KIND;
+ }
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_RevolutionCut()
+ {
+ myBooleanOperationType = GeomAlgoAPI_Boolean::BOOL_CUT;
+ }
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesPlugin_RevolutionFuse.h
+// Created: 11 June 2015
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesPlugin_RevolutionFuse_H_
+#define FeaturesPlugin_RevolutionFuse_H_
+
+#include <FeaturesPlugin_RevolutionBoolean.h>
+
+/** \class FeaturesPlugin_RevolutionFuse
+ * \ingroup Plugins
+ */
+class FeaturesPlugin_RevolutionFuse : public FeaturesPlugin_RevolutionBoolean
+{
+ public:
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_REVOLUTION_ID("RevolutionFuse");
+ return MY_REVOLUTION_ID;
+ }
+
+ /// \return the kind of a feature
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_RevolutionFuse::ID();
+ return MY_KIND;
+ }
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_RevolutionFuse()
+ {
+ myBooleanOperationType = GeomAlgoAPI_Boolean::BOOL_FUSE;
+ }
+};
+
+#endif
anObjects.push_back(anObject);
}
- //Getting axe.
+ //Getting axis.
std::shared_ptr<GeomAPI_Ax1> anAxis;
std::shared_ptr<GeomAPI_Edge> anEdge;
std::shared_ptr<ModelAPI_AttributeSelection> anObjRef = selection(FeaturesPlugin_Rotation::AXIS_OBJECT_ID());
<multi_selector id="boolean_objects"
label="Fuse with:"
icon=":icons/cut_shape.png"
- tooltip="Objects to fuse"
+ tooltip="Objects to Fuse"
type_choice="Solids"
concealment="true">
</multi_selector>
<plugin>
<workbench id="Features" document="Part">
<group id="Basic">
- <feature id="Extrusion" title="Extrusion" tooltip="Create a solid by extrusion of a face" icon=":icons/extrusion.png">
- <source path="extrusion_widget.xml"/>
- </feature>
- <feature id="Revolution" title="Revolution" tooltip="Create a solid by revolution of a face" icon=":icons/revol.png">
- <source path="revolution_widget.xml"/>
- </feature>
- <feature id="Boolean" title="Boolean" tooltip="Perform boolean operations with solids" icon=":icons/cut.png">
- <source path="boolean_widget.xml"/>
- </feature>
<feature id="Placement" title="Placement" tooltip="Perform moving of an object to specified position" icon=":icons/placement.png">
<source path="placement_widget.xml"/>
</feature>
+ <feature id="Movement" title="Movement" tooltip="Perform movement of an objects along the axis to specified distance" icon=":icons/movement.png">
+ <source path="movement_widget.xml"/>
+ </feature>
<feature id="Rotation" title="Rotation" tooltip="Perform rotation of an objects around the axis to specified angle" icon=":icons/rotation.png">
<source path="rotation_widget.xml"/>
</feature>
- <feature id="Movement" title="Movement" tooltip="Perform movement of an objects along the axis to specified distance" icon=":icons/movement.png">
- <source path="movement_widget.xml"/>
+ </group>
+ <group id="Extrusion">
+ <feature id="Extrusion" title="Extrusion" tooltip="Create a solid by extrusion of a face" icon=":icons/extrusion.png">
+ <source path="extrusion_widget.xml"/>
</feature>
<feature id="ExtrusionCut" title="ExtrusionCut" tooltip="" icon=":icons/extrusion_cut.png">
<source path="extrusioncut_widget.xml"/>
<source path="extrusionfuse_widget.xml"/>
</feature>
</group>
+ <group id="Revolution">
+ <feature id="Revolution" title="Revolution" tooltip="Create a solid by revolution of a face" icon=":icons/revol.png">
+ <source path="revolution_widget.xml"/>
+ </feature>
+ <feature id="RevolutionCut" title="RevolutionCut" tooltip="" icon=":icons/revolution_cut.png">
+ <source path="revolutioncut_widget.xml"/>
+ </feature>
+ <feature id="RevolutionFuse" title="RevolutionFuse" tooltip="" icon=":icons/revolution_fuse.png">
+ <source path="revolutionfuse_widget.xml"/>
+ </feature>
+ </group>
+ <group id="Boolean">
+ <feature id="Boolean" title="Boolean" tooltip="Perform boolean operations with solids" icon=":icons/cut.png">
+ <source path="boolean_widget.xml"/>
+ </feature>
+ </group>
<group id="Collections">
<feature id="Group"
title="Group"
<source path="group_widget.xml"/>
</feature>
</group>
- </workbench>
+ </workbench>
</plugin>
--- /dev/null
+<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+<source>
+ <groupbox title="Revolution">
+ <sketch_launcher id="sketch"
+ label="Sketch"
+ icon=":icons/sketch.png"
+ tooltip="Create or edit a sketch">/>
+ </sketch_launcher>
+ <shape_selector id="axis_object"
+ icon=":icons/axis.png"
+ label="Axis"
+ tooltip="Select an edge for axis"
+ shape_types="edge"
+ default="">
+ <validator id="GeomValidators_ShapeType" parameters="line"/>
+ </shape_selector>
+ <groupbox title="From">
+ <shape_selector id="from_object"
+ icon=":icons/plane.png"
+ label="Plane face"
+ tooltip="Select a planar face"
+ shape_types="face"
+ default="<sketch>">
+ <validator id="GeomValidators_Face" parameters="plane"/>
+ </shape_selector>
+ <doublevalue id="from_angle" label="Angle"
+ min="0" step="1.0" default="0"
+ icon=":icons/angle_down.png"
+ tooltip="Angle">
+ </doublevalue>
+ </groupbox>
+ <groupbox title="To">
+ <shape_selector id="to_object"
+ icon=":icons/plane_inverted.png"
+ label="Plane face"
+ tooltip="Select a planar face"
+ shape_types="face"
+ default="<sketch>">
+ <validator id="GeomValidators_Face" parameters="plane"/>
+ </shape_selector>
+ <doublevalue id="to_angle" label="Angle"
+ min="0" step="1.0" default="0"
+ icon=":icons/angle_up.png"
+ tooltip="Angle">
+ </doublevalue>
+ </groupbox>
+ </groupbox>
+ <multi_selector id="boolean_objects"
+ label="Cut from:"
+ icon=":icons/cut_shape.png"
+ tooltip="Objects to Cut"
+ type_choice="Solids"
+ concealment="true">
+ </multi_selector>
+</source>
--- /dev/null
+<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+<source>
+ <groupbox title="Revolution">
+ <sketch_launcher id="sketch"
+ label="Sketch"
+ icon=":icons/sketch.png"
+ tooltip="Create or edit a sketch">/>
+ </sketch_launcher>
+ <shape_selector id="axis_object"
+ icon=":icons/axis.png"
+ label="Axis"
+ tooltip="Select an edge for axis"
+ shape_types="edge"
+ default="">
+ <validator id="GeomValidators_ShapeType" parameters="line"/>
+ </shape_selector>
+ <groupbox title="From">
+ <shape_selector id="from_object"
+ icon=":icons/plane.png"
+ label="Plane face"
+ tooltip="Select a planar face"
+ shape_types="face"
+ default="<sketch>">
+ <validator id="GeomValidators_Face" parameters="plane"/>
+ </shape_selector>
+ <doublevalue id="from_angle" label="Angle"
+ min="0" step="1.0" default="0"
+ icon=":icons/angle_down.png"
+ tooltip="Angle">
+ </doublevalue>
+ </groupbox>
+ <groupbox title="To">
+ <shape_selector id="to_object"
+ icon=":icons/plane_inverted.png"
+ label="Plane face"
+ tooltip="Select a planar face"
+ shape_types="face"
+ default="<sketch>">
+ <validator id="GeomValidators_Face" parameters="plane"/>
+ </shape_selector>
+ <doublevalue id="to_angle" label="Angle"
+ min="0" step="1.0" default="0"
+ icon=":icons/angle_up.png"
+ tooltip="Angle">
+ </doublevalue>
+ </groupbox>
+ </groupbox>
+ <multi_selector id="boolean_objects"
+ label="Fuse with:"
+ icon=":icons/cut_shape.png"
+ tooltip="Objects to Fuse"
+ type_choice="Solids"
+ concealment="true">
+ </multi_selector>
+</source>