// History:
// 27/05/16 - Sergey POKHODENKO - Creation of the file
-//--------------------------------------------------------------------------------------
#include "ConstructionAPI_Plane.h"
-//--------------------------------------------------------------------------------------
+
#include <ModelHighAPI_Tools.h>
-//--------------------------------------------------------------------------------------
+
ConstructionAPI_Plane::ConstructionAPI_Plane(
const std::shared_ptr<ModelAPI_Feature> & theFeature)
: ModelHighAPI_Interface(theFeature)
const ModelHighAPI_Double & theC,
const ModelHighAPI_Double & theD)
{
- fillAttribute("PlaneByGeneralEquation", mycreationMethod);
+ fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_GENERAL_EQUATION(), mycreationMethod);
fillAttribute(theA, myA);
fillAttribute(theB, myB);
fillAttribute(theC, myC);
# Create from plane
aSession.startOperation()
aFromPlaneFeature = aPart.addFeature("Plane")
-aFromPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aFromPlaneFeature.string("creation_method").setValue("by_general_equation")
+aFromPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
aFromPlaneFeature.real("A").setValue(0.)
aFromPlaneFeature.real("B").setValue(0.)
aFromPlaneFeature.real("C").setValue(1.)
# Create to plane
aSession.startOperation()
aToPlaneFeature = aPart.addFeature("Plane")
-aToPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aToPlaneFeature.string("creation_method").setValue("by_general_equation")
+aToPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
aToPlaneFeature.real("A").setValue(0.)
aToPlaneFeature.real("B").setValue(0.)
aToPlaneFeature.real("C").setValue(1.)
# Create from plane
aSession.startOperation()
aFromPlaneFeature = aPart.addFeature("Plane")
-aFromPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aFromPlaneFeature.string("creation_method").setValue("by_general_equation")
+aFromPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
aFromPlaneFeature.real("A").setValue(0.)
aFromPlaneFeature.real("B").setValue(0.)
aFromPlaneFeature.real("C").setValue(1.)
# Create to plane
aSession.startOperation()
aToPlaneFeature = aPart.addFeature("Plane")
-aToPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aToPlaneFeature.string("creation_method").setValue("by_general_equation")
+aToPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
aToPlaneFeature.real("A").setValue(0.)
aToPlaneFeature.real("B").setValue(0.)
aToPlaneFeature.real("C").setValue(1.)
#=========================================================================
aSession.startOperation()
aPlaneFeature = aPart.addFeature("Plane")
-aPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aPlaneFeature.string("creation_method").setValue("by_general_equation")
+aPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
aPlaneFeature.real("A").setValue(0.)
aPlaneFeature.real("B").setValue(1.)
aPlaneFeature.real("C").setValue(0.)
static const std::string MY_GROUP_LIST_ID("base");
static const std::string MY_TO_OBJECT_ID("axis_object");
static const std::string METHOD_ATTR("CreationMethod");
- static const std::string MY_TO_ANGLE_ID("to_angle");
+ static const std::string MY_TO_ANGLE_ID("to_angle");
static const std::string MY_FROM_ANGLE_ID("from_angle");
static const std::string MY_TO_OBJECT_ID("to_object");
- static const std::string MY_TO_OFFSET_ID("to_offset");
+ static const std::string MY_TO_OFFSET_ID("to_offset");
static const std::string MY_FROM_OBJECT_ID("from_object");
static const std::string MY_FROM_OFFSET_ID("from_offset");
# Create from plane
aSession.startOperation()
aFromPlaneFeature = aPart.addFeature("Plane")
-aFromPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aFromPlaneFeature.string("creation_method").setValue("by_general_equation")
+aFromPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
aFromPlaneFeature.real("A").setValue(0.)
aFromPlaneFeature.real("B").setValue(0.)
aFromPlaneFeature.real("C").setValue(1.)
# Create to plane
aSession.startOperation()
aToPlaneFeature = aPart.addFeature("Plane")
-aToPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aToPlaneFeature.string("creation_method").setValue("by_general_equation")
+aToPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
aToPlaneFeature.real("A").setValue(0.)
aToPlaneFeature.real("B").setValue(0.)
aToPlaneFeature.real("C").setValue(1.)
${CAS_VIEWER}
${CAS_SHAPE}
${CAS_TKTopAlgo}
+ ${CAS_TKBO}
)
ADD_DEFINITIONS(-DGEOMAPI_EXPORTS ${CAS_DEFINITIONS})
#include "GeomAPI_Pln.h"
#include "GeomAPI_Pnt.h"
+#include <BOPTools_AlgoTools.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <Geom_Surface.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
+#include <IntTools_Context.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
const TopoDS_Shape& aMyShape = const_cast<GeomAPI_Face*>(this)->impl<TopoDS_Shape>();
const TopoDS_Shape& aInShape = theFace->impl<TopoDS_Shape>();
- Handle(Geom_Surface) aMySurf = BRep_Tool::Surface(TopoDS::Face(aMyShape));
- Handle(Geom_Surface) aInSurf = BRep_Tool::Surface(TopoDS::Face(aInShape));
+ TopoDS_Face aMyFace = TopoDS::Face(aMyShape);
+ TopoDS_Face aInFace = TopoDS::Face(aInShape);
+
+ Handle(Geom_Surface) aMySurf = BRep_Tool::Surface(aMyFace);
+ Handle(Geom_Surface) aInSurf = BRep_Tool::Surface(aInFace);
// Check that surfaces a the same type
if (aMySurf->DynamicType() != aInSurf->DynamicType())
fabs(aMyVMax - aInVMax) > Precision::PConfusion())
return false;
- return true;
+ Handle(IntTools_Context) aContext = new IntTools_Context();
+ Standard_Boolean aRes = BOPTools_AlgoTools::CheckSameGeom(aMyFace, aInFace, aContext);
+
+ return aRes == Standard_True;
}
bool GeomAPI_Face::isCylindrical() const
aSession.startOperation("Make Plane")
aSession.setActiveDocument(aPartSet)
aPlane = aPartSet.addFeature("Plane")
-aPlane.string("CreationMethod").setValue("PlaneByFaceAndDistance")
+aPlane.string("creation_method").setValue("by_other_plane")
+aPlane.string("by_other_plane_option").setValue("by_distance_from_other")
+aPlane.selection("plane").selectSubShape("face", "Part_1/Extrusion_1_1/Generated_Face_3")
aPlane.real("distance").setValue(0)
-aPlane.selection("planeFace").selectSubShape("face", "Part_1/Extrusion_1_1/Generated_Face_3")
aSession.finishOperation()
#=========================================================================
#Check the naming by selecting a face and making a plane out of it
aPlaneTop = aPart.addFeature("Plane")
assert(aPlaneTop.getKind() == "Plane")
-aPlaneTop.string("CreationMethod").setValue("PlaneByFaceAndDistance")
-aSelectionAttr = aPlaneTop.selection("planeFace")
+aPlaneTop.string("creation_method").setValue("by_other_plane")
+aSelectionAttr = aPlaneTop.selection("plane")
aSelectionAttr.selectSubShape("face", "Box_1_1/Top_1")
+aPlaneTop.string("by_other_plane_option").setValue("by_distance_from_other")
aPlaneTop.real("distance").setValue(0.4)
aPlaneTop.execute()
#Check the naming by selecting a face and making a plane out of it
aPlaneRight = aPart.addFeature("Plane")
assert(aPlaneRight.getKind() == "Plane")
-aPlaneRight.string("CreationMethod").setValue("PlaneByFaceAndDistance")
-aSelectionAttr = aPlaneRight.selection("planeFace")
+aPlaneRight.string("creation_method").setValue("by_other_plane")
+aSelectionAttr = aPlaneRight.selection("plane")
aSelectionAttr.selectSubShape("face", "Box_2_1/Right_1")
+aPlaneRight.string("by_other_plane_option").setValue("by_distance_from_other")
aPlaneRight.real("distance").setValue(0.5)
aPlaneRight.execute()