CMAKE_MINIMUM_REQUIRED(VERSION 2.8.10)
PROJECT (NewGEOM)
-SET (NewGeom_Version 1.2.0)
+SET (NewGeom_Version 1.2.1)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH})
FeaturesPlugin.h
FeaturesPlugin_Plugin.h
FeaturesPlugin_Extrusion.h
+ FeaturesPlugin_ExtrusionCut.h
FeaturesPlugin_Revolution.h
+ FeaturesPlugin_Rotation.h
FeaturesPlugin_Boolean.h
FeaturesPlugin_Group.h
FeaturesPlugin_Placement.h
SET(PROJECT_SOURCES
FeaturesPlugin_Plugin.cpp
FeaturesPlugin_Extrusion.cpp
+ FeaturesPlugin_ExtrusionCut.cpp
FeaturesPlugin_Revolution.cpp
+ FeaturesPlugin_Rotation.cpp
FeaturesPlugin_Boolean.cpp
FeaturesPlugin_Group.cpp
FeaturesPlugin_Placement.cpp
SET(XML_RESOURCES
plugin-Features.xml
extrusion_widget.xml
+ extrusioncut_widget.xml
revolution_widget.xml
+ rotation_widget.xml
boolean_widget.xml
group_widget.xml
placement_widget.xml
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesPlugin_ExtrusionCut.cpp
+// Created: 12 May 2015
+// Author: Dmitry Bobylev
+
+#include <FeaturesPlugin_ExtrusionCut.h>
+
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeReference.h>
+#include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
+
+//=================================================================================================
+FeaturesPlugin_ExtrusionCut::FeaturesPlugin_ExtrusionCut()
+{
+}
+
+//=================================================================================================
+void FeaturesPlugin_ExtrusionCut::initAttributes()
+{
+ data()->addAttribute(FeaturesPlugin_ExtrusionCut::SKETCH_OBJECT_ID(), ModelAPI_AttributeReference::typeId());
+
+ data()->addAttribute(FeaturesPlugin_ExtrusionCut::TO_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(FeaturesPlugin_ExtrusionCut::FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
+
+ data()->addAttribute(FeaturesPlugin_ExtrusionCut::AXIS_OBJECT_ID(), ModelAPI_AttributeReference::typeId());
+
+ data()->addAttribute(FeaturesPlugin_ExtrusionCut::FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(FeaturesPlugin_ExtrusionCut::TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_ExtrusionCut::FROM_OBJECT_ID());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_ExtrusionCut::TO_OBJECT_ID());
+
+ AttributeSelectionListPtr aSelection =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
+ FeaturesPlugin_ExtrusionCut::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
+ // extrusion works with faces always
+ aSelection->setSelectionType("SOLID");
+}
+
+//=================================================================================================
+void FeaturesPlugin_ExtrusionCut::execute()
+{
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesPlugin_ExtrusionCut.h
+// Created: 12 May 2015
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesPlugin_ExtrusionCut_H_
+#define FeaturesPlugin_ExtrusionCut_H_
+
+#include <FeaturesPlugin.h>
+
+#include <ModelAPI_Feature.h>
+
+/** \class FeaturesPlugin_ExtrusionCut
+ * \ingroup Plugins
+ */
+class FeaturesPlugin_ExtrusionCut : public ModelAPI_Feature
+{
+ public:
+ /// Revolution kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_REVOLUTION_ID("ExtrusionCut");
+ return MY_REVOLUTION_ID;
+ }
+
+ /// attribute name of references sketch entities list, it should contain a sketch result or
+ /// a pair a sketch result to sketch face
+ inline static const std::string& LIST_ID()
+ {
+ static const std::string MY_GROUP_LIST_ID("main_objects");
+ return MY_GROUP_LIST_ID;
+ }
+
+ /// attribute name of an object to which the extrusion grows
+ inline static const std::string& SKETCH_OBJECT_ID()
+ {
+ static const std::string MY_TO_OBJECT_ID("sketch");
+ return MY_TO_OBJECT_ID;
+ }
+
+ /// Attribute name of an object to which the extrusion grows.
+ inline static const std::string& AXIS_OBJECT_ID()
+ {
+ static const std::string MY_TO_OBJECT_ID("axis_object");
+ return MY_TO_OBJECT_ID;
+ }
+
+ /// attribute name of extrusion size
+ inline static const std::string& TO_SIZE_ID()
+ {
+ static const std::string MY_TO_SIZE_ID("to_size");
+ return MY_TO_SIZE_ID;
+ }
+
+ /// attribute name of extrusion size
+ inline static const std::string& FROM_SIZE_ID()
+ {
+ static const std::string MY_FROM_SIZE_ID("from_size");
+ return MY_FROM_SIZE_ID;
+ }
+
+ /// attribute name of an object to which the extrusion 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 tool object
+ inline static const std::string& FROM_OBJECT_ID()
+ {
+ static const std::string MY_FROM_OBJECT_ID("from_object");
+ return MY_FROM_OBJECT_ID;
+ }
+
+ /// Returns the kind of a feature
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_ExtrusionCut::ID();
+ return MY_KIND;
+ }
+
+ /// Creates a new part document if needed.
+ FEATURESPLUGIN_EXPORT virtual void execute();
+
+ /// Request for initialization of data model of the feature: adding all attributes.
+ FEATURESPLUGIN_EXPORT virtual void initAttributes();
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_ExtrusionCut();
+};
+
+#endif
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeSelection.h>
#include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeSelectionList.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Face.h>
void FeaturesPlugin_Placement::initAttributes()
{
+ /* Modification for specification of 1.3.0
+ AttributeSelectionListPtr aSelection =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
+ FeaturesPlugin_Placement::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
+ // extrusion works with faces always
+ aSelection->setSelectionType("SOLID");
+ */
data()->addAttribute(FeaturesPlugin_Placement::BASE_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
data()->addAttribute(FeaturesPlugin_Placement::ATTRACT_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
data()->addAttribute(FeaturesPlugin_Placement::REVERSE_ID(), ModelAPI_AttributeBoolean::typeId());
static const std::string MY_PLACEMENT_ID("Placement");
return MY_PLACEMENT_ID;
}
+ /// attribute name of references sketch entities list, it should contain a sketch result or
+ /// a pair a sketch result to sketch face
+ /*Modification for specification of 1.3.0
+ inline static const std::string& LIST_ID()
+ {
+ static const std::string MY_GROUP_LIST_ID("base");
+ return MY_GROUP_LIST_ID;
+ }*/
/// attribute name of referenced object
inline static const std::string& BASE_OBJECT_ID()
{
#include <FeaturesPlugin_Boolean.h>
#include <FeaturesPlugin_Extrusion.h>
+#include <FeaturesPlugin_ExtrusionCut.h>
#include <FeaturesPlugin_Group.h>
#include <FeaturesPlugin_Placement.h>
#include <FeaturesPlugin_Revolution.h>
+#include <FeaturesPlugin_Rotation.h>
#include <ModelAPI_Session.h>
if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
return FeaturePtr(new FeaturesPlugin_Extrusion);
} else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
- return FeaturePtr(new FeaturesPlugin_Revolution);
+ return FeaturePtr(new FeaturesPlugin_Revolution);
+ } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
+ return FeaturePtr(new FeaturesPlugin_Rotation);
} else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
return FeaturePtr(new FeaturesPlugin_Boolean);
} else if (theFeatureID == FeaturesPlugin_Group::ID()) {
return FeaturePtr(new FeaturesPlugin_Group);
} else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
return FeaturePtr(new FeaturesPlugin_Placement);
+ } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
+ return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
}
// feature of such kind is not found
return FeaturePtr();
#define FACE 4
#define EDGE 6
-#define _GENERATE_TAG 1
-#define _FIRST_TAG 2
-#define _LAST_TAG 3
+#define _LATERAL_TAG 1
+#define _FROM_TAG 2
+#define _TO_TAG 3
//=================================================================================================
FeaturesPlugin_Revolution::FeaturesPlugin_Revolution()
GeomAPI_DataMapOfShapeShape* aSubShapes = new GeomAPI_DataMapOfShapeShape();
theFeature.mapOfShapes(*aSubShapes);
- std::string aGeneratedName = "Generated";
- theResultBody->loadAndOrientGeneratedShapes(theFeature.makeShape(), theBasis, EDGE,_GENERATE_TAG, aGeneratedName, *aSubShapes);
+ std::string aGeneratedName = "LateralFace";
+ theResultBody->loadAndOrientGeneratedShapes(theFeature.makeShape(), theBasis, EDGE,_LATERAL_TAG, aGeneratedName, *aSubShapes);
- //Insert bottom face
+ //Insert from face
std::string aBotName = "FromFace";
std::shared_ptr<GeomAPI_Shape> aBottomFace = theFeature.firstShape();
if(!aBottomFace->isNull()) {
if(aSubShapes->isBound(aBottomFace)) {
aBottomFace = aSubShapes->find(aBottomFace);
}
- theResultBody->generated(aBottomFace, aBotName, _FIRST_TAG);
+ theResultBody->generated(aBottomFace, aBotName, _FROM_TAG);
}
- //Insert top face
+ //Insert to face
std::string aTopName = "ToFace";
std::shared_ptr<GeomAPI_Shape> aTopFace = theFeature.lastShape();
if (!aTopFace->isNull()) {
if (aSubShapes->isBound(aTopFace)) {
aTopFace = aSubShapes->find(aTopFace);
}
- theResultBody->generated(aTopFace, aTopName, _LAST_TAG);
+ theResultBody->generated(aTopFace, aTopName, _TO_TAG);
}
}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesPlugin_Rotation.cpp
+// Created: 12 May 2015
+// Author: Dmitry Bobylev
+
+#include <FeaturesPlugin_Rotation.h>
+
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_Session.h>
+
+//=================================================================================================
+FeaturesPlugin_Rotation::FeaturesPlugin_Rotation()
+{
+}
+
+//=================================================================================================
+void FeaturesPlugin_Rotation::initAttributes()
+{
+ AttributeSelectionListPtr aSelection =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
+ FeaturesPlugin_Rotation::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
+ // revolution works with faces always
+ aSelection->setSelectionType("SOLID");
+
+ data()->addAttribute(FeaturesPlugin_Rotation::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+
+ data()->addAttribute(FeaturesPlugin_Rotation::ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
+}
+
+//=================================================================================================
+void FeaturesPlugin_Rotation::execute()
+{
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesPlugin_Rotation.h
+// Created: 12 May 2015
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesPlugin_Rotation_H_
+#define FeaturesPlugin_Rotation_H_
+
+#include <FeaturesPlugin.h>
+
+#include <ModelAPI_Feature.h>
+
+/** \class FeaturesPlugin_Rotation
+ * \ingroup Plugins
+ * \brief Feature for creation of revolution from the planar face.
+ * Revolution creates the lateral faces based on edges of the base face and
+ * the start and end faces and/or start and end angles.
+ */
+class FeaturesPlugin_Rotation : public ModelAPI_Feature
+{
+ public:
+ /// Revolution kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_REVOLUTION_ID("Rotation");
+ return MY_REVOLUTION_ID;
+ }
+
+ /// Attribute name of references sketch entities list, it should contain a sketch result or
+ /// a pair a sketch result to sketch face.
+ inline static const std::string& LIST_ID()
+ {
+ static const std::string MY_GROUP_LIST_ID("base");
+ return MY_GROUP_LIST_ID;
+ }
+
+ /// Attribute name of an object to which the extrusion grows.
+ inline static const std::string& AXIS_OBJECT_ID()
+ {
+ static const std::string MY_TO_OBJECT_ID("axis_object");
+ return MY_TO_OBJECT_ID;
+ }
+
+ /// Attribute name of revolution angle.
+ inline static const std::string& ANGLE_ID()
+ {
+ static const std::string MY_TO_ANGLE_ID("angle");
+ return MY_TO_ANGLE_ID;
+ }
+
+ /// \return the kind of a feature.
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_Rotation::ID();
+ return MY_KIND;
+ }
+
+ /// Creates a new part document if needed.
+ FEATURESPLUGIN_EXPORT virtual void execute();
+
+ /// Request for initialization of data model of the feature: adding all attributes.
+ FEATURESPLUGIN_EXPORT virtual void initAttributes();
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_Rotation();
+};
+
+#endif
--- /dev/null
+<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+<source>
+ <groupbox title="Revolution">
+ <shape_selector id="main_objects"
+ label="Select an object"
+ icon=":icons/sketch.png"
+ tooltip="Select a destination element"
+ shape_types="face edge vertex"
+ default="<sketch>"
+ />
+ <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_size"
+ label="Angle"
+ min="0"
+ step="1.0"
+ default="0"
+ icon=":icons/angle_down.png"
+ tooltip="Height">
+ </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_size"
+ label="Angle"
+ min="0"
+ step="1.0"
+ default="0"
+ icon=":icons/angle_down.png"
+ tooltip="Height">
+ </doublevalue>
+ </groupbox>
+ </groupbox>
+ <multi_selector id="main_objects"
+ label="Cut from:"
+ icon=":icons/cut_shape.png"
+ tooltip="Select a sketch face"
+ type_choice="Solids">
+ </multi_selector>
+</source>
<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
<source>
+ <!--Modification for specification of 1.3.0
+ <multi_selector id="base"
+ label="Select a sketch face"
+ icon=":icons/cut_shape.png"
+ tooltip="Select a sketch face"
+ type_choice="Solids">
+ </multi_selector>-->
+ <!--Modification for specification of 1.3.0
+ icon=":icons/placement_from.png"-->
<shape_selector id="placement_base_object"
label="Select an object"
icon=":icons/cut_shape.png"
tooltip="Select a destination element"
shape_types="face edge vertex"
/>
+ <!--Modification for specification of 1.3.0
+ icon=":icons/placement_to.png"-->
<shape_selector id="placement_attractable_object"
label="Select an object"
- icon=":icons/cut_shape.png"
+ icon=":icons/cut_shape.png"
tooltip="Select an element of moved object"
shape_types="face edge vertex"
concealment="true" >
<feature id="Placement" title="Placement" tooltip="Perform moving of an object to specified position" icon=":icons/placement.png">
<source path="placement_widget.xml"/>
</feature>
+ <!--Modification for specification of 1.3.0
+ <feature id="Rotation" title="Movement" tooltip="" icon=":icons/placement.png">
+ <source path="rotation_widget.xml"/>
+ </feature>
+ <feature id="ExtrusionCut" title="RevolutionCut" tooltip="" icon=":icons/placement.png">
+ <source path="extrusioncut_widget.xml"/>
+ </feature>-->
</group>
<group id="Collections">
<feature id="Group"
--- /dev/null
+<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+<source>
+ <multi_selector id="base"
+ label="Select a sketch face"
+ icon=":icons/cut_shape.png"
+ tooltip="Select a sketch face"
+ type_choice="Solids">
+ </multi_selector>
+ <shape_selector id="axis_object"
+ icon=":icons/axis.png"
+ label="Axis"
+ tooltip="Select an edge for axis"
+ shape_types="edge"
+ default="">
+ </shape_selector>
+ <doublevalue
+ id="angle"
+ label="Angle"
+ min="0"
+ step="1.0"
+ default="0"
+ icon=":icons/radius.png"
+ tooltip="Angle">
+ </doublevalue>
+</source>
\ No newline at end of file
for(NCollection_Map<TopoDS_Shape>::Iterator aShapeIt(anAlgoShapes); aShapeIt.More(); aShapeIt.Next()) {
const TopoDS_Shape& aShape = aShapeIt.Value();
const TopTools_ListOfShape& aGeneratedList = aBuilder->Generated(aShape);
- const TopTools_ListOfShape& aModifiedList = aBuilder->Modified(aShape);
for(TopTools_ListIteratorOfListOfShape anIt(aGeneratedList); anIt.More(); anIt.Next()) {
aTempShapes.Add(anIt.Value());
aResultShapes.Add(anIt.Value());
hasResults = true;
}
+ const TopTools_ListOfShape& aModifiedList = aBuilder->Modified(aShape);
for(TopTools_ListIteratorOfListOfShape anIt(aModifiedList); anIt.More(); anIt.Next()) {
aTempShapes.Add(anIt.Value());
aResultShapes.Add(anIt.Value());
}
aListOfMakeShape.push_back(std::shared_ptr<GeomAlgoAPI_MakeShape>(new GeomAlgoAPI_MakeShape(aRevolBuilder)));
aResult = aRevolBuilder->Shape();
+
+ // Setting naming.
myFirst->setImpl(new TopoDS_Shape(aRevolBuilder->FirstShape()));
myLast->setImpl(new TopoDS_Shape(aRevolBuilder->LastShape()));
} else if(myFromShape && myToShape) { // Case 2: When both bounding planes were set.
aToTrsf.SetRotation(anAxis, aToRotAngle / 180.0 * M_PI);
BRepBuilderAPI_Transform aFromTransform(aFromSolid, aFromTrsf, true);
BRepBuilderAPI_Transform aToTransform(aToSolid, aToTrsf, true);
- aFromSolid = aFromTransform.Shape();
TopoDS_Shape aRotatedFromFace = aFromTransform.Modified(aFromFace).First();
TopoDS_Shape aRotatedToFace = aToTransform.Modified(aToFace).First();
- aToSolid = aToTransform.Shape();
+ aFromSolid = aFromTransform.Shape();
+ aToSolid = aToTransform.Shape();
// Making revolution to the 360 angle.
BRepPrimAPI_MakeRevol* aRevolBuilder = new BRepPrimAPI_MakeRevol(aBasisFace, anAxis, 2 * M_PI, Standard_True);
}
aListOfMakeShape.push_back(std::shared_ptr<GeomAlgoAPI_MakeShape>(new GeomAlgoAPI_MakeShape(aFromCutBuilder)));
aResult = aFromCutBuilder->Shape();
- if(aFromCutBuilder->Modified(aRotatedFromFace).Extent() > 0) {
- myFirst->setImpl(new TopoDS_Shape(aFromCutBuilder->Modified(aRotatedFromFace).First()));
- }
// Cutting revolution with to plane.
BRepAlgoAPI_Cut* aToCutBuilder = new BRepAlgoAPI_Cut(aResult, aToSolid);
}
aListOfMakeShape.push_back(std::shared_ptr<GeomAlgoAPI_MakeShape>(new GeomAlgoAPI_MakeShape(aToCutBuilder)));
aResult = aToCutBuilder->Shape();
- if(aToCutBuilder->Modified(aRotatedToFace).Extent() > 0) {
- myLast->setImpl(new TopoDS_Shape(aToCutBuilder->Modified(aRotatedToFace).First()));
- }
- if(aToCutBuilder->Modified(myFirst->impl<TopoDS_Shape>()).Extent() > 0) {
- myFirst->setImpl(new TopoDS_Shape(aToCutBuilder->Modified(myFirst->impl<TopoDS_Shape>()).First()));
- }
// If after cut we got more than one solids then take closest to the center of mass of the base face.
aResult = findClosest(aResult, aBasisCentr);
+ // Setting naming.
+ for(TopExp_Explorer anExp(aResult, TopAbs_FACE); anExp.More (); anExp.Next ()) {
+ const TopoDS_Shape& aFaceOnResult = anExp.Current();
+ Handle(Geom_Surface) aFaceSurface = BRep_Tool::Surface(TopoDS::Face(aFaceOnResult));
+ Handle(Geom_Surface) aFromSurface = BRep_Tool::Surface(TopoDS::Face(aRotatedFromFace));
+ Handle(Geom_Surface) aToSurface = BRep_Tool::Surface(TopoDS::Face(aRotatedToFace));
+ if(aFaceSurface == aFromSurface) {
+ myFirst->setImpl(new TopoDS_Shape(aFaceOnResult));
+ }
+ if(aFaceSurface == aToSurface) {
+ myLast->setImpl(new TopoDS_Shape(aFaceOnResult));
+ }
+ }
} else { //Case 3: When only one bounding plane was set.
// Getting bounding face.
TopoDS_Face aBoundingFace;
gp_Trsf aBoundingTrsf;
aBoundingTrsf.SetRotation(anAxis, aBoundingRotAngle / 180.0 * M_PI);
BRepBuilderAPI_Transform aBoundingTransform(aBoundingSolid, aBoundingTrsf, true);
+ TopoDS_Shape aRotatedBoundingFace = aBoundingTransform.Modified(aBoundingFace).First();
aBoundingSolid = aBoundingTransform.Shape();
// Making revolution to the 360 angle.
aListOfMakeShape.push_back(std::shared_ptr<GeomAlgoAPI_MakeShape>(new GeomAlgoAPI_MakeShape(aBoundingCutBuilder)));
aResult = aBoundingCutBuilder->Shape();
TopExp_Explorer anExp1(aResult, TopAbs_SOLID);
+
+ // Setting naming.
if(aBoundingCutBuilder->Modified(aBoundingFace).Extent() > 0) {
- myLast->setImpl(new TopoDS_Shape(aBoundingCutBuilder->Modified(aBoundingFace).First()));
+ std::shared_ptr<GeomAPI_Shape> aPtr = isFromFaceSet ? myFirst : myLast;
+ aPtr->setImpl(new TopoDS_Shape(aBoundingCutBuilder->Modified(aBoundingFace).First()));
}
// Try to cut with base face. If it can not be done then keep result of cut with bounding plane.
double aBasisRotAngle = isFromFaceSet ? myToAngle : -myFromAngle;
aBasisTrsf.SetRotation(anAxis, aBasisRotAngle / 180.0 * M_PI);
BRepBuilderAPI_Transform aBasisTransform(aBasisSolid, aBasisTrsf, true);
+ TopoDS_Shape aRotatedBasisFace = aBasisTransform.Modified(aBasisFace).First();
aBasisSolid = aBasisTransform.Shape();
// Cutting revolution with basis face.
if(anExp.More()) {
aListOfMakeShape.push_back(std::shared_ptr<GeomAlgoAPI_MakeShape>(new GeomAlgoAPI_MakeShape(aBasisCutBuilder)));
aResult = aCutResult;
- if(aBasisCutBuilder->Modified(aBasisFace).Extent() > 0) {
- myFirst->setImpl(new TopoDS_Shape(aBasisCutBuilder->Modified(aBasisFace).First()));
- }
}
}
// If after cut we got more than one solids then take closest to the center of mass of the base face.
aResult = findClosest(aResult, aBasisCentr);
+
+ // Setting naming.
+ for(TopExp_Explorer anExp(aResult, TopAbs_FACE); anExp.More (); anExp.Next ()) {
+ const TopoDS_Shape& aFaceOnResult = anExp.Current();
+ Handle(Geom_Surface) aFaceSurface = BRep_Tool::Surface(TopoDS::Face(aFaceOnResult));
+ Handle(Geom_Surface) aBoundingSurface = BRep_Tool::Surface(TopoDS::Face(aRotatedBoundingFace));
+ Handle(Geom_Surface) aBasisSurface = BRep_Tool::Surface(TopoDS::Face(aRotatedBasisFace));
+ if(aFaceSurface == aBoundingSurface) {
+ std::shared_ptr<GeomAPI_Shape> aPtr = isFromFaceSet ? myFirst : myLast;
+ aPtr->setImpl(new TopoDS_Shape(aFaceOnResult));
+ }
+ if(aFaceSurface == aBasisSurface) {
+ std::shared_ptr<GeomAPI_Shape> aPtr = isFromFaceSet ? myLast : myFirst;
+ aPtr->setImpl(new TopoDS_Shape(aFaceOnResult));
+ }
+ }
}
TopExp_Explorer anExp(aResult, TopAbs_SOLID);
void Model_Document::setCurrentFeature(std::shared_ptr<ModelAPI_Feature> theCurrent,
const bool theVisible)
{
+ // blocks the flush signals to avoid each objects visualization in the viewer
+ // they should not be shown once after all modifications are performed
+ Events_Loop* aLoop = Events_Loop::loop();
+ aLoop->activateFlushes(false);
+
TDF_Label aRefLab = generalLabel().FindChild(TAG_CURRENT_FEATURE);
CompositeFeaturePtr aMain; // main feature that may nest the new current
if (theCurrent.get()) {
aRefLab.ForgetAttribute(TDF_Reference::GetID());
}
// make all features after this feature disabled in reversed order (to remove results without deps)
- static Events_Loop* aLoop = Events_Loop::loop();
static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+ static Events_ID aCreateEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
static Events_ID aDeleteEvent = aLoop->eventByName(EVENT_OBJECT_DELETED);
bool aPassed = false; // flag that the current object is already passed in cycle
ModelAPI_EventCreator::get()->sendUpdated(anIter, aRedispEvent /*, false*/);
}
}
+ // unblock the flush signals and up them after this
+ aLoop->activateFlushes(true);
+
+ aLoop->flush(aCreateEvent);
aLoop->flush(aRedispEvent);
aLoop->flush(aDeleteEvent);
}
{
return myObjs->findByName(theName);
}
+
+std::list<std::shared_ptr<ModelAPI_Feature> > Model_Document::allFeatures()
+{
+ return myObjs->allFeatures();
+}
//! selection by name.
ResultPtr findByName(const std::string theName);
+ ///! Returns all features of the document including the hidden features which are not in
+ ///! history. Not very fast method, for calling once, not in big cycles.
+ MODEL_EXPORT virtual std::list<std::shared_ptr<ModelAPI_Feature> > allFeatures();
+
protected:
//! Returns (creates if needed) the general label
TDF_Label generalLabel() const;
return FeaturePtr(); // no features at all
}
+std::list<std::shared_ptr<ModelAPI_Feature> > Model_Objects::allFeatures()
+{
+ std::list<std::shared_ptr<ModelAPI_Feature> > aResult;
+ Handle(TDataStd_ReferenceArray) aRefs;
+ if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) {
+ for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) {
+ FeaturePtr aFeature = feature(aRefs->Value(a));
+ if (aFeature.get())
+ aResult.push_back(aFeature);
+ }
+ }
+ return aResult;
+}
+
Standard_Integer HashCode(const TDF_Label& theLab, const Standard_Integer theUpper)
{
return TDF_LabelMapHasher::HashCode(theLab, theUpper);
/// be created before)
std::string featureResultGroup(FeaturePtr theFeature);
+ ///! Returns all features of the document including the hidden features which are not in
+ ///! history. Not very fast method, for calling once, not in big cycles.
+ std::list<std::shared_ptr<ModelAPI_Feature> > allFeatures();
+
+
private:
TDF_Label myMain; ///< main label of the data storage
virtual std::shared_ptr<ModelAPI_Feature> feature(
const std::shared_ptr<ModelAPI_Result>& theResult) = 0;
+ ///! Returns all features of the document including the hidden features which are not in
+ ///! history. Not very fast method, for calling once, not in big cycles.
+ virtual std::list<std::shared_ptr<ModelAPI_Feature> > allFeatures() = 0;
+
protected:
/// Only for SWIG wrapping it is here
MODELAPI_EXPORT ModelAPI_Document();
myTypeCombo->setVisible(false);
}
- QLabel* aListLabel = new QLabel(tr("Selected objects:"), this);
+// Modification for specification of 1.3.0
+ std::string aLabelText = "";//theData->getProperty("label");
+ QLabel* aListLabel = new QLabel(!aLabelText.empty() ? aLabelText.c_str()
+ : tr("Selected objects:"), this);
aMainLay->addWidget(aListLabel, 1, 0);
// if the xml definition contains one type, an information label should be shown near to the latest
if (aShapeTypes.size() == 1) {
ModuleBase_WidgetMultiSelector::~ModuleBase_WidgetMultiSelector()
{
- activateShapeSelection(false);
- activateFilters(myWorkshop, false);
-
delete myShapeValidator;
}
//********************************************************************
ModuleBase_WidgetShapeSelector::~ModuleBase_WidgetShapeSelector()
{
- activateSelection(false);
- activateFilters(myWorkshop, false);
-
delete myShapeValidator;
}
<!-- Major module parameters -->
<parameter name="name" value="NewGeom"/>
<parameter name="icon" value="newgeom.png"/>
- <parameter name="version" value="1.2.0"/>
+ <parameter name="version" value="1.2.1"/>
<parameter name="documentation" value="newgeom_help"/>
</section>
<section name="newgeom_help" >
<!-- Major module parameters -->
<parameter name="name" value="NewGeom"/>
<parameter name="icon" value="newgeom.png"/>
- <parameter name="version" value="1.2.0"/>
+ <parameter name="version" value="1.2.1"/>
<parameter name="documentation" value="newgeom_help"/>
</section>
<section name="newgeom_help" >
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultGroup.h>
#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_Events.h>
+
+#include <Events_Loop.h>
#include <QIcon>
#include <QBrush>
<file>icons/shape_group.png</file>
<file>icons/fixed.png</file>
<file>icons/placement.png</file>
+ <file>icons/placement_from.png</file>
+ <file>icons/placement_to.png</file>
<file>icons/geom_export.png</file>
<file>icons/horisontal.png</file>
<file>icons/vertical.png</file>
bool isCustomized = customizeObject(theObject);
- aContext->Display(anAISIO, isShading? Shading : Wireframe, 0, false, true, AIS_DS_Displayed);
+ int aDispMode = isShading? Shading : Wireframe;
if (isShading)
anAISIO->Attributes()->SetFaceBoundaryDraw( Standard_True );
- emit objectDisplayed(theObject, theAIS);
+ anAISIO->SetDisplayMode(aDispMode);
+ aContext->Display(anAISIO, aDispMode, 0, false, true, AIS_DS_Displayed);
+ emit objectDisplayed(theObject, theAIS);
activate(anAISIO, myActiveSelectionModes);
}
if (isUpdateViewer)