# Create a cut
#=========================================================================
aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Cut")
aBooleanFt.selectionList("main_objects").append(anExtrusionBody, None)
aBooleanFt.selectionList("tool_objects").append(aCylinderBody, None)
-aBooleanTypeCut = 0
-aBooleanFt.integer("bool_type").setValue(aBooleanTypeCut)
aBooleanFt.execute()
aSession.finishOperation()
// it's parent is "feature" or "source" or page ("case" or "box")
if(!hasParent(theNode, NODE_FEATURE, NODE_SOURCE,
WDG_GROUP, WDG_OPTIONALBOX,
- WDG_TOOLBOX_BOX, WDG_SWITCH_CASE, NULL))
+ WDG_TOOLBOX_BOX, WDG_RADIOBOX_ITEM,
+ WDG_SWITCH_CASE, NULL))
return false;
//it should not be a "source" or a "validator" node
return false;
// it's parent is "feature" or "source" or a page ("box", "case")
if(!hasParent(theNode, NODE_FEATURE, NODE_SOURCE, WDG_GROUP, WDG_OPTIONALBOX,
- WDG_TOOLBOX_BOX, WDG_SWITCH_CASE, NULL))
+ WDG_TOOLBOX_BOX, WDG_RADIOBOX_ITEM, WDG_SWITCH_CASE, NULL))
return false;
//it should not be a "source" or a "validator" node
if(!isElementNode(theNode))
return false;
- return isNode(theNode, WDG_OPTIONALBOX, WDG_SWITCH_CASE, WDG_TOOLBOX_BOX, NULL);
+ return isNode(theNode, WDG_OPTIONALBOX, WDG_SWITCH_CASE, WDG_TOOLBOX_BOX,
+ WDG_RADIOBOX_ITEM, NULL);
}
bool hasChild(xmlNodePtr theNode)
aMessage->setMainArgument(isMainArg);
std::list<std::pair<std::string, std::string> > aCases;
- xmlNodePtr aCaseNode =
- hasParentRecursive(theNode, WDG_SWITCH_CASE, WDG_TOOLBOX_BOX, WDG_OPTIONALBOX, NULL);
+ xmlNodePtr aCaseNode = hasParentRecursive(theNode,
+ WDG_SWITCH_CASE, WDG_TOOLBOX_BOX, WDG_OPTIONALBOX, WDG_RADIOBOX_ITEM, NULL);
while(aCaseNode) {
std::string aCaseNodeID = getProperty(aCaseNode, _ID);
std::string aSwitchNodeID = "";
else if (!xmlStrcmp(aName, (const xmlChar *) WDG_TOOLBOX_BOX)) {
aSwitchNode = hasParentRecursive(aCaseNode, WDG_TOOLBOX, NULL);
}
+ else if (!xmlStrcmp(aName, (const xmlChar *)WDG_RADIOBOX_ITEM)) {
+ aSwitchNode = hasParentRecursive(aCaseNode, WDG_RADIOBOX, NULL);
+ }
if (!xmlStrcmp(aName, (const xmlChar *) WDG_OPTIONALBOX)) {
/// the box is optional, attribute is in case
/// if the optional attribute value is not empty
aCases.push_back(std::make_pair(aSwitchNodeID, aCaseNodeID));
aCaseNode = hasParentRecursive(aSwitchNode, WDG_SWITCH_CASE,
- WDG_TOOLBOX_BOX, WDG_OPTIONALBOX, NULL);
+ WDG_TOOLBOX_BOX, WDG_OPTIONALBOX, WDG_RADIOBOX_ITEM, NULL);
}
aMessage->setCases(aCases);
Events_Loop::loop()->send(aMessage);
}
// container pages, like "case" or "box"
} else if (isNode(theNode, WDG_OPTIONALBOX, WDG_SWITCH, WDG_SWITCH_CASE,
- WDG_TOOLBOX, WDG_TOOLBOX_BOX, NULL)) {
+ WDG_TOOLBOX, WDG_TOOLBOX_BOX,
+ WDG_RADIOBOX, WDG_RADIOBOX_ITEM, NULL)) {
storeAttribute(theNode, _ID); // save case:caseId (or box:boxId)
}
}
void Config_FeatureReader::cleanup(xmlNodePtr theNode)
{
if (isNode(theNode, WDG_OPTIONALBOX, WDG_SWITCH, WDG_SWITCH_CASE,
- WDG_TOOLBOX, WDG_TOOLBOX_BOX, NULL)) {
+ WDG_TOOLBOX, WDG_TOOLBOX_BOX, WDG_RADIOBOX_ITEM, WDG_RADIOBOX, NULL)) {
// cleanup id of cases when leave case node
cleanupAttribute(theNode, _ID);
}
result = isNode(theNode, NODE_FEATURE,
WDG_GROUP, WDG_OPTIONALBOX,
WDG_TOOLBOX, WDG_TOOLBOX_BOX,
+ WDG_RADIOBOX, WDG_RADIOBOX_ITEM,
WDG_SWITCH, WDG_SWITCH_CASE, NULL);
}
return result;
const static char* WDG_EXPR_EDITOR = "expr_editor";
const static char* WDG_PLACE_HOLDER = "placeholder";
const static char* WDG_ACTION = "action";
+const static char* WDG_POINT_INPUT = "point_input";
// Containers
const static char* WDG_GROUP = "groupbox";
const static char* WDG_OPTIONALBOX = "optionalbox";
const static char* WDG_TOOLBOX = "toolbox";
+const static char* WDG_RADIOBOX = "radiobox";
+const static char* WDG_RADIOBOX_ITEM = "radio";
const static char* WDG_TOOLBOX_BOX = "box";
const static char* WDG_SWITCH = "switch";
const static char* WDG_SWITCH_CASE = "case";
bool Config_WidgetAPI::isPagedWidget() const
{
- return isNode(myCurrentNode, WDG_TOOLBOX, WDG_SWITCH,
+ return isNode(myCurrentNode, WDG_TOOLBOX, WDG_SWITCH, WDG_RADIOBOX,
NULL);
}
}
}
-/*//==================================================================================================
+//==================================================================================================
ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const ModelHighAPI_Selection& theEdge,
- const ModelHighAPI_Double& theDistanceValue,
- const bool theDistancePercent,
+ const ModelHighAPI_Double& theOffset,
+ const bool theUseRatio,
const bool theReverse)
: ModelHighAPI_Interface(theFeature)
{
if(initialize()) {
- setByDistanceOnEdge(theEdge, theDistanceValue, theDistancePercent, theReverse);
+ setByOffsetOnEdge(theEdge, theOffset, theUseRatio, theReverse);
}
-}*/
+}
//==================================================================================================
ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
if(initialize()) {
GeomAPI_Shape::ShapeType aType1 = getShapeType(theObject1);
GeomAPI_Shape::ShapeType aType2 = getShapeType(theObject2);
- /*
if(aType1 == GeomAPI_Shape::VERTEX && aType2 == GeomAPI_Shape::FACE) {
// If first object is vertex and second object is face then set by projection.
- setByProjection(theObject1, theObject2);
+ setByProjectionOnFace(theObject1, theObject2);
+ } else if (aType1 == GeomAPI_Shape::VERTEX && aType2 == GeomAPI_Shape::EDGE) {
+ // If first object is vertex and second object is edge then set by projection.
+ setByProjectionOnEdge(theObject1, theObject2);
} else if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::EDGE) {
// If both objects are edges then set by lines intersection.
setByLinesIntersection(theObject1, theObject2);
- } else */if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::FACE) {
+ } else if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::FACE) {
// If first object is edge and second object is face then set by line and plane intersection.
setByLineAndPlaneIntersection(theObject1, theObject2);
}
}
}
+//==================================================================================================
+ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theObject1,
+ const ModelHighAPI_Selection& theObject2,
+ const ModelHighAPI_Selection& theObject3)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize())
+ {
+ GeomAPI_Shape::ShapeType aType1 = getShapeType(theObject1);
+ GeomAPI_Shape::ShapeType aType2 = getShapeType(theObject2);
+ GeomAPI_Shape::ShapeType aType3 = getShapeType(theObject3);
+ if (aType1 == GeomAPI_Shape::FACE
+ && aType2 == GeomAPI_Shape::FACE
+ && aType3 == GeomAPI_Shape::FACE)
+ {
+ setByPlanesIntersection(theObject1, theObject2, theObject3);
+ }
+ }
+}
+
+//==================================================================================================
+ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theObject,
+ const bool theIsCircularEdge)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize())
+ {
+ if (theIsCircularEdge) {
+ setByCenterOfCircle(theObject);
+ } else {
+ setByCenterOfGravity(theObject);
+ }
+ }
+}
+
//==================================================================================================
ConstructionAPI_Point::~ConstructionAPI_Point()
{
const ModelHighAPI_Double& theZ)
{
//fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ(), mycreationMethod);
- fillAttribute(theX, myx);
- fillAttribute(theY, myy);
- fillAttribute(theZ, myz);
+
+ // TODO: Fill point attribute
+ //fillAttribute(theX, myx);
+ //fillAttribute(theY, myy);
+ //fillAttribute(theZ, myz);
+
fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ(), mycreationMethod);
execute(false);
}
-/*//==================================================================================================
-void ConstructionAPI_Point::setByDistanceOnEdge(const ModelHighAPI_Selection& theEdge,
- const ModelHighAPI_Double& theDistanceValue,
- const bool theDistancePercent,
- const bool theReverse)
+//==================================================================================================
+void ConstructionAPI_Point::setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge,
+ const ModelHighAPI_Double& theOffset,
+ const bool theUseRatio,
+ const bool theReverse)
{
fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_DISTANCE_ON_EDGE(), mycreationMethod);
fillAttribute(theEdge, myedge);
- fillAttribute(theDistanceValue, mydistanceValue);
- fillAttribute(theDistancePercent, mydistancePercent);
+ if (theUseRatio) {
+ fillAttribute(ConstructionPlugin_Point::OFFSET_TYPE_BY_RATIO(), myoffsetType);
+ fillAttribute(theOffset, myratio);
+ }
+ else {
+ fillAttribute(ConstructionPlugin_Point::OFFSET_TYPE_BY_DISTANCE(), myoffsetType);
+ fillAttribute(theOffset, mydistance);
+ }
fillAttribute(theReverse, myreverse);
execute();
}
//==================================================================================================
-void ConstructionAPI_Point::setByProjection(const ModelHighAPI_Selection& theVertex,
- const ModelHighAPI_Selection& theFace)
+void ConstructionAPI_Point::setByProjectionOnEdge(const ModelHighAPI_Selection& theVertex,
+ const ModelHighAPI_Selection& theEdge)
+{
+ fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION(),
+ mycreationMethod);
+ fillAttribute(ConstructionPlugin_Point::PROJECTION_TYPE_ON_EDGE(),
+ myprojectionType);
+ fillAttribute(theVertex, mypoinToProject);
+ fillAttribute(theEdge, myedgeForPointProjection);
+
+ execute();
+}
+
+//==================================================================================================
+void ConstructionAPI_Point::setByProjectionOnFace(const ModelHighAPI_Selection& theVertex,
+ const ModelHighAPI_Selection& theFace)
{
- fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION(), mycreationMethod);
- fillAttribute(theVertex, mypoint);
- fillAttribute(theFace, myplane);
+ fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION(),
+ mycreationMethod);
+ fillAttribute(ConstructionPlugin_Point::PROJECTION_TYPE_ON_FACE(),
+ myprojectionType);
+ fillAttribute(theVertex, mypoinToProject);
+ fillAttribute(theFace, myfaceForPointProjection);
execute();
}
void ConstructionAPI_Point::setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
const ModelHighAPI_Selection& theEdge2)
{
- fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_LINES_INTERSECTION(), mycreationMethod);
- fillAttribute(theEdge1, myfirstLine);
- fillAttribute(theEdge2, mysecondLine);
+ fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_INTERSECTION(), mycreationMethod);
+ fillAttribute(ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINES(),
+ myintersectionType);
+ fillAttribute(theEdge1, myintersectionLine1);
+ fillAttribute(theEdge2, myintersectionLine2);
execute();
-}*/
+}
//==================================================================================================
void ConstructionAPI_Point::setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
const ModelHighAPI_Selection& theFace)
{
- fillAttribute(
- ConstructionPlugin_Point::CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION(), mycreationMethod);
+ fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_INTERSECTION(), mycreationMethod);
+ fillAttribute(ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINE_AND_PLANE(),
+ myintersectionType);
fillAttribute(theEdge, myintersectionLine);
fillAttribute(theFace, myintersectionPlane);
fillAttribute("", useOffset()); // not used by default
execute();
}
+//==================================================================================================
+void ConstructionAPI_Point::setByPlanesIntersection(const ModelHighAPI_Selection& theFace1,
+ const ModelHighAPI_Selection& theFace2,
+ const ModelHighAPI_Selection& theFace3)
+{
+ fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_INTERSECTION(), mycreationMethod);
+ fillAttribute(ConstructionPlugin_Point::INTERSECTION_TYPE_BY_PLANES(),
+ myintersectionType);
+ fillAttribute(theFace1, myintersectionPlane1);
+ fillAttribute(theFace2, myintersectionPlane2);
+ fillAttribute(theFace3, myintersectionPlane3);
+
+ execute();
+}
+
+//==================================================================================================
+void ConstructionAPI_Point::setByCenterOfGravity(const ModelHighAPI_Selection& theObject)
+{
+ fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_GEOMETRICAL_PROPERTY(),
+ mycreationMethod);
+ fillAttribute(ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY(),
+ mygeometricalPropertyType);
+ fillAttribute(theObject, myobjectForCenterOfGravity);
+}
+
+//==================================================================================================
+void ConstructionAPI_Point::setByCenterOfCircle(const ModelHighAPI_Selection& theObject)
+{
+ fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_GEOMETRICAL_PROPERTY(),
+ mycreationMethod);
+ fillAttribute(ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_CIRCLE(),
+ mygeometricalPropertyType);
+ fillAttribute(theObject, myobjectForCenterOfCircle);
+}
+
//==================================================================================================
void ConstructionAPI_Point::dump(ModelHighAPI_Dumper& theDumper) const
{
FeaturePtr aBase = feature();
const std::string& aDocName = theDumper.name(aBase->document());
- const std::string& aMeth = creationMethod()->value();
+ const std::string aMeth = creationMethod()->value();
// common part
theDumper << aBase << " = model.addPoint(" << aDocName << ", ";
if (aMeth == "" || // default is XYZ
aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ()) {
- theDumper << x() << ", " << y() << ", " << z() << ")" << std::endl;
- } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()) {
- theDumper << intersectionLine() << ", " <<intersectionPlane() ;
- if (!useOffset()->value().empty()) { // call method with defined offset
- theDumper << ", " << offset() << ", " << reverseOffset();
+ theDumper << point() << ")" << std::endl;
+ } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_INTERSECTION()) {
+ const std::string anIntersectionType = intersectionType()->value();
+ if (anIntersectionType == ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINES())
+ {
+ theDumper << intersectionLine1() << ", " << intersectionLine2();
+ }
+ else if (anIntersectionType == ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINE_AND_PLANE())
+ {
+ theDumper << intersectionLine() << ", " << intersectionPlane();
+ if (!useOffset()->value().empty()) { // call method with defined offset
+ theDumper << ", " << offset() << ", " << reverseOffset();
+ }
+ }
+ else if (anIntersectionType == ConstructionPlugin_Point::INTERSECTION_TYPE_BY_PLANES())
+ {
+ theDumper << intersectionPlane1() << ", "
+ << intersectionPlane2() << ", "
+ << intersectionPlane3();
+ }
+ } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_DISTANCE_ON_EDGE()) {
+ theDumper << edge() << ", ";
+ if (offsetType()->value() == ConstructionPlugin_Point::OFFSET_TYPE_BY_DISTANCE()) {
+ theDumper << distance() << ", " << false;
+ }
+ else {
+ theDumper << ratio() << ", " << true;
+ }
+ theDumper << ", " << reverse()->value();
+ } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION()) {
+ theDumper << poinToProject() << ", ";
+ if (projectionType()->value() == ConstructionPlugin_Point::PROJECTION_TYPE_ON_EDGE()) {
+ theDumper << edgeForPointProjection();
+ } else {
+ theDumper << faceForPointProjection();
+ }
+ } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_GEOMETRICAL_PROPERTY()) {
+ if (geometricalPropertyType()->value() ==
+ ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY())
+ {
+ theDumper << objectForCenterOfGravity();
+ }
+ else
+ {
+ theDumper << objectForCenterOfCircle() << ", " << true;
}
- theDumper << ")" << std::endl;
}
+
+ theDumper << ")" << std::endl;
}
//==================================================================================================
return PointPtr(new ConstructionAPI_Point(aFeature, theX, theY, theZ));
}
-/*//==================================================================================================
+//==================================================================================================
PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
const ModelHighAPI_Selection& theEdge,
- const ModelHighAPI_Double& theDistanceValue,
- const bool theDistancePercent,
+ const ModelHighAPI_Double& theOffset,
+ const bool theUseRatio,
const bool theReverse)
{
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
- return PointPtr(new ConstructionAPI_Point(aFeature, theEdge, theDistanceValue, theDistancePercent, theReverse));
-}*/
+ return PointPtr(new ConstructionAPI_Point(aFeature, theEdge, theOffset, theUseRatio, theReverse));
+}
//==================================================================================================
PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
return anAPI;
}
+
+//==================================================================================================
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection& theObject1,
+ const ModelHighAPI_Selection& theObject2,
+ const ModelHighAPI_Selection& theObject3)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
+ return PointPtr(new ConstructionAPI_Point(aFeature, theObject1, theObject2, theObject3));
+}
+
+//==================================================================================================
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection& theObject,
+ const bool theIsCircularEdge)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
+ return PointPtr(new ConstructionAPI_Point(aFeature, theObject, theIsCircularEdge));
+}
const ModelHighAPI_Double& theY,
const ModelHighAPI_Double& theZ);
- /*/// Constructor with values.
+ /// Constructor with values.
CONSTRUCTIONAPI_EXPORT
ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const ModelHighAPI_Selection& theEdge,
- const ModelHighAPI_Double& theDistanceValue,
- const bool theDistancePercent = false,
+ const ModelHighAPI_Double& theOffset,
+ const bool theUseRatio = false,
const bool theReverse = false);
- */
+
/// Constructor with values: intersected objects.
CONSTRUCTIONAPI_EXPORT
ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const ModelHighAPI_Selection& theObject1,
const ModelHighAPI_Selection& theObject2);
+ /// Constructor with values: intersected objects.
+ CONSTRUCTIONAPI_EXPORT
+ ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theObject1,
+ const ModelHighAPI_Selection& theObject2,
+ const ModelHighAPI_Selection& theObject3);
+
+ /// Constructor with values: object and circular edge flag.
+ CONSTRUCTIONAPI_EXPORT
+ ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theObject,
+ const bool theIsCircularEdge = false);
+
/// Destructor.
CONSTRUCTIONAPI_EXPORT
virtual ~ConstructionAPI_Point();
- INTERFACE_9(ConstructionPlugin_Point::ID(),
- x, ConstructionPlugin_Point::X(), ModelAPI_AttributeDouble, /** X attribute */,
- y, ConstructionPlugin_Point::Y(), ModelAPI_AttributeDouble, /** Y attribute */,
- z, ConstructionPlugin_Point::Z(), ModelAPI_AttributeDouble, /** Z attribute */,
- creationMethod, ConstructionPlugin_Point::CREATION_METHOD(),
- ModelAPI_AttributeString, /** Creation method */,
- intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(),
- ModelAPI_AttributeSelection, /** Line for intersection */,
- intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(),
- ModelAPI_AttributeSelection, /** Plane for intersection */,
- useOffset, ConstructionPlugin_Point::USE_OFFSET(),
- ModelAPI_AttributeString, /** Use offset */,
- offset, ConstructionPlugin_Point::OFFSET(),
- ModelAPI_AttributeDouble, /** Offset */,
- reverseOffset, ConstructionPlugin_Point::REVERSE_OFFSET(),
- ModelAPI_AttributeBoolean, /** Reverse offset */)
-
+ INTERFACE_25(ConstructionPlugin_Point::ID(),
+ point, ConstructionPlugin_Point::point3d(), GeomDataAPI_Point, /** Point attribute */,
+ creationMethod, ConstructionPlugin_Point::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */,
+ intersectionType, ConstructionPlugin_Point::INTERSECTION_TYPE(), ModelAPI_AttributeString, /** Type of the intersection */,
+ intersectionLine1, ConstructionPlugin_Point::INTERSECTION_LINE_1(), ModelAPI_AttributeSelection, /** Line for intersection */,
+ intersectionLine2, ConstructionPlugin_Point::INTERSECTION_LINE_2(), ModelAPI_AttributeSelection, /** Line for intersection */,
+ intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(), ModelAPI_AttributeSelection, /** Line for intersection */,
+ intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(), ModelAPI_AttributeSelection, /** Plane for intersection */,
+ intersectionPlane1, ConstructionPlugin_Point::INTERSECTION_PLANE_1(), ModelAPI_AttributeSelection, /** Plane for intersection */,
+ intersectionPlane2, ConstructionPlugin_Point::INTERSECTION_PLANE_2(), ModelAPI_AttributeSelection, /** Plane for intersection */,
+ intersectionPlane3, ConstructionPlugin_Point::INTERSECTION_PLANE_3(), ModelAPI_AttributeSelection, /** Plane for intersection */,
+ useOffset, ConstructionPlugin_Point::USE_OFFSET(), ModelAPI_AttributeString, /** Use offset */,
+ offset, ConstructionPlugin_Point::OFFSET(), ModelAPI_AttributeDouble, /** Offset */,
+ reverseOffset, ConstructionPlugin_Point::REVERSE_OFFSET(), ModelAPI_AttributeBoolean, /** Reverse offset */,
+ edge, ConstructionPlugin_Point::EDGE(), ModelAPI_AttributeSelection, /** Edge */,
+ offsetType, ConstructionPlugin_Point::OFFSET_TYPE(), ModelAPI_AttributeString, /** Type of the offset on edge */,
+ distance, ConstructionPlugin_Point::DISTANCE(), ModelAPI_AttributeDouble, /** Distance */,
+ ratio, ConstructionPlugin_Point::RATIO(), ModelAPI_AttributeDouble, /** Ratio */,
+ reverse, ConstructionPlugin_Point::REVERSE(), ModelAPI_AttributeBoolean, /** Reverse */,
+ poinToProject, ConstructionPlugin_Point::POINT_TO_PROJECT(), ModelAPI_AttributeSelection, /** Point to project*/,
+ projectionType, ConstructionPlugin_Point::PROJECTION_TYPE(), ModelAPI_AttributeString, /** Type of the point projection */,
+ faceForPointProjection, ConstructionPlugin_Point::FACE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection, /** Face for point projection */,
+ edgeForPointProjection, ConstructionPlugin_Point::EDGE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection, /** Edge for point projection */,
+ geometricalPropertyType, ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE(), ModelAPI_AttributeString, /** Type of the geometrical property */,
+ objectForCenterOfGravity, ConstructionPlugin_Point::OBJECT_FOR_CENTER_OF_GRAVITY(), ModelAPI_AttributeSelection, /** Object for center of gravity */,
+ objectForCenterOfCircle, ConstructionPlugin_Point::OBJECT_FOR_CENTER_OF_CIRCLE(), ModelAPI_AttributeSelection, /** Object for center of circle */)
/// Set point values.
CONSTRUCTIONAPI_EXPORT
const ModelHighAPI_Double & theY,
const ModelHighAPI_Double & theZ);
- /*/// Set edge and distance on it for point.
+ /// Set edge and distance on it for point.
+ CONSTRUCTIONAPI_EXPORT
+ void setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge,
+ const ModelHighAPI_Double& theOffset,
+ const bool theUseRatio = false,
+ const bool theReverse = false);
+
+ /// Set point and edge for projection.
CONSTRUCTIONAPI_EXPORT
- void setByDistanceOnEdge(const ModelHighAPI_Selection& theEdge,
- const ModelHighAPI_Double& theDistanceValue,
- const bool theDistancePercent = false,
- const bool theReverse = false);
+ void setByProjectionOnEdge(const ModelHighAPI_Selection& theVertex,
+ const ModelHighAPI_Selection& theEdge);
- /// Set point and plane for projection.
+ /// Set point and face for projection.
CONSTRUCTIONAPI_EXPORT
- void setByProjection(const ModelHighAPI_Selection& theVertex,
- const ModelHighAPI_Selection& theFace);
+ void setByProjectionOnFace(const ModelHighAPI_Selection& theVertex,
+ const ModelHighAPI_Selection& theFace);
/// Set lines for intersections.
CONSTRUCTIONAPI_EXPORT
void setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
const ModelHighAPI_Selection& theEdge2);
- */
+
/// Set line and plane for intersections.
CONSTRUCTIONAPI_EXPORT
void setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
const ModelHighAPI_Selection& theFace);
+ /// Set faces for intersections.
+ CONSTRUCTIONAPI_EXPORT
+ void setByPlanesIntersection(const ModelHighAPI_Selection& theFace1,
+ const ModelHighAPI_Selection& theFace2,
+ const ModelHighAPI_Selection& theFace3);
+
+ /// Set object for center of gravity.
+ CONSTRUCTIONAPI_EXPORT
+ void setByCenterOfGravity(const ModelHighAPI_Selection& theObject);
+
+ /// Set object for center of circular edge.
+ CONSTRUCTIONAPI_EXPORT
+ void setByCenterOfCircle(const ModelHighAPI_Selection& theObject);
+
/// Dump wrapped feature
CONSTRUCTIONAPI_EXPORT
virtual void dump(ModelHighAPI_Dumper& theDumper) const;
const ModelHighAPI_Double & theY,
const ModelHighAPI_Double & theZ);
-/*/// \ingroup CPPHighAPI
+/// \ingroup CPPHighAPI
/// \brief Create Point feature
CONSTRUCTIONAPI_EXPORT
PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
const ModelHighAPI_Selection& theEdge,
- const ModelHighAPI_Double& theDistanceValue,
- const bool theDistancePercent = false,
+ const ModelHighAPI_Double& theOffset,
+ const bool theUseRatio = false,
const bool theReverse = false);
-*/
+
/// \ingroup CPPHighAPI
/// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
CONSTRUCTIONAPI_EXPORT
const ModelHighAPI_Double& theDistanceValue,
const bool theReverse = false);
+/// \ingroup CPPHighAPI
+/// \brief Create Point feature as an intersection of selected planes.
+CONSTRUCTIONAPI_EXPORT
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection& theObject1,
+ const ModelHighAPI_Selection& theObject2,
+ const ModelHighAPI_Selection& theObject3);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Point feature as a geometrical property.
+CONSTRUCTIONAPI_EXPORT
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection& theObject,
+ const bool theIsCircularEdge = false);
+
#endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */
ModelAPI
GeomAPI
GeomAlgoAPI
+ GeomDataAPI
)
SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES})
../GeomAPI
../GeomAlgoAPI
../Events
+ ../GeomDataAPI
)
ADD_UNIT_TESTS(TestAxisCreation.py
UnitTestAxis.py
TestPoint_XYZ.py
- TestPoint_LineAndPlane.py
+ TestPoint_IntersectLines.py
+ TestPoint_IntersectLineAndPlane.py
+ TestPoint_IntersectPlanes.py
+ TestPoint_Edge.py
+ TestPoint_ProjectOnEdge.py
+ TestPoint_ProjectOnFace.py
+ TestPoint_GeometricalPropertyCenterOfGravity.py
+ TestPoint_GeometricalPropertyCenterOfCircle.py
TestPointName.py
TestPlane.py)
new ConstructionPlugin_ValidatorPlaneTwoParallelPlanes());
aFactory->registerValidator("ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes",
new ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes());
+ aFactory->registerValidator("ConstructionPlugin_ValidatorPointThreeNonParallelPlanes",
+ new ConstructionPlugin_ValidatorPointThreeNonParallelPlanes());
Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_size", "Size", Config_Prop::DblSpin,
PLANE_SIZE);
#include <GeomAlgoAPI_PointBuilder.h>
#include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAPI_Circ.h>
+#include <GeomDataAPI_Point.h>
+
#include <GeomAPI_Edge.h>
#include <GeomAPI_Pnt.h>
#include <GeomAPI_Vertex.h>
//==================================================================================================
void ConstructionPlugin_Point::initAttributes()
{
- data()->addAttribute(X(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(Y(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(Z(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(point3d(), GeomDataAPI_Point::typeId());
data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
- /*data()->addAttribute(EDGE(), ModelAPI_AttributeSelection::typeId());
- data()->addAttribute(DISTANCE_VALUE(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(DISTANCE_PERCENT(), ModelAPI_AttributeBoolean::typeId());
- data()->addAttribute(REVERSE(), ModelAPI_AttributeBoolean::typeId());
-
- data()->addAttribute(POINT(), ModelAPI_AttributeSelection::typeId());
- data()->addAttribute(PLANE(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(INTERSECTION_LINE_1(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(INTERSECTION_LINE_2(), ModelAPI_AttributeSelection::typeId());
- data()->addAttribute(FIRST_LINE(), ModelAPI_AttributeSelection::typeId());
- data()->addAttribute(SECOND_LINE(), ModelAPI_AttributeSelection::typeId());
-*/
data()->addAttribute(INTERSECTION_LINE(), ModelAPI_AttributeSelection::typeId());
data()->addAttribute(INTERSECTION_PLANE(), ModelAPI_AttributeSelection::typeId());
-
data()->addAttribute(USE_OFFSET(), ModelAPI_AttributeString::typeId());
data()->addAttribute(OFFSET(), ModelAPI_AttributeDouble::typeId());
data()->addAttribute(REVERSE_OFFSET(), ModelAPI_AttributeBoolean::typeId());
+
+ data()->addAttribute(EDGE(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(OFFSET_TYPE(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(DISTANCE(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(RATIO(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(REVERSE(), ModelAPI_AttributeBoolean::typeId());
+
+ data()->addAttribute(POINT_TO_PROJECT(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(PROJECTION_TYPE(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(EDGE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(FACE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection::typeId());
+
+ data()->addAttribute(INTERSECTION_TYPE(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(INTERSECTION_PLANE_1(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(INTERSECTION_PLANE_2(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(INTERSECTION_PLANE_3(), ModelAPI_AttributeSelection::typeId());
+
+ data()->addAttribute(GEOMETRICAL_PROPERTY_TYPE(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(OBJECT_FOR_CENTER_OF_GRAVITY(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(OBJECT_FOR_CENTER_OF_CIRCLE(), ModelAPI_AttributeSelection::typeId());
}
//==================================================================================================
string(CREATION_METHOD())->value() : CREATION_METHOD_BY_XYZ();
if(aCreationMethod == CREATION_METHOD_BY_XYZ()) {
aShape = createByXYZ();
- }/* else if(aCreationMethod == CREATION_METHOD_BY_DISTANCE_ON_EDGE()) {
+ } else if(aCreationMethod == CREATION_METHOD_BY_DISTANCE_ON_EDGE()) {
aShape = createByDistanceOnEdge();
} else if(aCreationMethod == CREATION_METHOD_BY_PROJECTION()) {
- aShape = createByProjection();
- } else if(aCreationMethod == CREATION_METHOD_BY_LINES_INTERSECTION()) {
- aShape = createByLinesIntersection();
- }*/ else if(aCreationMethod == CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()) {
- // this may produce several points
- std::list<std::shared_ptr<GeomAPI_Vertex> > aPoints = createByLineAndPlaneIntersection();
- if (!aPoints.empty()) { // if no points found produce the standard error later
- int anIndex = 0;
- std::list<std::shared_ptr<GeomAPI_Vertex> >::iterator aPIter = aPoints.begin();
- for(; aPIter != aPoints.end(); aPIter++, anIndex++) {
- std::shared_ptr<ModelAPI_ResultConstruction> aConstr =
- document()->createConstruction(data(), anIndex);
- aConstr->setShape(*aPIter);
- setResult(aConstr, anIndex);
+ if (string(PROJECTION_TYPE())->value() == PROJECTION_TYPE_ON_EDGE()) {
+ aShape = createByProjectionOnEdge();
+ } else {
+ aShape = createByProjectionOnFace();
+ }
+ } else if(aCreationMethod == CREATION_METHOD_BY_INTERSECTION()) {
+ std::string anIntersectionType = string(INTERSECTION_TYPE())->value();
+ if (anIntersectionType == INTERSECTION_TYPE_BY_LINES()) {
+ aShape = createByLinesIntersection();
+ } else if (anIntersectionType == INTERSECTION_TYPE_BY_LINE_AND_PLANE()) {
+ // this may produce several points
+ std::list<std::shared_ptr<GeomAPI_Vertex> > aPoints = createByLineAndPlaneIntersection();
+ if (!aPoints.empty()) { // if no points found produce the standard error later
+ int anIndex = 0;
+ std::list<std::shared_ptr<GeomAPI_Vertex> >::iterator aPIter = aPoints.begin();
+ for (; aPIter != aPoints.end(); aPIter++, anIndex++) {
+ std::shared_ptr<ModelAPI_ResultConstruction> aConstr =
+ document()->createConstruction(data(), anIndex);
+ aConstr->setShape(*aPIter);
+ setResult(aConstr, anIndex);
+ }
+ removeResults(anIndex);
+ return;
}
- removeResults(anIndex);
- return;
+ } else {
+ aShape = createByPlanesIntersection();
+ }
+ } else if (aCreationMethod == CREATION_METHOD_BY_GEOMETRICAL_PROPERTY()) {
+ std::string aGeometricalPropertyType = string(GEOMETRICAL_PROPERTY_TYPE())->value();
+ if (aGeometricalPropertyType == GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY()) {
+ aShape = createByCenterOfGravity();
+ } else {
+ aShape = createByCenterOfCircle();
}
}
//==================================================================================================
std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByXYZ()
{
- return GeomAlgoAPI_PointBuilder::vertex(real(X())->value(),
- real(Y())->value(),
- real(Z())->value());
+ AttributePointPtr aPoint =
+ std::dynamic_pointer_cast<GeomDataAPI_Point>(data()->attribute(point3d()));
+ return GeomAlgoAPI_PointBuilder::vertex(aPoint->x(), aPoint->y(), aPoint->z());
}
-/*//==================================================================================================
+//==================================================================================================
std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByDistanceOnEdge()
{
// Get edge.
std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShape));
// Get distance value and percent flag.
- double aValue = real(DISTANCE_VALUE())->value();
- bool anIsPercent = boolean(DISTANCE_PERCENT())->value();
+ double aValue;
+ bool anIsPercent = false;
+ if (string(OFFSET_TYPE())->value() == OFFSET_TYPE_BY_DISTANCE()) {
+ aValue = real(DISTANCE())->value();
+ anIsPercent = false;
+ } else {
+ aValue = real(RATIO())->value() * 100.0;
+ anIsPercent = true;
+ }
// Get reverse flag.
bool anIsReverse = boolean(REVERSE())->value();
}
//==================================================================================================
-std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByProjection()
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByProjectionOnEdge()
{
// Get point.
- AttributeSelectionPtr aPointSelection = selection(POINT());
+ AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT());
+ GeomShapePtr aPointShape = aPointSelection->value();
+ if (!aPointShape.get()) {
+ aPointShape = aPointSelection->context()->shape();
+ }
+ std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aPointShape));
+
+ // Get edge.
+ AttributeSelectionPtr anEdgeSelection = selection(EDGE_FOR_POINT_PROJECTION());
+ GeomShapePtr anEdgeShape = anEdgeSelection->value();
+ if (!anEdgeShape.get()) {
+ anEdgeShape = anEdgeSelection->context()->shape();
+ }
+ std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(anEdgeShape));
+
+ return GeomAlgoAPI_PointBuilder::vertexByProjection(aVertex, anEdge);
+}
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByProjectionOnFace()
+{
+ // Get point.
+ AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT());
GeomShapePtr aPointShape = aPointSelection->value();
if(!aPointShape.get()) {
aPointShape = aPointSelection->context()->shape();
std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aPointShape));
// Get plane.
- AttributeSelectionPtr aPlaneSelection = selection(PLANE());
+ AttributeSelectionPtr aPlaneSelection = selection(FACE_FOR_POINT_PROJECTION());
GeomShapePtr aPlaneShape = aPlaneSelection->value();
if(!aPlaneShape.get()) {
aPlaneShape = aPlaneSelection->context()->shape();
std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByLinesIntersection()
{
// Get first line.
- AttributeSelectionPtr aFirstLineSelection= selection(FIRST_LINE());
+ AttributeSelectionPtr aFirstLineSelection= selection(INTERSECTION_LINE_1());
GeomShapePtr aFirstLineShape = aFirstLineSelection->value();
if(!aFirstLineShape.get()) {
aFirstLineShape = aFirstLineSelection->context()->shape();
std::shared_ptr<GeomAPI_Edge> aFirstEdge(new GeomAPI_Edge(aFirstLineShape));
// Get second line.
- AttributeSelectionPtr aSecondLineSelection= selection(SECOND_LINE());
+ AttributeSelectionPtr aSecondLineSelection= selection(INTERSECTION_LINE_2());
GeomShapePtr aSecondLineShape = aSecondLineSelection->value();
if(!aSecondLineShape.get()) {
aSecondLineShape = aSecondLineSelection->context()->shape();
return GeomAlgoAPI_PointBuilder::vertexByIntersection(aFirstEdge, aSecondEdge);
}
-*/
//==================================================================================================
std::list<std::shared_ptr<GeomAPI_Vertex> >
return GeomAlgoAPI_ShapeTools::intersect(anEdge, aFace,
aPlaneSelection->context()->groupName() == ModelAPI_ResultConstruction::group());
}
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByPlanesIntersection()
+{
+ // Get plane.
+ AttributeSelectionPtr aPlaneSelection1 = selection(INTERSECTION_PLANE_1());
+ GeomShapePtr aPlaneShape1 = aPlaneSelection1->value();
+ if (!aPlaneShape1.get()) {
+ aPlaneShape1 = aPlaneSelection1->context()->shape();
+ }
+ std::shared_ptr<GeomAPI_Face> aFace1(new GeomAPI_Face(aPlaneShape1));
+ std::shared_ptr<GeomAPI_Pln> aPln1 = aFace1->getPlane();
+
+ // Get plane.
+ AttributeSelectionPtr aPlaneSelection2 = selection(INTERSECTION_PLANE_2());
+ GeomShapePtr aPlaneShape2 = aPlaneSelection2->value();
+ if (!aPlaneShape2.get()) {
+ aPlaneShape2 = aPlaneSelection2->context()->shape();
+ }
+ std::shared_ptr<GeomAPI_Face> aFace2(new GeomAPI_Face(aPlaneShape2));
+ std::shared_ptr<GeomAPI_Pln> aPln2 = aFace2->getPlane();
+
+ // Get plane.
+ AttributeSelectionPtr aPlaneSelection3 = selection(INTERSECTION_PLANE_3());
+ GeomShapePtr aPlaneShape3 = aPlaneSelection3->value();
+ if (!aPlaneShape3.get()) {
+ aPlaneShape3 = aPlaneSelection3->context()->shape();
+ }
+ std::shared_ptr<GeomAPI_Face> aFace3(new GeomAPI_Face(aPlaneShape3));
+ std::shared_ptr<GeomAPI_Pln> aPln3 = aFace3->getPlane();
+
+ std::shared_ptr<GeomAPI_Vertex> aVertex;
+
+ std::shared_ptr<GeomAPI_Lin> anIntersectLine = aPln1->intersect(aPln2);
+ if (!anIntersectLine.get()) {
+ return aVertex;
+ }
+
+ std::shared_ptr<GeomAPI_Pnt> aPnt = aPln3->intersect(anIntersectLine);
+ if (aPnt.get()) {
+ aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
+ }
+
+ return aVertex;
+}
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByCenterOfGravity()
+{
+ // Get shape.
+ AttributeSelectionPtr aShapeSelection = selection(OBJECT_FOR_CENTER_OF_GRAVITY());
+ GeomShapePtr aShape = aShapeSelection->value();
+ if (!aShape.get())
+ {
+ aShape = aShapeSelection->context()->shape();
+ }
+
+ std::shared_ptr<GeomAPI_Vertex> aVertex;
+ std::shared_ptr<GeomAPI_Pnt> aPnt = GeomAlgoAPI_ShapeTools::centreOfMass(aShape);
+ if (aPnt.get())
+ {
+ aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
+ }
+
+ return aVertex;
+}
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByCenterOfCircle()
+{
+ // Get shape.
+ AttributeSelectionPtr aShapeSelection = selection(OBJECT_FOR_CENTER_OF_CIRCLE());
+ GeomShapePtr aShape = aShapeSelection->value();
+ if (!aShape.get()) {
+ aShape = aShapeSelection->context()->shape();
+ }
+ std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShape));
+ std::shared_ptr<GeomAPI_Circ> aCirc = anEdge->circle();
+
+ std::shared_ptr<GeomAPI_Vertex> aVertex;
+ std::shared_ptr<GeomAPI_Pnt> aPnt = aCirc->center();
+ if (aPnt.get()) {
+ aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
+ }
+
+ return aVertex;
+}
static const std::string MY_CREATION_METHOD_ID("by_xyz");
return MY_CREATION_METHOD_ID;
}
- /*
+
/// Attribute name for creation method.
inline static const std::string& CREATION_METHOD_BY_DISTANCE_ON_EDGE()
{
}
/// Attribute name for creation method.
- inline static const std::string& CREATION_METHOD_BY_LINES_INTERSECTION()
+ inline static const std::string& CREATION_METHOD_BY_INTERSECTION()
{
- static const std::string MY_CREATION_METHOD_ID("by_lines_intersection");
+ static const std::string MY_CREATION_METHOD_ID("by_intersection");
return MY_CREATION_METHOD_ID;
}
- */
+
/// Attribute name for creation method.
- inline static const std::string& CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()
+ inline static const std::string& CREATION_METHOD_BY_GEOMETRICAL_PROPERTY()
{
- static const std::string MY_CREATION_METHOD_ID("by_line_and_plane_intersection");
+ static const std::string MY_CREATION_METHOD_ID("by_geometrical_property");
return MY_CREATION_METHOD_ID;
}
- /// Attribute name for X coordinate.
- inline static const std::string& X()
+ inline static const std::string& point3d()
{
- static const std::string POINT_ATTR_X("x");
- return POINT_ATTR_X;
+ static const std::string POINT_ATTR("point3d");
+ return POINT_ATTR;
}
- /// Attribute name for Y coordinate.
- inline static const std::string& Y()
+ /// Attribute name for selected edge.
+ inline static const std::string& EDGE()
{
- static const std::string POINT_ATTR_Y("y");
- return POINT_ATTR_Y;
+ static const std::string ATTR_ID("edge");
+ return ATTR_ID;
}
- /// Attribute name for Z coordinate.
- inline static const std::string& Z()
+ /// Attribute name for offset type on selected edge.
+ inline static const std::string& OFFSET_TYPE()
{
- static const std::string POINT_ATTR_Z("z");
- return POINT_ATTR_Z;
+ static const std::string ATTR_ID("offset_type");
+ return ATTR_ID;
}
- /*/// Attribute name for selected edge.
- inline static const std::string& EDGE()
+ /// Attribute name for offset type by distance.
+ inline static const std::string& OFFSET_TYPE_BY_DISTANCE()
{
- static const std::string ATTR_ID("edge");
+ static const std::string ATTR_ID("offset_type_by_distance");
+ return ATTR_ID;
+ }
+
+ /// Attribute name for offset type by ratio.
+ inline static const std::string& OFFSET_TYPE_BY_RATIO()
+ {
+ static const std::string ATTR_ID("offset_type_by_ratio");
return ATTR_ID;
}
/// Attribute name for distance.
- inline static const std::string& DISTANCE_VALUE()
+ inline static const std::string& DISTANCE()
{
- static const std::string ATTR_ID("value");
+ static const std::string ATTR_ID("distance");
return ATTR_ID;
}
/// Attribute name for percent flag.
- inline static const std::string& DISTANCE_PERCENT()
+ inline static const std::string& RATIO()
{
- static const std::string ATTR_ID("percent");
+ static const std::string ATTR_ID("ratio");
return ATTR_ID;
}
return ATTR_ID;
}
- /// Attribute name for point.
- inline static const std::string& POINT()
+ /// Attribute name for point to projection.
+ inline static const std::string& POINT_TO_PROJECT()
+ {
+ static const std::string ATTR_ID("point_to_project");
+ return ATTR_ID;
+ }
+
+ /// Attribute name for projection type.
+ inline static const std::string& PROJECTION_TYPE()
+ {
+ static const std::string ATTR_ID("projection_type");
+ return ATTR_ID;
+ }
+
+ /// Attribute name for projection type on edge.
+ inline static const std::string& PROJECTION_TYPE_ON_EDGE()
{
- static const std::string ATTR_ID("point");
+ static const std::string ATTR_ID("projection_type_on_edge");
return ATTR_ID;
}
- /// Attribute name for plane.
- inline static const std::string& PLANE()
+ /// Attribute name for projection type on face.
+ inline static const std::string& PROJECTION_TYPE_ON_FACE()
{
- static const std::string ATTR_ID("plane");
+ static const std::string ATTR_ID("projection_type_on_face");
return ATTR_ID;
}
- /// Attribute name for selected first line.
- inline static const std::string& FIRST_LINE()
+ /// Attribute name for edge for point projection.
+ inline static const std::string& EDGE_FOR_POINT_PROJECTION()
+ {
+ static const std::string ATTR_ID("edge_for_point_projection");
+ return ATTR_ID;
+ }
+
+ /// Attribute name for face for point projection.
+ inline static const std::string& FACE_FOR_POINT_PROJECTION()
+ {
+ static const std::string ATTR_ID("face_for_point_projection");
+ return ATTR_ID;
+ }
+
+ /// Attribute name for intersection type.
+ inline static const std::string& INTERSECTION_TYPE()
+ {
+ static const std::string ATTR_ID("intersection_type");
+ return ATTR_ID;
+ }
+
+ /// Attribute name for intersection type by lines.
+ inline static const std::string& INTERSECTION_TYPE_BY_LINES()
+ {
+ static const std::string MY_CREATION_METHOD_ID("intersection_type_by_lines");
+ return MY_CREATION_METHOD_ID;
+ }
+
+ /// Attribute name for intersection type by line and plane.
+ inline static const std::string& INTERSECTION_TYPE_BY_LINE_AND_PLANE()
+ {
+ static const std::string MY_CREATION_METHOD_ID("intersection_type_by_line_and_plane");
+ return MY_CREATION_METHOD_ID;
+ }
+
+ /// Attribute name for intersection type by planes.
+ inline static const std::string& INTERSECTION_TYPE_BY_PLANES()
+ {
+ static const std::string MY_CREATION_METHOD_ID("intersection_type_by_planes");
+ return MY_CREATION_METHOD_ID;
+ }
+
+ /// Attribute name for selected first intersection line.
+ inline static const std::string& INTERSECTION_LINE_1()
{
- static const std::string ATTR_ID("first_line");
+ static const std::string ATTR_ID("intersection_line_1");
return ATTR_ID;
}
- /// Attribute name for selected second line.
- inline static const std::string& SECOND_LINE()
+ /// Attribute name for selected second intersection line.
+ inline static const std::string& INTERSECTION_LINE_2()
{
- static const std::string ATTR_ID("second_line");
+ static const std::string ATTR_ID("intersection_line_2");
return ATTR_ID;
}
- */
/// Attribute name for selected intersection line.
inline static const std::string& INTERSECTION_LINE()
return ATTR_ID;
}
+ /// Attribute name for selected intersection plane.
+ inline static const std::string& INTERSECTION_PLANE_1()
+ {
+ static const std::string ATTR_ID("intersection_plane_1");
+ return ATTR_ID;
+ }
+
+ /// Attribute name for selected intersection plane.
+ inline static const std::string& INTERSECTION_PLANE_2()
+ {
+ static const std::string ATTR_ID("intersection_plane_2");
+ return ATTR_ID;
+ }
+
+ /// Attribute name for selected intersection plane.
+ inline static const std::string& INTERSECTION_PLANE_3()
+ {
+ static const std::string ATTR_ID("intersection_plane_3");
+ return ATTR_ID;
+ }
+
+ /// Attribute name for property type.
+ inline static const std::string& GEOMETRICAL_PROPERTY_TYPE()
+ {
+ static const std::string ATTR_ID("geometrical_property_type");
+ return ATTR_ID;
+ }
+
+ /// Attribute name for property type by center of gravity.
+ inline static const std::string& GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY()
+ {
+ static const std::string PROPERTY_TYPE("geometrical_property_type_by_center_of_gravity");
+ return PROPERTY_TYPE;
+ }
+
+ /// Attribute name for property type by center of circle.
+ inline static const std::string& GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_CIRCLE()
+ {
+ static const std::string PROPERTY_TYPE("geometrical_property_type_by_center_of_circle");
+ return PROPERTY_TYPE;
+ }
+
+ /// Attribute name for selected object for center of gravity.
+ inline static const std::string& OBJECT_FOR_CENTER_OF_GRAVITY()
+ {
+ static const std::string ATTR_ID("object_for_center_of_gravity");
+ return ATTR_ID;
+ }
+
+ /// Attribute name for selected object for center of cricle.
+ inline static const std::string& OBJECT_FOR_CENTER_OF_CIRCLE()
+ {
+ static const std::string ATTR_ID("object_for_center_of_circle");
+ return ATTR_ID;
+ }
+
/// Creates a new part document if needed.
CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
private:
std::shared_ptr<GeomAPI_Vertex> createByXYZ();
- /*std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
- std::shared_ptr<GeomAPI_Vertex> createByProjection();
- std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();*/
+ std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
+ std::shared_ptr<GeomAPI_Vertex> createByProjectionOnEdge();
+ std::shared_ptr<GeomAPI_Vertex> createByProjectionOnFace();
+ std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();
std::list<std::shared_ptr<GeomAPI_Vertex> > createByLineAndPlaneIntersection();
-
+ std::shared_ptr<GeomAPI_Vertex> createByPlanesIntersection();
+ std::shared_ptr<GeomAPI_Vertex> createByCenterOfGravity();
+ std::shared_ptr<GeomAPI_Vertex> createByCenterOfCircle();
};
#endif
std::shared_ptr<GeomAPI_Lin> aLine1 = aLineEdge1->line();
std::shared_ptr<GeomAPI_Lin> aLine2 = aLineEdge2->line();
+ if (!aLine1.get() || !aLine2.get()) {
+ theError = "Selected edge is not a line.";
+ return false;
+ }
+
if(!aLine1->isCoplanar(aLine2)) {
theError = "Selected lines not coplanar.";
return false;
return true;
}
+//==================================================================================================
+bool ConstructionPlugin_ValidatorPointThreeNonParallelPlanes::isValid(
+ const AttributePtr& theAttribute,
+ const std::list<std::string>& theArguments,
+ Events_InfoMessage& theError) const
+{
+ FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
+
+ AttributeSelectionPtr anAttribute1 =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
+ AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front());
+ AttributeSelectionPtr anAttribute3 = aFeature->selection(theArguments.back());
+
+ GeomShapePtr aShape1 = anAttribute1->value();
+ ResultPtr aContext1 = anAttribute1->context();
+ if (!aContext1.get()) {
+ theError = "One of the attribute not initialized.";
+ return false;
+ }
+ if (!aShape1.get()) {
+ aShape1 = aContext1->shape();
+ }
+
+ std::shared_ptr<GeomAPI_Pln> aPln1 = getPln(aShape1);
+ if (!aPln1.get()) {
+ theError = "Wrong shape types selected.";
+ return false;
+ }
+ std::shared_ptr<GeomAPI_Dir> aDir1 = aPln1->direction();
+
+ if (anAttribute2.get()) {
+ GeomShapePtr aShape2 = anAttribute2->value();
+ ResultPtr aContext2 = anAttribute2->context();
+ if (!aShape2.get() && aContext2.get()) {
+ aShape2 = aContext2->shape();
+ }
+
+ if (aShape2.get()) {
+ std::shared_ptr<GeomAPI_Pln> aPln2 = getPln(aShape2);
+ if (!aPln2.get()) {
+ theError = "Wrong shape types selected.";
+ return false;
+ }
+ std::shared_ptr<GeomAPI_Dir> aDir2 = aPln2->direction();
+ if (aDir1->isParallel(aDir2)) {
+ theError = "Planes are parallel.";
+ return false;
+ }
+ }
+ }
+
+ if (anAttribute3.get()) {
+ GeomShapePtr aShape3 = anAttribute3->value();
+ ResultPtr aContext3 = anAttribute3->context();
+ if (!aShape3.get() && aContext3.get()) {
+ aShape3 = aContext3->shape();
+ }
+
+ if (aShape3.get()) {
+ std::shared_ptr<GeomAPI_Pln> aPln3 = getPln(aShape3);
+ if (!aPln3.get()) {
+ theError = "Wrong shape types selected.";
+ return false;
+ }
+ std::shared_ptr<GeomAPI_Dir> aDir3 = aPln3->direction();
+ if (aDir1->isParallel(aDir3)) {
+ theError = "Planes are parallel.";
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
std::shared_ptr<GeomAPI_Edge> getEdge(const GeomShapePtr theShape)
{
if(!theShape->isEdge()) {
Events_InfoMessage& theError) const;
};
+/// \class ConstructionPlugin_ValidatorPointThreeNonParallelPlanes
+/// \ingroup Validators
+/// \brief A validator for selection three non parallel planes.
+class ConstructionPlugin_ValidatorPointThreeNonParallelPlanes: public ModelAPI_AttributeValidator
+{
+public:
+ //! \return True if the attribute is valid.
+ //! \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,
+ Events_InfoMessage& theError) const;
+};
+
#endif
\ No newline at end of file
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by coordinates.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(0, 0, 100, 100)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result())
+model.do()
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 50, False, False)
+Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 0.4, True, False)
+Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 0.4, True, True)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 50, 10)
+Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), 0.25, True, False)
+Point_6 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), 0.25, True, True)
+model.do()
+model.end()
+
+assert (len(Point_2.results()) > 0)
+rightPosition = GeomAPI_Vertex(35.3553390593, 35.3553390593, 0)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(40, 40, 0)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_4.results()) > 0)
+rightPosition = GeomAPI_Vertex(60, 60, 0)
+assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_5.results()) > 0)
+rightPosition = GeomAPI_Vertex(0, 50, 10)
+assert(rightPosition.isEqual(Point_5.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_6.results()) > 0)
+rightPosition = GeomAPI_Vertex(0, -50, 10)
+assert(rightPosition.isEqual(Point_6.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by center of gravity.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(-50, 25, 25)
+SketchArc_1 = Sketch_1.addArc(50, 25, 25, 25, 75, 25, True)
+model.do()
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 100)
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2"), True)
+Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), True)
+Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), True)
+model.do()
+model.end()
+
+assert (len(Point_2.results()) > 0)
+rightPosition = GeomAPI_Vertex(-50, 25, 0)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(50, 25, 0)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_4.results()) > 0)
+rightPosition = GeomAPI_Vertex(0, 0, 100)
+assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by center of gravity.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchCircle_1 = Sketch_1.addCircle(-50, 25, 25)
+SketchCircle_2 = Sketch_1.addCircle(50, 25, 25)
+model.do()
+Box_1 = model.addBox(Part_1_doc, 50, 50, 50)
+Point_2 = model.addPoint(Part_1_doc, model.selection("COMPOUND", "Sketch_1"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("SOLID", "Box_1_1"))
+Point_4 = model.addPoint(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
+Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top"))
+model.do()
+model.end()
+
+assert (len(Point_2.results()) > 0)
+rightPosition = GeomAPI_Vertex(0, 0, 25)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(25, 25, 25)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_4.results()) > 0)
+rightPosition = GeomAPI_Vertex(25, 25, 50)
+assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_5.results()) > 0)
+rightPosition = GeomAPI_Vertex(25, 0, 50)
+assert(rightPosition.isEqual(Point_5.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature as intersection of line and plane.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
+SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "Origin"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 60)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center())
+model.do()
+Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_2.addLine(60, 100, 0, 20)
+SketchArc_1 = Sketch_2.addArc(0, 0, -65.89631323066888, 61.2998850129882, -90, 0, False)
+model.do()
+
+# point by sketch face and a line
+Point_1 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"))
+model.do()
+# check the point position
+rightPosition = GeomAPI_Vertex(-15, 0, 0)
+assert(rightPosition.isEqual(Point_1.results()[0].resultSubShapePair()[0].shape()))
+
+# point by sketch face and an arc, intersection outside of the face, offset is defined
+Point_2 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchArc_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), 10, True)
+# check the point position
+rightPosition = GeomAPI_Vertex(-89.442719099991606, 0, -10)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+
+model.end()
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by lines intersection.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchLine_1 = Sketch_1.addLine(-50, 50, 50, 50)
+model.do()
+Box_1 = model.addBox(Part_1_doc, 25, 100, 100)
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Box_1_1/Back&Box_1_1/Bottom"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Box_1_1/Front&Box_1_1/Bottom"))
+model.do()
+model.end()
+
+assert (len(Point_2.results()) > 0)
+rightPosition = GeomAPI_Vertex(0, 50, 0)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(25, 50, 0)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by planes intersection.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Point_2 = model.addPoint(Part_1_doc, 50, 50, 50)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OY"), model.selection("VERTEX", "Point_1"), False)
+Plane_5 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OX"), model.selection("VERTEX", "Point_1"), False)
+Plane_6 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OZ"), model.selection("VERTEX", "Point_1"), True)
+Point_3 = model.addPoint(Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_3"))
+Box_1 = model.addBox(Part_1_doc, 50, 25, 100)
+Point_4 = model.addPoint(Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_3"), model.selection("FACE", "Box_1_1/Right"))
+model.do()
+model.end()
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(50, 50, 50)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_4.results()) > 0)
+rightPosition = GeomAPI_Vertex(50, 25, 50)
+assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
+++ /dev/null
-## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-##
-## This library is free software; you can redistribute it and/or
-## modify it under the terms of the GNU Lesser General Public
-## License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) any later version.
-##
-## This library is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-## Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public
-## License along with this library; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-##
-## See http:##www.salome-platform.org/ or
-## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-##
-
-"""
-Test case for Construction Point feature as intersection of line and plane.
-"""
-
-from salome.shaper import model
-from GeomAPI import *
-
-model.begin()
-partSet = model.moduleDocument()
-Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
-SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "Origin"))
-SketchCircle_1 = Sketch_1.addCircle(0, 0, 60)
-SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center())
-model.do()
-Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOZ"))
-SketchLine_1 = Sketch_2.addLine(60, 100, 0, 20)
-SketchArc_1 = Sketch_2.addArc(0, 0, -65.89631323066888, 61.2998850129882, -90, 0, False)
-model.do()
-
-# point by sketch face and a line
-Point_1 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"))
-model.do()
-# check the point position
-rightPosition = GeomAPI_Vertex(-15, 0, 0)
-assert(rightPosition.isEqual(Point_1.results()[0].resultSubShapePair()[0].shape()))
-
-# point by sketch face and an arc, intersection outside of the face, offset is defined
-Point_2 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchArc_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), 10, True)
-# check the point position
-rightPosition = GeomAPI_Vertex(-89.442719099991606, 0, -10)
-assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
-
-
-model.end()
-assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by coordinates.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 100)
+SketchPoint_1 = Sketch_1.addPoint(100, 100)
+model.do()
+Box_1 = model.addBox(Part_1_doc, 50, 50, 50)
+Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("EDGE", "Box_1_1/Front&Box_1_1/Right"))
+model.do()
+model.end()
+
+assert (len(Point_2.results()) > 0)
+rightPosition = GeomAPI_Vertex(70.7106781187, 70.7106781187, 0)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(50, 50, 0)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by projection point on face.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchPoint_1 = Sketch_1.addPoint(50, 50)
+model.do()
+Box_1 = model.addBox(Part_1_doc, 10, 100, 100)
+Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("FACE", "Box_1_1/Front"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("FACE", "PartSet/XOY"))
+model.do()
+model.end()
+
+assert (len(Point_2.results()) > 0)
+rightPosition = GeomAPI_Vertex(10, 0, 50)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(50, 0, 0)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
title="By X, Y, Z"
tooltip="Point at a given distance from the origin."
icon="icons/Construction/point_by_xyz_32x32.png">
- <doublevalue id="x"
- label="X "
- tooltip="X coordinate."
- icon="icons/Construction/x_size.png"
- default="0"/>
- <doublevalue id="y"
- label="Y "
- tooltip="Y coordinate."
- icon="icons/Construction/y_size.png"
- default="0"/>
- <doublevalue id="z"
- label="Z "
- tooltip="Z coordinate."
- icon="icons/Construction/z_size.png"
- default="0"/>
+ <point_input id="point3d"/>
</box>
-<!--
<box id="by_distance_on_edge"
title="By distance on edge"
tooltip="Point on an edge, at a given distance of one of its end."
shape_types="edge">
<validator id="GeomValidators_Finite"/>
</shape_selector>
- <groupbox title="Distance">
- <doublevalue id="value"
- label="Value"
- tooltip="Distance value."
- icon="icons/Construction/distance_value.png"
- default="50"/>
- <boolvalue id="percent"
- label="Percent(%)"
- tooltip="Distance in percent from length."
- default="true"/>
- </groupbox>
+ <radiobox id="offset_type">
+ <radio id="offset_type_by_distance"
+ title="Distance on edge by value"
+ tooltip="Point on an edge, at a given distance specified by value."
+ icon="icons/Construction/point_by_distance_on_edge_24x24.png">
+ <doublevalue id="distance"
+ label="Distance"
+ tooltip="Distance value."
+ min="0.0"
+ default="10">
+ </doublevalue>
+ </radio>
+ <radio id="offset_type_by_ratio"
+ title="Distance on edge by ratio"
+ tooltip="Point on an edge, at a given distance specified by ratio."
+ icon="icons/Construction/point_by_ratio_on_edge_24x24.png">
+ <doublevalue id="ratio"
+ label="Ratio"
+ tooltip="Ratio value."
+ min="0.0"
+ max="1.0"
+ default="0.5">
+ </doublevalue>
+ </radio>
+ </radiobox>
<boolvalue id="reverse"
label="Reverse"
tooltip="Distance from edge end point."
default="false"/>
</box>
<box id="by_projection"
- title="By projection"
- tooltip="Point on face surface by projection selected point."
+ title="By projection on edge or plane"
+ tooltip="Point on edge or plane by projection selected point."
icon="icons/Construction/point_by_projection_32x32.png">
- <shape_selector id="point"
+ <shape_selector id="point_to_project"
label="Point"
tooltip="Point for projection."
icon="icons/Construction/point.png"
shape_types="vertex">
</shape_selector>
- <shape_selector id="plane"
- label="Plane"
- tooltip="Plane for projection."
- icon="icons/Construction/face.png"
- shape_types="face">
- <validator id="GeomValidators_Face" parameters="plane"/>
- </shape_selector>
+ <toolbox id="projection_type">
+ <box id="projection_type_on_edge"
+ title="By projection on edge"
+ tooltip="Point on edge by projection selected point."
+ icon="icons/Construction/point_by_projection_on_edge_24x24.png">
+ <shape_selector id="edge_for_point_projection"
+ label="edge"
+ tooltip="Edge for projection."
+ icon="icons/Construction/edge.png"
+ shape_types="edge">
+ </shape_selector>
+ </box>
+ <box id="projection_type_on_face"
+ title="By projection on face"
+ tooltip="Point on face surface by projection selected point."
+ icon="icons/Construction/point_by_projection_on_face_24x24.png">
+ <shape_selector id="face_for_point_projection"
+ label="face"
+ tooltip="Face for projection."
+ icon="icons/Construction/face.png"
+ shape_types="face">
+ <validator id="GeomValidators_Face" parameters="plane"/>
+ </shape_selector>
+ </box>
+ </toolbox>
</box>
- <box id="by_lines_intersection"
- title="By two lines intersection"
- tooltip="Point by intersection of two coplanar lines."
- icon="icons/Construction/point_by_lines_intersection_32x32.png">
- <shape_selector id="first_line"
- label="First line"
- tooltip="First line."
- icon="icons/Construction/edge.png"
- shape_types="edge">
- <validator id="GeomValidators_ShapeType" parameters="line"/>
- <validator id="ConstructionPlugin_ValidatorPointLines" parameters="second_line"/>
- </shape_selector>
- <shape_selector id="second_line"
- label="Second line"
- tooltip="Second line."
- icon="icons/Construction/edge.png"
- shape_types="edge">
- <validator id="GeomValidators_ShapeType" parameters="line"/>
- <validator id="ConstructionPlugin_ValidatorPointLines" parameters="first_line"/>
- </shape_selector>
+ <box id="by_intersection"
+ title="By intersection of objects"
+ tooltip="Point on intersection of different objects."
+ icon="icons/Construction/point_by_intersection_32x32.png">
+ <toolbox id="intersection_type">
+ <box id="intersection_type_by_lines"
+ title="By two lines intersection"
+ tooltip="Point by intersection of two coplanar lines."
+ icon="icons/Construction/point_by_lines_intersection_24x24.png">
+ <shape_selector id="intersection_line_1"
+ label="First line"
+ tooltip="First line."
+ icon="icons/Construction/edge.png"
+ shape_types="edge">
+ <validator id="GeomValidators_ShapeType" parameters="line"/>
+ <validator id="ConstructionPlugin_ValidatorPointLines"
+ parameters="intersection_line_2"/>
+ </shape_selector>
+ <shape_selector id="intersection_line_2"
+ label="Second line"
+ tooltip="Second line."
+ icon="icons/Construction/edge.png"
+ shape_types="edge">
+ <validator id="GeomValidators_ShapeType" parameters="line"/>
+ <validator id="ConstructionPlugin_ValidatorPointLines"
+ parameters="intersection_line_1"/>
+ </shape_selector>
+ </box>
+ <box id="intersection_type_by_line_and_plane"
+ title="By line and plane intersection"
+ tooltip="Point by intersection of line and plane."
+ icon="icons/Construction/point_by_line_and_plane_intersection_24x24.png">
+ <shape_selector id="intersection_line"
+ label="Line"
+ tooltip="Line for intersection."
+ icon="icons/Construction/edge.png"
+ shape_types="edge">
+ <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel"
+ parameters="intersection_plane"/>
+ </shape_selector>
+ <shape_selector id="intersection_plane"
+ label="Plane"
+ tooltip="Plane for intersection."
+ icon="icons/Construction/face.png"
+ shape_types="face">
+ <validator id="GeomValidators_Face" parameters="plane"/>
+ <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel"
+ parameters="intersection_line"/>
+ </shape_selector>
+ <optionalbox id="use_offset" title="Offset from the plane">
+ <doublevalue id="offset"
+ label="Distance "
+ tooltip="Distance from the plane"
+ min="0"
+ default="0"/>
+ <boolvalue id="reverse_offset"
+ label="Reverse"
+ tooltip="Reverse offset value"
+ default="false"/>
+ </optionalbox>
+ </box>
+ <box id="intersection_type_by_planes"
+ title="By three planes intersection"
+ tooltip="Point by intersection of three planes."
+ icon="icons/Construction/point_by_planes_intersection_24x24.png">
+ <shape_selector id="intersection_plane_1"
+ label="1st plane"
+ tooltip="Select a planar face."
+ icon="icons/Construction/face.png"
+ shape_types="face">
+ <validator id="GeomValidators_Face" parameters="plane"/>
+ <validator id="ConstructionPlugin_ValidatorPointThreeNonParallelPlanes"
+ parameters="intersection_plane_2, intersection_plane_3"/>
+ </shape_selector>
+ <shape_selector id="intersection_plane_2"
+ label="2nd plane"
+ tooltip="Select a planar face."
+ icon="icons/Construction/face.png"
+ shape_types="face">
+ <validator id="GeomValidators_Face" parameters="plane"/>
+ <validator id="ConstructionPlugin_ValidatorPointThreeNonParallelPlanes"
+ parameters="intersection_plane_1, intersection_plane_3"/>
+ </shape_selector>
+ <shape_selector id="intersection_plane_3"
+ label="3rd plane"
+ tooltip="Select a planar face."
+ icon="icons/Construction/face.png"
+ shape_types="face">
+ <validator id="GeomValidators_Face" parameters="plane"/>
+ <validator id="ConstructionPlugin_ValidatorPointThreeNonParallelPlanes"
+ parameters="intersection_plane_1, intersection_plane_2"/>
+ </shape_selector>
+ </box>
+ </toolbox>
</box>
--->
- <box id="by_line_and_plane_intersection"
- title="By line and plane intersection"
- tooltip="Point by intersection of line and plane."
- icon="icons/Construction/point_by_line_and_plane_intersection_32x32.png">
- <shape_selector id="intersection_line"
- label="Line"
- tooltip="Line for intersection."
- icon="icons/Construction/edge.png"
- shape_types="edge">
- <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel" parameters="intersection_plane"/>
- </shape_selector>
- <shape_selector id="intersection_plane"
- label="Plane"
- tooltip="Plane for intersection."
- icon="icons/Construction/face.png"
- shape_types="face">
- <validator id="GeomValidators_Face" parameters="plane"/>
- <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel" parameters="intersection_line"/>
- </shape_selector>
- <optionalbox id="use_offset" title="Offset from the plane">
- <doublevalue id="offset" label="Distance " tooltip="Distance from the plane" min="0" default="0"/>
- <boolvalue id="reverse_offset" label="Reverse" tooltip="Reverse offset value" default="false"/>
- </optionalbox>
+ <box id="by_geometrical_property"
+ title="By geometrical property of object"
+ tooltip="Point by center of gravity or center of circle."
+ icon="icons/Construction/point_by_geometrical_property_32x32.png">
+ <toolbox id="geometrical_property_type">
+ <box id="geometrical_property_type_by_center_of_gravity"
+ title="By center of gravity"
+ tooltip="Point by center of gravity."
+ icon="icons/Construction/point_by_center_of_gravity_24x24.png">
+ <shape_selector id="object_for_center_of_gravity"
+ label="Object"
+ tooltip="Object for center of gravity."
+ icon="icons/Construction/shapes.png"
+ shape_types="vertices edges wires faces shells solids compsolids compounds">
+ <validator id="GeomValidators_Finite"/>
+ </shape_selector>
+ </box>
+ <box id="geometrical_property_type_by_center_of_circle"
+ title="By center of circle"
+ tooltip="Point by center of circle."
+ icon="icons/Construction/point_by_center_of_circle_24x24.png">
+ <shape_selector id="object_for_center_of_circle"
+ label="Object"
+ tooltip="Object for center of circle."
+ icon="icons/Construction/edge.png"
+ shape_types="edges">
+ <validator id="GeomValidators_ShapeType" parameters="circle"/>
+ </shape_selector>
+ </box>
+ </toolbox>
</box>
-
</toolbox>
</source>
SET(PROJECT_HEADERS
FeaturesAPI.h
- FeaturesAPI_Boolean.h
+ FeaturesAPI_BooleanCut.h
+ FeaturesAPI_BooleanFuse.h
+ FeaturesAPI_BooleanCommon.h
+ FeaturesAPI_BooleanSmash.h
+ FeaturesAPI_BooleanFill.h
FeaturesAPI_Extrusion.h
FeaturesAPI_ExtrusionBoolean.h
FeaturesAPI_Fillet.h
)
SET(PROJECT_SOURCES
- FeaturesAPI_Boolean.cpp
+ FeaturesAPI_BooleanCut.cpp
+ FeaturesAPI_BooleanFuse.cpp
+ FeaturesAPI_BooleanCommon.cpp
+ FeaturesAPI_BooleanSmash.cpp
+ FeaturesAPI_BooleanFill.cpp
FeaturesAPI_Extrusion.cpp
FeaturesAPI_ExtrusionBoolean.cpp
FeaturesAPI_Fillet.cpp
%include "std_shared_ptr.i"
// shared pointers
-%shared_ptr(FeaturesAPI_Boolean)
+%shared_ptr(FeaturesAPI_BooleanCut)
+%shared_ptr(FeaturesAPI_BooleanFuse)
+%shared_ptr(FeaturesAPI_BooleanCommon)
+%shared_ptr(FeaturesAPI_BooleanSmash)
+%shared_ptr(FeaturesAPI_BooleanFill)
%shared_ptr(FeaturesAPI_Extrusion)
%shared_ptr(FeaturesAPI_ExtrusionBoolean)
%shared_ptr(FeaturesAPI_ExtrusionCut)
%shared_ptr(FeaturesAPI_Union)
// all supported interfaces
-%include "FeaturesAPI_Boolean.h"
+%include "FeaturesAPI_BooleanCut.h"
+%include "FeaturesAPI_BooleanFuse.h"
+%include "FeaturesAPI_BooleanCommon.h"
+%include "FeaturesAPI_BooleanSmash.h"
+%include "FeaturesAPI_BooleanFill.h"
%include "FeaturesAPI_Extrusion.h"
%include "FeaturesAPI_ExtrusionBoolean.h"
%include "FeaturesAPI_Fillet.h"
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#include "FeaturesAPI_Boolean.h"
-
-#include <ModelHighAPI_Dumper.h>
-#include <ModelHighAPI_Integer.h>
-#include <ModelHighAPI_Selection.h>
-#include <ModelHighAPI_Tools.h>
-
-//==================================================================================================
-FeaturesAPI_Boolean::FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature)
-: ModelHighAPI_Interface(theFeature)
-{
- initialize();
-}
-
-//==================================================================================================
-FeaturesAPI_Boolean::FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const ModelHighAPI_Integer& theBoolType,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects)
-: ModelHighAPI_Interface(theFeature)
-{
- if(initialize()) {
- fillAttribute(theBoolType, myboolType);
- fillAttribute(theMainObjects, mymainObjects);
- fillAttribute(theToolObjects, mytoolObjects);
-
- execute(false);
- }
-}
-
-//==================================================================================================
-FeaturesAPI_Boolean::~FeaturesAPI_Boolean()
-{
-
-}
-
-//==================================================================================================
-void FeaturesAPI_Boolean::setBoolType(const ModelHighAPI_Integer& theBoolType)
-{
- fillAttribute(theBoolType, myboolType);
-
- execute();
-}
-
-//==================================================================================================
-void FeaturesAPI_Boolean::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
-{
- fillAttribute(theMainObjects, mymainObjects);
-
- execute();
-}
-
-//==================================================================================================
-void FeaturesAPI_Boolean::setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
- fillAttribute(theToolObjects, mytoolObjects);
-
- execute();
-}
-
-//==================================================================================================
-void FeaturesAPI_Boolean::dump(ModelHighAPI_Dumper& theDumper) const
-{
- FeaturePtr aBase = feature();
-
- FeaturesPlugin_Boolean::OperationType aType =
- (FeaturesPlugin_Boolean::OperationType)aBase->integer(
- FeaturesPlugin_Boolean::TYPE_ID())->value();
-
- theDumper << aBase << " = model.add";
-
- switch(aType) {
- case FeaturesPlugin_Boolean::BOOL_CUT: theDumper << "Cut"; break;
- case FeaturesPlugin_Boolean::BOOL_FUSE: theDumper << "Fuse"; break;
- case FeaturesPlugin_Boolean::BOOL_COMMON: theDumper << "Common"; break;
- case FeaturesPlugin_Boolean::BOOL_FILL: theDumper << "Fill"; break;
- case FeaturesPlugin_Boolean::BOOL_SMASH: theDumper << "Smash"; break;
- }
-
- const std::string& aDocName = theDumper.name(aBase->document());
- AttributeSelectionListPtr anObjects =
- aBase->selectionList(FeaturesPlugin_Boolean::OBJECT_LIST_ID());
- AttributeSelectionListPtr aTools = aBase->selectionList(FeaturesPlugin_Boolean::TOOL_LIST_ID());
-
- theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
-}
-
-//==================================================================================================
-BooleanPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
- return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
- FeaturesPlugin_Boolean::BOOL_CUT,
- theMainObjects,
- theToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theObjects)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
- std::list<ModelHighAPI_Selection> aToolObjects;
- return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
- FeaturesPlugin_Boolean::BOOL_FUSE,
- theObjects,
- aToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
- return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
- FeaturesPlugin_Boolean::BOOL_FUSE,
- theMainObjects,
- theToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
- return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
- FeaturesPlugin_Boolean::BOOL_COMMON,
- theMainObjects,
- theToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
- return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
- FeaturesPlugin_Boolean::BOOL_SMASH,
- theMainObjects,
- theToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addFill(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
- return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
- FeaturesPlugin_Boolean::BOOL_FILL,
- theMainObjects,
- theToolObjects));
-}
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#ifndef FeaturesAPI_Boolean_H_
-#define FeaturesAPI_Boolean_H_
-
-#include "FeaturesAPI.h"
-
-#include <FeaturesPlugin_Boolean.h>
-
-#include <ModelHighAPI_Interface.h>
-#include <ModelHighAPI_Macro.h>
-
-class ModelHighAPI_Integer;
-class ModelHighAPI_Selection;
-
-/// \class FeaturesAPI_Boolean
-/// \ingroup CPPHighAPI
-/// \brief Interface for Boolean feature.
-class FeaturesAPI_Boolean: public ModelHighAPI_Interface
-{
-public:
- /// Constructor without values.
- FEATURESAPI_EXPORT
- explicit FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature);
-
- /// Constructor with values.
- FEATURESAPI_EXPORT
- FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const ModelHighAPI_Integer& theBoolType,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects);
-
- /// Destructor.
- FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Boolean();
-
- INTERFACE_3(FeaturesPlugin_Boolean::ID(),
- boolType, FeaturesPlugin_Boolean::TYPE_ID(),
- ModelAPI_AttributeInteger, /** Operation type */,
- mainObjects, FeaturesPlugin_Boolean::OBJECT_LIST_ID(),
- ModelAPI_AttributeSelectionList, /** Main objects */,
- toolObjects, FeaturesPlugin_Boolean::TOOL_LIST_ID(),
- ModelAPI_AttributeSelectionList, /** Tool objects*/)
-
- /// Set operation type.
- FEATURESAPI_EXPORT
- void setBoolType(const ModelHighAPI_Integer& theBoolType);
-
- /// Set main objects.
- FEATURESAPI_EXPORT
- void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
-
- /// Set tool objects.
- FEATURESAPI_EXPORT
- void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
-
- /// Dump wrapped feature
- FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper& theDumper) const;
-};
-
-/// Pointer on Boolean object.
-typedef std::shared_ptr<FeaturesAPI_Boolean> BooleanPtr;
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Cut feature.
-FEATURESAPI_EXPORT
-BooleanPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Fuse feature.
-FEATURESAPI_EXPORT
-BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Fuse feature.
-FEATURESAPI_EXPORT
-BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Common feature.
-FEATURESAPI_EXPORT
-BooleanPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Smash feature.
-FEATURESAPI_EXPORT
-BooleanPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Fill feature.
-FEATURESAPI_EXPORT
-BooleanPtr addFill(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-#endif // FeaturesAPI_Boolean_H_
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanCommon.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theMainObjects, mymainObjects);
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute(false);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanCommon::~FeaturesAPI_BooleanCommon()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanCommon::setMainObjects(
+ const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanCommon::setToolObjects(
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanCommon::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+
+ theDumper << aBase << " = model.addCommon";
+
+ const std::string& aDocName = theDumper.name(aBase->document());
+ AttributeSelectionListPtr anObjects =
+ aBase->selectionList(FeaturesPlugin_BooleanCommon::OBJECT_LIST_ID());
+ AttributeSelectionListPtr aTools =
+ aBase->selectionList(FeaturesPlugin_BooleanCommon::TOOL_LIST_ID());
+
+ theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanCommonPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanCommon::ID());
+ return BooleanCommonPtr(new FeaturesAPI_BooleanCommon(aFeature,
+ theMainObjects,
+ theToolObjects));
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanCommon_H_
+#define FeaturesAPI_BooleanCommon_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanCommon.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanCommon
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Common feature.
+class FeaturesAPI_BooleanCommon: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_BooleanCommon(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_BooleanCommon(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_BooleanCommon();
+
+ INTERFACE_2(FeaturesPlugin_BooleanCommon::ID(),
+ mainObjects, FeaturesPlugin_BooleanCommon::OBJECT_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Main objects */,
+ toolObjects, FeaturesPlugin_BooleanCommon::TOOL_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set tool objects.
+ FEATURESAPI_EXPORT
+ void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanCommon> BooleanCommonPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Common feature.
+FEATURESAPI_EXPORT
+BooleanCommonPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanCommon_H_
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanCut.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theMainObjects, mymainObjects);
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute(false);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanCut::~FeaturesAPI_BooleanCut()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanCut::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanCut::setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanCut::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+
+ theDumper << aBase << " = model.addCut";
+
+ const std::string& aDocName = theDumper.name(aBase->document());
+ AttributeSelectionListPtr anObjects =
+ aBase->selectionList(FeaturesPlugin_BooleanCut::OBJECT_LIST_ID());
+ AttributeSelectionListPtr aTools =
+ aBase->selectionList(FeaturesPlugin_BooleanCut::TOOL_LIST_ID());
+
+ theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanCutPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanCut::ID());
+ return BooleanCutPtr(new FeaturesAPI_BooleanCut(aFeature,
+ theMainObjects,
+ theToolObjects));
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanCut_H_
+#define FeaturesAPI_BooleanCut_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanCut.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanCut
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Cut feature.
+class FeaturesAPI_BooleanCut: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_BooleanCut(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_BooleanCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_BooleanCut();
+
+ INTERFACE_2(FeaturesPlugin_BooleanCut::ID(),
+ mainObjects, FeaturesPlugin_BooleanCut::OBJECT_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Main objects */,
+ toolObjects, FeaturesPlugin_BooleanCut::TOOL_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set tool objects.
+ FEATURESAPI_EXPORT
+ void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanCut> BooleanCutPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Cut feature.
+FEATURESAPI_EXPORT
+BooleanCutPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanCut_H_
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanFill.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theMainObjects, mymainObjects);
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute(false);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanFill::~FeaturesAPI_BooleanFill()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanFill::setMainObjects(
+ const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanFill::setToolObjects(
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanFill::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+
+ theDumper << aBase << " = model.addFill";
+
+ const std::string& aDocName = theDumper.name(aBase->document());
+ AttributeSelectionListPtr anObjects =
+ aBase->selectionList(FeaturesPlugin_BooleanFill::OBJECT_LIST_ID());
+ AttributeSelectionListPtr aTools =
+ aBase->selectionList(FeaturesPlugin_BooleanFill::TOOL_LIST_ID());
+
+ theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanFillPtr addFill(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanFill::ID());
+ return BooleanFillPtr(new FeaturesAPI_BooleanFill(aFeature,
+ theMainObjects,
+ theToolObjects));
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanFill_H_
+#define FeaturesAPI_BooleanFill_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanFill.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanFill
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Fill feature.
+class FeaturesAPI_BooleanFill: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_BooleanFill(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_BooleanFill(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_BooleanFill();
+
+ INTERFACE_2(FeaturesPlugin_BooleanFill::ID(),
+ mainObjects, FeaturesPlugin_BooleanFill::OBJECT_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Main objects */,
+ toolObjects, FeaturesPlugin_BooleanFill::TOOL_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set tool objects.
+ FEATURESAPI_EXPORT
+ void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanFill> BooleanFillPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Fill feature.
+FEATURESAPI_EXPORT
+BooleanFillPtr addFill(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanFill_H_
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanFuse.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theMainObjects, mymainObjects);
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute(false);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanFuse::~FeaturesAPI_BooleanFuse()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanFuse::setMainObjects(
+ const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanFuse::setToolObjects(
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanFuse::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+
+ theDumper << aBase << " = model.addFuse";
+
+ const std::string& aDocName = theDumper.name(aBase->document());
+ AttributeSelectionListPtr anObjects =
+ aBase->selectionList(FeaturesPlugin_BooleanFuse::OBJECT_LIST_ID());
+ AttributeSelectionListPtr aTools =
+ aBase->selectionList(FeaturesPlugin_BooleanFuse::TOOL_LIST_ID());
+
+ theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanFuse::ID());
+ std::list<ModelHighAPI_Selection> aToolObjects;
+ return BooleanFusePtr(new FeaturesAPI_BooleanFuse(aFeature,
+ theObjects,
+ aToolObjects));
+}
+
+//==================================================================================================
+BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanFuse::ID());
+ return BooleanFusePtr(new FeaturesAPI_BooleanFuse(aFeature,
+ theMainObjects,
+ theToolObjects));
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanFuse_H_
+#define FeaturesAPI_BooleanFuse_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanFuse.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanFuse
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Fuse feature.
+class FeaturesAPI_BooleanFuse: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_BooleanFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_BooleanFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_BooleanFuse();
+
+ INTERFACE_2(FeaturesPlugin_BooleanFuse::ID(),
+ mainObjects, FeaturesPlugin_BooleanFuse::OBJECT_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Main objects */,
+ toolObjects, FeaturesPlugin_BooleanFuse::TOOL_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set tool objects.
+ FEATURESAPI_EXPORT
+ void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanFuse> BooleanFusePtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Fuse feature.
+FEATURESAPI_EXPORT
+BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Fuse feature.
+FEATURESAPI_EXPORT
+BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanFuse_H_
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanSmash.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theMainObjects, mymainObjects);
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute(false);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanSmash::~FeaturesAPI_BooleanSmash()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanSmash::setMainObjects(
+ const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanSmash::setToolObjects(
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanSmash::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+
+ theDumper << aBase << " = model.addSmash";
+
+ const std::string& aDocName = theDumper.name(aBase->document());
+ AttributeSelectionListPtr anObjects =
+ aBase->selectionList(FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID());
+ AttributeSelectionListPtr aTools =
+ aBase->selectionList(FeaturesPlugin_BooleanSmash::TOOL_LIST_ID());
+
+ theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanSmashPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanSmash::ID());
+ return BooleanSmashPtr(new FeaturesAPI_BooleanSmash(aFeature,
+ theMainObjects,
+ theToolObjects));
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanSmash_H_
+#define FeaturesAPI_BooleanSmash_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanSmash.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanSmash
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Smash feature.
+class FeaturesAPI_BooleanSmash: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_BooleanSmash(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_BooleanSmash(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_BooleanSmash();
+
+ INTERFACE_2(FeaturesPlugin_BooleanSmash::ID(),
+ mainObjects, FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Main objects */,
+ toolObjects, FeaturesPlugin_BooleanSmash::TOOL_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set tool objects.
+ FEATURESAPI_EXPORT
+ void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanSmash> BooleanSmashPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Smash feature.
+FEATURESAPI_EXPORT
+BooleanSmashPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanSmash_H_
#include <ModelHighAPI_swig.h>
#include "FeaturesAPI.h"
- #include "FeaturesAPI_Boolean.h"
+ #include "FeaturesAPI_BooleanCut.h"
+ #include "FeaturesAPI_BooleanFuse.h"
+ #include "FeaturesAPI_BooleanCommon.h"
+ #include "FeaturesAPI_BooleanSmash.h"
+ #include "FeaturesAPI_BooleanFill.h"
#include "FeaturesAPI_Extrusion.h"
#include "FeaturesAPI_ExtrusionBoolean.h"
#include "FeaturesAPI_Fillet.h"
FeaturesPlugin_Rotation.h
FeaturesPlugin_Translation.h
FeaturesPlugin_Boolean.h
+ FeaturesPlugin_BooleanCut.h
+ FeaturesPlugin_BooleanFuse.h
+ FeaturesPlugin_BooleanCommon.h
+ FeaturesPlugin_BooleanSmash.h
+ FeaturesPlugin_BooleanFill.h
FeaturesPlugin_Intersection.h
FeaturesPlugin_Partition.h
FeaturesPlugin_Pipe.h
#include <map>
//=================================================================================================
-FeaturesPlugin_Boolean::FeaturesPlugin_Boolean()
+FeaturesPlugin_Boolean::FeaturesPlugin_Boolean(const OperationType theOperationType)
+: myOperationType(theOperationType)
{
}
//=================================================================================================
void FeaturesPlugin_Boolean::initAttributes()
{
- data()->addAttribute(FeaturesPlugin_Boolean::TYPE_ID(), ModelAPI_AttributeInteger::typeId());
-
AttributeSelectionListPtr aSelection =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
FeaturesPlugin_Boolean::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
}
//=================================================================================================
-void FeaturesPlugin_Boolean::execute()
+FeaturesPlugin_Boolean::OperationType FeaturesPlugin_Boolean::operationType()
{
- // Getting operation type.
- std::shared_ptr<ModelAPI_AttributeInteger> aTypeAttr = std::dynamic_pointer_cast<
- ModelAPI_AttributeInteger>(data()->attribute(FeaturesPlugin_Boolean::TYPE_ID()));
- if (!aTypeAttr)
- return;
- OperationType aType = (FeaturesPlugin_Boolean::OperationType)aTypeAttr->value();
+ return myOperationType;
+}
+//=================================================================================================
+void FeaturesPlugin_Boolean::execute()
+{
ListOfShape anObjects, aTools, anEdgesAndFaces, aPlanes;
std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape> aCompSolidsObjects;
aCompSolidsObjects[aContextShape].push_back(anObject);
}
} else {
- if(aType != BOOL_FILL
+ if(myOperationType != BOOL_FILL
&& (anObject->shapeType() == GeomAPI_Shape::EDGE
|| anObject->shapeType() == GeomAPI_Shape::FACE))
{
ResultPtr aContext = aToolAttr->context();
aPlanes.push_back(aToolAttr->context()->shape());
}
- else if(aType != BOOL_FILL
+ else if (myOperationType != BOOL_FILL
&& (aTool->shapeType() == GeomAPI_Shape::EDGE
|| aTool->shapeType() == GeomAPI_Shape::FACE))
{
int aResultIndex = 0;
- switch(aType) {
+ switch(myOperationType) {
case BOOL_CUT:
case BOOL_COMMON:
case BOOL_FILL: {
std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
GeomShapePtr aResShape;
- switch(aType) {
+ switch(myOperationType) {
case BOOL_CUT: {
aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aListWithObject,
aTools,
aMakeShapeList.appendAlgo(aBoolAlgo);
if(GeomAlgoAPI_ShapeTools::volume(aResShape) > 1.e-27
- || (aType != BOOL_CUT && aType != BOOL_COMMON))
+ || (myOperationType != BOOL_CUT && myOperationType != BOOL_COMMON))
{
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
ListOfShape aUsedTools = aTools;
- if (aType == BOOL_FILL) {
+ if (myOperationType == BOOL_FILL) {
aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
}
loadNamingDS(aResultBody, anObject, aUsedTools, aResShape,
- aMakeShapeList, *(aBoolAlgo->mapOfSubShapes()), aType == BOOL_FILL);
+ aMakeShapeList, *(aBoolAlgo->mapOfSubShapes()),
+ myOperationType == BOOL_FILL);
setResult(aResultBody, aResultIndex);
aResultIndex++;
}
GeomAlgoAPI_MakeShapeList aMakeShapeList;
std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
- switch(aType) {
+ switch(myOperationType) {
case BOOL_CUT: {
aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aUsedInOperationSolids,
aTools,
}
if(GeomAlgoAPI_ShapeTools::volume(aResultShape) > 1.e-27
- || (aType != BOOL_CUT && aType != BOOL_COMMON))
+ || (myOperationType != BOOL_CUT && myOperationType != BOOL_COMMON))
{
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
ListOfShape aUsedTools = aTools;
- if (aType == BOOL_FILL) {
+ if (myOperationType == BOOL_FILL) {
aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
}
aResultShape,
aMakeShapeList,
aMapOfShapes,
- aType == BOOL_FILL);
+ myOperationType == BOOL_FILL);
setResult(aResultBody, aResultIndex);
aResultIndex++;
}
// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
//
-#ifndef FeaturesPlugin_Cut_H_
-#define FeaturesPlugin_Cut_H_
+#ifndef FeaturesPlugin_Boolean_H_
+#define FeaturesPlugin_Boolean_H_
#include "FeaturesPlugin.h"
BOOL_SMASH
};
- /// Feature kind.
- inline static const std::string& ID()
- {
- static const std::string MY_ID("Boolean");
- return MY_ID;
- }
-
/// Attribute name of main objects.
inline static const std::string& OBJECT_LIST_ID()
{
return MY_TOOL_LIST_ID;
}
- /// Attribute name of operation type.
- inline static const std::string& TYPE_ID()
- {
- static const std::string MY_TYPE_ID("bool_type");
- return MY_TYPE_ID;
- }
-
- /// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
- {
- static std::string MY_KIND = FeaturesPlugin_Boolean::ID();
- return MY_KIND;
- }
+ /// \return boolean operation type.
+ FEATURESPLUGIN_EXPORT OperationType operationType();
/// 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();
+protected:
+
/// Use plugin manager for features creation.
- FeaturesPlugin_Boolean();
+ FeaturesPlugin_Boolean(const OperationType theOperationType);
private:
std::shared_ptr<GeomAPI_Shape> getShape(const std::string& theAttrName);
GeomAlgoAPI_MakeShape& theMakeShape,
GeomAPI_DataMapOfShapeShape& theMapOfShapes,
const bool theIsStoreAsGenerated = false);
+
+private:
+ OperationType myOperationType;
};
#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanCommon_H_
+#define FeaturesPlugin_BooleanCommon_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanCommon
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Common operation.
+class FeaturesPlugin_BooleanCommon : public FeaturesPlugin_Boolean
+{
+public:
+
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("Common");
+ return MY_ID;
+ }
+
+ /// \return the kind of a feature.
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_BooleanCommon::ID();
+ return MY_KIND;
+ }
+
+public:
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_BooleanCommon(): FeaturesPlugin_Boolean(BOOL_COMMON) {};
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanCut_H_
+#define FeaturesPlugin_BooleanCut_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanCut
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Cut operation.
+class FeaturesPlugin_BooleanCut : public FeaturesPlugin_Boolean
+{
+public:
+
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("Cut");
+ return MY_ID;
+ }
+
+ /// \return the kind of a feature.
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_BooleanCut::ID();
+ return MY_KIND;
+ }
+
+public:
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_BooleanCut(): FeaturesPlugin_Boolean(BOOL_CUT) {};
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanFill_H_
+#define FeaturesPlugin_BooleanFill_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanFill
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Fill operation.
+class FeaturesPlugin_BooleanFill : public FeaturesPlugin_Boolean
+{
+public:
+
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("Fill");
+ return MY_ID;
+ }
+
+ /// \return the kind of a feature.
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_BooleanFill::ID();
+ return MY_KIND;
+ }
+
+public:
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_BooleanFill(): FeaturesPlugin_Boolean(BOOL_FILL) {};
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanFuse_H_
+#define FeaturesPlugin_BooleanFuse_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanFuse
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Fuse operation.
+class FeaturesPlugin_BooleanFuse : public FeaturesPlugin_Boolean
+{
+public:
+
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("Fuse");
+ return MY_ID;
+ }
+
+ /// \return the kind of a feature.
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_BooleanFuse::ID();
+ return MY_KIND;
+ }
+
+public:
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_BooleanFuse(): FeaturesPlugin_Boolean(BOOL_FUSE) {};
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanSmash_H_
+#define FeaturesPlugin_BooleanSmash_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanSmash
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Smash operation.
+class FeaturesPlugin_BooleanSmash : public FeaturesPlugin_Boolean
+{
+public:
+
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("Smash");
+ return MY_ID;
+ }
+
+ /// \return the kind of a feature.
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_BooleanSmash::ID();
+ return MY_KIND;
+ }
+
+public:
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_BooleanSmash(): FeaturesPlugin_Boolean(BOOL_SMASH) {};
+
+};
+
+#endif
#include <FeaturesPlugin_Plugin.h>
-#include <FeaturesPlugin_Boolean.h>
+#include <FeaturesPlugin_BooleanCut.h>
+#include <FeaturesPlugin_BooleanFuse.h>
+#include <FeaturesPlugin_BooleanCommon.h>
+#include <FeaturesPlugin_BooleanSmash.h>
+#include <FeaturesPlugin_BooleanFill.h>
#include <FeaturesPlugin_Extrusion.h>
#include <FeaturesPlugin_ExtrusionCut.h>
#include <FeaturesPlugin_ExtrusionFuse.h>
new FeaturesPlugin_ValidatorFilletSelection);
aFactory->registerValidator("FeaturesPlugin_ValidatorCircular",
new FeaturesPlugin_ValidatorCircular);
+ aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanArguments",
+ new FeaturesPlugin_ValidatorBooleanArguments);
// register this plugin
ModelAPI_Session::get()->registerPlugin(this);
return FeaturePtr(new FeaturesPlugin_Rotation);
} else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
return FeaturePtr(new FeaturesPlugin_Translation);
- } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
- return FeaturePtr(new FeaturesPlugin_Boolean);
+ } else if (theFeatureID == FeaturesPlugin_BooleanCut::ID()) {
+ return FeaturePtr(new FeaturesPlugin_BooleanCut);
+ } else if (theFeatureID == FeaturesPlugin_BooleanFuse::ID()) {
+ return FeaturePtr(new FeaturesPlugin_BooleanFuse);
+ } else if (theFeatureID == FeaturesPlugin_BooleanCommon::ID()) {
+ return FeaturePtr(new FeaturesPlugin_BooleanCommon);
+ } else if (theFeatureID == FeaturesPlugin_BooleanSmash::ID()) {
+ return FeaturePtr(new FeaturesPlugin_BooleanSmash);
+ } else if (theFeatureID == FeaturesPlugin_BooleanFill::ID()) {
+ return FeaturePtr(new FeaturesPlugin_BooleanFill);
} else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
return FeaturePtr(new FeaturesPlugin_Intersection);
} else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
"Error: This validator can only work with selection list attributes in \"Boolean\" feature.";
return false;
}
- FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
- int anOperationType = aFeature->integer("bool_type")->value();
+ std::shared_ptr<FeaturesPlugin_Boolean> aFeature =
+ std::dynamic_pointer_cast<FeaturesPlugin_Boolean>(theAttribute->owner());
+ FeaturesPlugin_Boolean::OperationType anOperationType = aFeature->operationType();
for(int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) {
AttributeSelectionPtr anAttrSelection = anAttrSelectionList->value(anIndex);
}
return isValid;
}
+
+//=================================================================================================
+bool FeaturesPlugin_ValidatorBooleanArguments::isValid(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<std::string>& theArguments,
+ Events_InfoMessage& theError) const
+{
+ if (theArguments.size() != 2)
+ {
+ theError = "Wrong number of arguments (expected 2).";
+ return false;
+ }
+
+ int anObjectsNb = 0, aToolsNb = 0;
+ //int anOperationType = 0;
+
+ std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
+
+ bool isAllInSameCompSolid = true;
+ ResultCompSolidPtr aCompSolid;
+
+ AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(*anIt);
+ if (anAttrSelList)
+ {
+ anObjectsNb = anAttrSelList->size();
+ for (int anIndex = 0; anIndex < anObjectsNb; ++anIndex)
+ {
+ AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
+ ResultPtr aContext = anAttr->context();
+ ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
+ if (aResCompSolidPtr.get())
+ {
+ if (aCompSolid.get())
+ {
+ isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
+ }
+ else
+ {
+ aCompSolid = aResCompSolidPtr;
+ }
+ }
+ else
+ {
+ isAllInSameCompSolid = false;
+ break;
+ }
+ }
+ }
+ anIt++;
+
+
+ anAttrSelList = theFeature->selectionList(*anIt);
+ if (anAttrSelList)
+ {
+ aToolsNb = anAttrSelList->size();
+ if (isAllInSameCompSolid)
+ {
+ for (int anIndex = 0; anIndex < aToolsNb; ++anIndex)
+ {
+ AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
+ ResultPtr aContext = anAttr->context();
+ ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
+ if (aResCompSolidPtr.get())
+ {
+ if (aCompSolid.get())
+ {
+ isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
+ }
+ else
+ {
+ aCompSolid = aResCompSolidPtr;
+ }
+ }
+ else
+ {
+ isAllInSameCompSolid = false;
+ break;
+ }
+ }
+ }
+ }
+ anIt++;
+
+ std::shared_ptr<FeaturesPlugin_Boolean> aFeature =
+ std::dynamic_pointer_cast<FeaturesPlugin_Boolean>(theFeature);
+ FeaturesPlugin_Boolean::OperationType anOperationType = aFeature->operationType();
+
+ if (anOperationType == FeaturesPlugin_Boolean::BOOL_FUSE)
+ {
+ // Fuse operation
+ if (anObjectsNb + aToolsNb < 2)
+ {
+ theError = "Not enough arguments for Fuse operation.";
+ return false;
+ }
+ else if (isAllInSameCompSolid)
+ {
+ theError = "Operations only between sub-shapes of the same shape not allowed.";
+ return false;
+ }
+ }
+ else
+ {
+ if (anObjectsNb < 1)
+ {
+ theError = "Objects not selected.";
+ return false;
+ }
+ if (aToolsNb < 1)
+ {
+ theError = "Tools not selected.";
+ return false;
+ }
+ if (isAllInSameCompSolid)
+ {
+ theError = "Operations only between sub-shapes of the same shape not allowed.";
+ return false;
+ }
+ }
+
+ return true;
+}
+
+//=================================================================================================
+bool FeaturesPlugin_ValidatorBooleanArguments::isNotObligatory(std::string theFeature,
+ std::string theAttribute)
+{
+ if (theAttribute == "main_objects" || theAttribute == "tool_objects")
+ {
+ return true;
+ }
+
+ return false;
+}
Events_InfoMessage& theError) const;
};
+/** \class FeaturesPlugin_ValidatorBooleanArguments
+* \ingroup Validators
+* \brief Validates that boolean operation have enough arguments.
+*/
+class FeaturesPlugin_ValidatorBooleanArguments: public ModelAPI_FeatureValidator
+{
+public:
+ /** \brief Returns true if feature and/or attributes are valid.
+ * \param[in] theFeature the validated feature.
+ * \param[in] theArguments the arguments in the configuration file for this validator.
+ * \param[out] theError error message.
+ * \returns true if feature is valid.
+ */
+ virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<std::string>& theArguments,
+ Events_InfoMessage& theError) const;
+
+ /// \return true if the attribute in feature is not obligatory for the feature execution.
+ virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
+};
+
#endif
model.do()
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")], model.selection(), 10, 0)
Boolean_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_2_2/To_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_2/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Boolean_1_1_1/Modified_Face_1"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Extrusion_2_1/To_Face_1")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_2_2/To_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_2/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Smash_1_1_1/Modified_Face_1"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Extrusion_2_1/To_Face_1")])
model.do()
model.end()
model.do()
Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_13_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_14_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0)
-Boolean_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_2_1")])
-Boolean_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_3_1")], [model.selection("SOLID", "Boolean_1_1"), model.selection("SOLID", "Boolean_1_2")])
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_2_1")])
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_3_1")], [model.selection("SOLID", "Common_1_1"), model.selection("SOLID", "Common_1_2")])
# skip 3 vertices, limitation
-Group_1_objects = [model.selection("VERTEX", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Boolean_2_1/Modified_Face_1"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5095"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("VERTEX", "ExtrusionCut_3_1/Lateral_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5108"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5082"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5069"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5043"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5024"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5006"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5015"), model.selection("VERTEX", "Extrusion_1_1/Lateral_4"), model.selection("VERTEX", "Extrusion_1_2/Lateral_4"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5033"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5031"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5022"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5013"), model.selection("VERTEX", "Boolean_1_2/Modified_Face_2&Boolean_1_2/Modified_Face_1"), model.selection("VERTEX", "Boolean_1_1/Modified_Face_2&Boolean_1_1/Modified_Face_1")]
+Group_1_objects = [model.selection("VERTEX", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Cut_1_1/Modified_Face_1"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5095"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("VERTEX", "ExtrusionCut_3_1/Lateral_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5108"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5082"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5069"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5043"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5024"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5006"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5015"), model.selection("VERTEX", "Extrusion_1_1/Lateral_4"), model.selection("VERTEX", "Extrusion_1_2/Lateral_4"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5033"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5031"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5022"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5013"), model.selection("VERTEX", "Common_1_2/Modified_Face_2&Common_1_2/Modified_Face_1"), model.selection("VERTEX", "Common_1_1/Modified_Face_2&Common_1_1/Modified_Face_1")]
Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
# skip 3 edges, limitation
-Group_2_objects = [model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5011"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "Boolean_1_2/Modified_Face_2&Boolean_1_2/Modified_Face_1"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&Boolean_1_2/Modified_Face_2"), model.selection("EDGE", "Boolean_1_2/Modified_Edge_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_9&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5002"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Boolean_1_1/Modified_Edge_1"), model.selection("EDGE", "Boolean_1_1/Modified_Face_2&Boolean_1_1/Modified_Face_1"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&Boolean_1_1/Modified_Face_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5029"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5020")]
+Group_2_objects = [model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5011"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "Common_1_2/Modified_Face_2&Common_1_2/Modified_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&Common_1_2/Modified_Face_2"), model.selection("EDGE", "Common_1_2/Modified_Edge_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_9&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5002"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Common_1_1/Modified_Edge_1"), model.selection("EDGE", "Common_1_1/Modified_Face_2&Common_1_1/Modified_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&Common_1_1/Modified_Face_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5029"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5020")]
Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
-Group_3_objects = [model.selection("FACE", "ExtrusionCut_2_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_8"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_3"), model.selection("FACE", "Boolean_1_2/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_9"), model.selection("FACE", "Boolean_1_1/Modified_Face_1"), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Boolean_2_1/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_2"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_7"), model.selection("FACE", "Boolean_1_1/Modified_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_4"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Boolean_1_2/Modified_Face_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_8")]
+Group_3_objects = [model.selection("FACE", "ExtrusionCut_2_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_8"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_3"), model.selection("FACE", "Common_1_2/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_9"), model.selection("FACE", "Common_1_1/Modified_Face_1"), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Cut_1_1/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_2"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_7"), model.selection("FACE", "Common_1_1/Modified_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_4"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Common_1_2/Modified_Face_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_8")]
Group_3 = model.addGroup(Part_1_doc, Group_3_objects)
model.end()
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_9.result())
Extrusion_1.setNestedSketch(Sketch_2)
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
Point_2 = model.addPoint(Part_1_doc, "x", "y", "-z")
-Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Boolean_1_1_2/Modified_Face_3&Boolean_1_1_2/Modified_Face_2&Boolean_1_1_2/Modified_Face_1"))
+Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Fill_1_1_2/Modified_Face_3&Fill_1_1_2/Modified_Face_2&Fill_1_1_2/Modified_Face_1"))
Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "Point_1"), True)
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), "haut_ext_tuyau", True)
Plane_5.result().setName("Plane_2 arrivee tuyau")
Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1"), 45)
Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_4"), "90+45")
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Boolean_1_1_1")], [model.selection("FACE", "Plane_5")])
-Boolean_3 = model.addFill(Part_1_doc, [model.selection("SOLID", "Boolean_2_1_2")], [model.selection("FACE", "Plane_3")])
-Boolean_4 = model.addFill(Part_1_doc, [model.selection("SOLID", "Boolean_3_1_2")], [model.selection("FACE", "Plane_4")])
-Boolean_4.result().setColor(102, 51, 51)
-Boolean_4.result().subResult(0).setColor(153, 153, 76)
-Boolean_4.result().subResult(1).setColor(0, 204, 204)
-Boolean_4.result().subResult(2).setColor(51, 51, 102)
-Boolean_4.result().subResult(3).setColor(102, 204, 102)
-Boolean_4.result().subResult(4).setColor(204, 204, 0)
+Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_1_1_1")], [model.selection("FACE", "Plane_5")])
+Fill_3 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_2_1_2")], [model.selection("FACE", "Plane_3")])
+Fill_4 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_3_1_2")], [model.selection("FACE", "Plane_4")])
+Fill_4.result().setColor(102, 51, 51)
+Fill_4.result().subResult(0).setColor(153, 153, 76)
+Fill_4.result().subResult(1).setColor(0, 204, 204)
+Fill_4.result().subResult(2).setColor(51, 51, 102)
+Fill_4.result().subResult(3).setColor(102, 204, 102)
+Fill_4.result().subResult(4).setColor(204, 204, 0)
-Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Boolean_4_1_4"), model.selection("SOLID", "Boolean_4_1_2")])
+Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Fill_4_1_4"), model.selection("SOLID", "Fill_4_1_2")])
Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("FACE", "Plane_2 arrivee tuyau"))
Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchArc_2_2f-SketchLine_18r")], model.selection("EDGE", "Sketch_4/Edge-SketchLine_18"), 0, 180)
-Boolean_5 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_2_1")], [model.selection("SOLID", "Extrusion_3_1")])
-Boolean_5.result().setName("demi-sphere")
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_2_1")], [model.selection("SOLID", "Extrusion_3_1")])
+Cut_1.result().setName("demi-sphere")
Plane_9 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_10&Extrusion_2_1/Generated_Face_1&Extrusion_2_1/From_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_10&Extrusion_2_1/Generated_Face_1&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_10&Extrusion_2_1/To_Face_4"))
Plane_10 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_12&Extrusion_2_1/Generated_Face_11&Extrusion_2_1/To_Face_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/To_Face_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/From_Face_1"))
Plane_11 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_3&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/From_Face_3"))
Plane_12 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_1&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/From_Face_4"))
-Recover_1 = model.addRecover(Part_1_doc, Boolean_5, [Extrusion_3.result()])
+Recover_1 = model.addRecover(Part_1_doc, Cut_1, [Extrusion_3.result()])
Plane_13 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape4"), model.selection("EDGE", "Recover_1_1/Shape4&Recover_1_1/Shape6"), "90+45")
Plane_14 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape1"), model.selection("EDGE", "Recover_1_1/Shape1&Recover_1_1/Shape6"), "90+45")
Plane_15 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape2"), model.selection("EDGE", "Recover_1_1/Shape2&Recover_1_1/Shape6"), "90+45")
Plane_16 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape6"), model.selection("EDGE", "Recover_1_1/Shape3&Recover_1_1/Shape6"), 45)
-Boolean_6_objects_2 = [model.selection("FACE", "Plane_6"), model.selection("FACE", "Plane_7"), model.selection("FACE", "Plane_8"), model.selection("FACE", "Plane_9"), model.selection("FACE", "Plane_10"), model.selection("FACE", "Plane_11"), model.selection("FACE", "Plane_12"), model.selection("FACE", "Plane_13")]
-Boolean_6 = model.addFill(Part_1_doc, [model.selection("SOLID", "demi-sphere")], Boolean_6_objects_2)
+Fill_5_objects_2 = [model.selection("FACE", "Plane_6"), model.selection("FACE", "Plane_7"), model.selection("FACE", "Plane_8"), model.selection("FACE", "Plane_9"), model.selection("FACE", "Plane_10"), model.selection("FACE", "Plane_11"), model.selection("FACE", "Plane_12"), model.selection("FACE", "Plane_13")]
+Fill_5 = model.addFill(Part_1_doc, [model.selection("SOLID", "demi-sphere")], Fill_5_objects_2)
-Union_2_objects = [model.selection("SOLID", "Boolean_6_1_16"), model.selection("SOLID", "Boolean_6_1_13"), model.selection("SOLID", "Boolean_6_1_14")]
+Union_2_objects = [model.selection("SOLID", "Fill_5_1_16"), model.selection("SOLID", "Fill_5_1_13"), model.selection("SOLID", "Fill_5_1_14")]
Union_2 = model.addUnion(Part_1_doc, Union_2_objects)
-Union_3_objects = [model.selection("SOLID", "Boolean_6_1_10/Boolean_6_1_10"), model.selection("SOLID", "Boolean_6_1_3/Boolean_6_1_3"), model.selection("SOLID", "Boolean_6_1_5/Boolean_6_1_5"), model.selection("SOLID", "Boolean_6_1_11/Boolean_6_1_11")]
+Union_3_objects = [model.selection("SOLID", "Fill_5_1_10/Fill_5_1_10"), model.selection("SOLID", "Fill_5_1_3/Fill_5_1_3"), model.selection("SOLID", "Fill_5_1_5/Fill_5_1_5"), model.selection("SOLID", "Fill_5_1_11/Fill_5_1_11")]
Union_3 = model.addUnion(Part_1_doc, Union_3_objects)
-Union_4_objects = [model.selection("SOLID", "Boolean_6_1_12/Boolean_6_1_12"), model.selection("SOLID", "Boolean_6_1_6/Boolean_6_1_6"), model.selection("SOLID", "Boolean_6_1_4/Boolean_6_1_4")]
+Union_4_objects = [model.selection("SOLID", "Fill_5_1_12/Fill_5_1_12"), model.selection("SOLID", "Fill_5_1_6/Fill_5_1_6"), model.selection("SOLID", "Fill_5_1_4/Fill_5_1_4")]
Union_4 = model.addUnion(Part_1_doc, Union_4_objects)
-Union_5_objects = [model.selection("SOLID", "Boolean_6_1_2/Boolean_6_1_2"), model.selection("SOLID", "Boolean_6_1_1/Boolean_6_1_1"), model.selection("SOLID", "Boolean_6_1_7/Boolean_6_1_7")]
+Union_5_objects = [model.selection("SOLID", "Fill_5_1_2/Fill_5_1_2"), model.selection("SOLID", "Fill_5_1_1/Fill_5_1_1"), model.selection("SOLID", "Fill_5_1_7/Fill_5_1_7")]
Union_5 = model.addUnion(Part_1_doc, Union_5_objects)
-Union_6_objects = [model.selection("SOLID", "Boolean_6_1_8/Boolean_6_1_8"), model.selection("SOLID", "Boolean_6_1_9/Boolean_6_1_9"), model.selection("SOLID", "Boolean_6_1_15/Boolean_6_1_15")]
+Union_6_objects = [model.selection("SOLID", "Fill_5_1_8/Fill_5_1_8"), model.selection("SOLID", "Fill_5_1_9/Fill_5_1_9"), model.selection("SOLID", "Fill_5_1_15/Fill_5_1_15")]
Union_6 = model.addUnion(Part_1_doc, Union_6_objects)
Union_6.result().setColor(0, 0, 204)
Union_6.result().subResult(0).setColor(204, 102, 102)
# Create a pacman as boolean cut of the prism from the cylinder
#=========================================================================
aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Cut")
aBooleanFt.selectionList("main_objects").append(extrudedObjects[0], extrudedObjects[0].shape())
aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], extrudedObjects[1].shape())
-kBooleanTypeCut = 0
-aBooleanFt.integer("bool_type").setValue(kBooleanTypeCut)
aBooleanFt.execute()
aSession.finishOperation()
# Create a pacman as boolean cut of the prism from the cylinder
#=========================================================================
aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Cut")
aBooleanFt.selectionList("main_objects").append(modelAPI_ResultCompSolid(extrudedObjects[0]).subResult(1), None)
aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], None)
-aBooleanType = 0
-aBooleanFt.integer("bool_type").setValue(aBooleanType)
aBooleanFt.execute()
aSession.finishOperation()
# Fuse
#=========================================================================
aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Fuse")
aBooleanFt.selectionList("main_objects").append(modelAPI_ResultCompSolid(extrudedObjects[0]).subResult(1), None)
aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], None)
-aBooleanType = 1
-aBooleanFt.integer("bool_type").setValue(aBooleanType)
aBooleanFt.execute()
aSession.finishOperation()
# Smash prism into the cylinder
#=========================================================================
aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Smash")
aBooleanFt.selectionList("main_objects").append(extrudedObjects[0], extrudedObjects[0].shape())
aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], extrudedObjects[1].shape())
-kBooleanTypeSmash = 3
-aBooleanFt.integer("bool_type").setValue(kBooleanTypeSmash)
aBooleanFt.execute()
aSession.finishOperation()
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift", True)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("COMPOUND", "Boolean_1_1")], [model.selection("SOLID", "Box_1_1")])
+Boolean_2 = model.addFill(Part_1_doc, [model.selection("COMPOUND", "Fill_1_1")], [model.selection("SOLID", "Box_1_1")])
model.do()
model.checkBooleansResult(Boolean_2, model, 1, [6], [0], [6], [22], [44])
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift", True)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Boolean_1_1_2"), model.selection("FACE", "Boolean_1_1_1")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
Boolean_2 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("SOLID", "Box_1_1")])
model.do()
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "Boolean_1_1")])
+Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "Fill_1_1")])
model.do()
model.checkBooleansResult(Boolean_2, model, 1, [2], [2], [14], [60], [120])
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Boolean_1_1_2"), model.selection("FACE", "Boolean_1_1_1")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), 1, 3)
Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "LinearCopy_1_1")])
model.do()
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Boolean_1_1_2"), model.selection("FACE", "Boolean_1_1_1")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SHELL", "Shell_1_1")])
model.do()
anExtrusionFt.real("from_size").setValue(0)
anExtrusionFt.real("to_size").setValue(10)
anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
- anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+ anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
# v1.0.2 from master
# anExtrusionFt.selection("extrusion_face").setValue(
# aSketchResult, aSketchFaces[0])
aCurrentResult = modelAPI_ResultBody(aBox.firstResult())
aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Cut")
aBooleanFt.selectionList("main_objects").append(aCurrentResult, aCurrentResult.shape())
for i in xrange(0, N * N):
anExtrusionResult = modelAPI_ResultBody(anExtrusions[i].firstResult())
aBooleanFt.selectionList("tool_objects").append(anExtrusionResult, anExtrusionResult.shape())
-kBooleanTypeCut = 0
-aBooleanFt.integer("bool_type").setValue(kBooleanTypeCut)
aBooleanFt.execute()
aFactory = ModelAPI_Session.get().validators()
assert (aFactory.validate(aBooleanFt))
anExtrusionFt.real("from_size").setValue(0)
anExtrusionFt.real("to_size").setValue(10)
anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
- anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+ anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
# v1.0.2 from master
# anExtrusionFt.selection("extrusion_face").setValue(
# aSketchResult, aSketchFaces[0])
aFactory = ModelAPI_Session.get().validators()
for i in xrange(0, N * N):
anExtrusionResult = modelAPI_ResultBody(anExtrusions[i].firstResult())
- aBooleanFt = aPart.addFeature("Boolean")
+ aBooleanFt = aPart.addFeature("Cut")
aBooleanFt.selectionList("main_objects").append(aCurrentResult, aCurrentResult.shape())
aBooleanFt.selectionList("tool_objects").append(anExtrusionResult, anExtrusionResult.shape())
- kBooleanTypeCut = 0
- aBooleanFt.integer("bool_type").setValue(kBooleanTypeCut)
aBooleanFt.execute()
assert (aFactory.validate(aBooleanFt))
assert (len(aBooleanFt.results()) > 0)
-->
<source>
- <module_choice id="bool_type"
- widget_type="radiobuttons"
- buttons_dir="horizontal"
- label="Operation type"
- tooltip="Type of boolean operation"
- string_list="Cut Fuse Common Fill Smash"
- use_in_title="true"
- icons_list="icons/Features/bool_cut.png icons/Features/bool_fuse.png icons/Features/bool_common.png icons/Features/bool_fill.png icons/Features/bool_smash.png"
- default="0"
- />
<multi_selector id="main_objects"
label="Main objects"
icon=""
<validator id="PartSet_DifferentObjects"/>
<validator id="FeaturesPlugin_ValidatorBooleanSelection"/>
</multi_selector>
- <validator id="GeomValidators_BooleanArguments" parameters="main_objects,tool_objects,bool_type"/>
+ <validator id="FeaturesPlugin_ValidatorBooleanArguments" parameters="main_objects,tool_objects"/>
</source>
</feature>
</group>
<group id="Boolean">
- <feature id="Boolean" title="Boolean" tooltip="Perform boolean operations with objects" icon="icons/Features/cut.png"
+ <feature id="Cut" title="Cut" tooltip="Perform boolean cut operation with objects" icon="icons/Features/bool_cut.png"
+ auto_preview="false">
+ <source path="boolean_widget.xml"/>
+ </feature>
+ <feature id="Fuse" title="Fuse" tooltip="Perform boolean fuse operation with objects" icon="icons/Features/bool_fuse.png"
+ auto_preview="false">
+ <source path="boolean_widget.xml"/>
+ </feature>
+ <feature id="Common" title="Common" tooltip="Perform boolean common operation with objects" icon="icons/Features/bool_common.png"
+ auto_preview="false">
+ <source path="boolean_widget.xml"/>
+ </feature>
+ <feature id="Smash" title="Smash" tooltip="Perform boolean smash operation with objects" icon="icons/Features/bool_smash.png"
auto_preview="false">
<source path="boolean_widget.xml"/>
</feature>
auto_preview="false">
<source path="partition_widget.xml"/>
</feature>
+ <feature id="Fill" title="Fill" tooltip="Perform boolean fill operation with objects" icon="icons/Features/bool_fill.png"
+ auto_preview="false">
+ <source path="boolean_widget.xml"/>
+ </feature>
<feature id="Union" title="Union" tooltip="Perform union operations with shapes" icon="icons/Features/union.png">
<source path="union_widget.xml"/>
</feature>
#include <Geom_Line.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAPI_ExtremaCurveCurve.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
//==================================================================================================
return aVertex;
}
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> GeomAlgoAPI_PointBuilder::vertexByProjection(
+ const std::shared_ptr<GeomAPI_Vertex> theVertex,
+ const std::shared_ptr<GeomAPI_Edge> theEdge)
+{
+ std::shared_ptr<GeomAPI_Vertex> aVertex;
+
+ if (!theVertex.get() || !theEdge.get()) {
+ return aVertex;
+ }
+
+ std::shared_ptr<GeomAPI_Pnt> aProjPnt = theVertex->point();
+ gp_Pnt aPnt(aProjPnt->x(), aProjPnt->y(), aProjPnt->z());
+
+ TopoDS_Edge anEdge = TopoDS::Edge(theEdge->impl<TopoDS_Shape>());
+ double aFirstOnCurve, aLastOnCurve;
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirstOnCurve, aLastOnCurve);
+
+ if (aCurve.IsNull()) {
+ return aVertex;
+ }
+
+ GeomAPI_ProjectPointOnCurve aProjection(aPnt, aCurve);
+
+ if (aProjection.NbPoints() == 0) {
+ return aVertex;
+ }
+
+ gp_Pnt aNearestPoint = aProjection.NearestPoint();
+
+ aVertex.reset(new GeomAPI_Vertex(aNearestPoint.X(), aNearestPoint.Y(), aNearestPoint.Z()));
+
+ return aVertex;
+}
+
//==================================================================================================
std::shared_ptr<GeomAPI_Vertex> GeomAlgoAPI_PointBuilder::vertexByProjection(
const std::shared_ptr<GeomAPI_Vertex> theVertex,
- const std::shared_ptr<GeomAPI_Face> thePlane)
+ const std::shared_ptr<GeomAPI_Face> theFace)
{
std::shared_ptr<GeomAPI_Vertex> aVertex;
- if(!theVertex.get() || !thePlane.get() || !thePlane->isPlanar()) {
+ if(!theVertex.get() || !theFace.get() || !theFace->isPlanar()) {
return aVertex;
}
std::shared_ptr<GeomAPI_Pnt> aProjPnt = theVertex->point();
- std::shared_ptr<GeomAPI_Pln> aProjPln = thePlane->getPlane();
+ std::shared_ptr<GeomAPI_Pln> aProjPln = theFace->getPlane();
std::shared_ptr<GeomAPI_Pnt> aPnt = aProjPln->project(aProjPnt);
const bool theIsPercent = false,
const bool theIsReverse = false);
+ /// \brief Creates vertex by projection another vertex on edge.
+ /// \param[in] theVertex vertex to project.
+ /// \param[in] theEdge edge for projection.
+ /// \return created vertex.
+ static std::shared_ptr<GeomAPI_Vertex>
+ vertexByProjection(const std::shared_ptr<GeomAPI_Vertex> theVertex,
+ const std::shared_ptr<GeomAPI_Edge> theEdge);
+
/// \brief Creates vertex by projection another vertex on plane.
/// \param[in] theVertex vertex to project.
- /// \param[in] thePlane face for projection. Should be planar.
+ /// \param[in] theFace face for projection. Should be planar.
/// \return created vertex.
static std::shared_ptr<GeomAPI_Vertex>
vertexByProjection(const std::shared_ptr<GeomAPI_Vertex> theVertex,
- const std::shared_ptr<GeomAPI_Face> thePlane);
+ const std::shared_ptr<GeomAPI_Face> theFace);
/// \brief Creates vertex by intersection two coplanar lines.
/// \param[in] theEdge1 first linear edge.
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TopoDS_Edge.hxx>
+//==================================================================================================
+static GProp_GProps props(const TopoDS_Shape& theShape)
+{
+ GProp_GProps aGProps;
+
+ if (theShape.ShapeType() == TopAbs_EDGE || theShape.ShapeType() == TopAbs_WIRE)
+ {
+ BRepGProp::LinearProperties(theShape, aGProps);
+ }
+ else if (theShape.ShapeType() == TopAbs_FACE || theShape.ShapeType() == TopAbs_SHELL)
+ {
+ const Standard_Real anEps = 1.e-6;
+ BRepGProp::SurfaceProperties(theShape, aGProps, anEps);
+ }
+ else if (theShape.ShapeType() == TopAbs_SOLID || theShape.ShapeType() == TopAbs_COMPSOLID)
+ {
+ BRepGProp::VolumeProperties(theShape, aGProps);
+ }
+ else if (theShape.ShapeType() == TopAbs_COMPOUND)
+ {
+ for (TopoDS_Iterator anIt(theShape); anIt.More(); anIt.Next())
+ {
+ aGProps.Add(props(anIt.Value()));
+ }
+ }
+
+ return aGProps;
+}
+
//==================================================================================================
double GeomAlgoAPI_ShapeTools::volume(const std::shared_ptr<GeomAPI_Shape> theShape)
{
gp_Pnt aCentre;
if(aShape.ShapeType() == TopAbs_VERTEX) {
aCentre = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
- } else if(aShape.ShapeType() == TopAbs_EDGE || aShape.ShapeType() == TopAbs_WIRE) {
- BRepGProp::LinearProperties(aShape, aGProps);
- aCentre = aGProps.CentreOfMass();
} else {
- const Standard_Real anEps = 1.e-6;
- BRepGProp::SurfaceProperties(aShape, aGProps, anEps);
+ aGProps = props(aShape);
aCentre = aGProps.CentreOfMass();
}
+
return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aCentre.X(), aCentre.Y(), aCentre.Z()));
}
SET(PROJECT_HEADERS
GeomValidators.h
GeomValidators_BodyShapes.h
- GeomValidators_BooleanArguments.h
GeomValidators_ConstructionComposite.h
GeomValidators_DifferentShapes.h
GeomValidators_Face.h
SET(PROJECT_SOURCES
GeomValidators_BodyShapes.cpp
- GeomValidators_BooleanArguments.cpp
GeomValidators_ConstructionComposite.cpp
GeomValidators_DifferentShapes.cpp
GeomValidators_Face.cpp
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#include <GeomValidators_BooleanArguments.h>
-
-#include <Events_InfoMessage.h>
-
-#include <ModelAPI_AttributeInteger.h>
-#include <ModelAPI_AttributeSelectionList.h>
-#include <ModelAPI_ResultCompSolid.h>
-#include <ModelAPI_Tools.h>
-
-//=================================================================================================
-bool GeomValidators_BooleanArguments::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::list<std::string>& theArguments,
- Events_InfoMessage& theError) const
-{
- if(theArguments.size() != 3) {
- theError = "Wrong number of arguments (expected 3).";
- return false;
- }
-
- int anObjectsNb = 0, aToolsNb = 0;
- int anOperationType = 0;
-
- std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
-
- bool isAllInSameCompSolid = true;
- ResultCompSolidPtr aCompSolid;
-
- AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(*anIt);
- if(anAttrSelList) {
- anObjectsNb = anAttrSelList->size();
- for(int anIndex = 0; anIndex < anObjectsNb; ++anIndex) {
- AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
- ResultPtr aContext = anAttr->context();
- ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
- if(aResCompSolidPtr.get()) {
- if(aCompSolid.get()) {
- isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
- } else {
- aCompSolid = aResCompSolidPtr;
- }
- } else {
- isAllInSameCompSolid = false;
- break;
- }
- }
- }
- anIt++;
-
-
- anAttrSelList = theFeature->selectionList(*anIt);
- if(anAttrSelList) {
- aToolsNb = anAttrSelList->size();
- if(isAllInSameCompSolid) {
- for(int anIndex = 0; anIndex < aToolsNb; ++anIndex) {
- AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
- ResultPtr aContext = anAttr->context();
- ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
- if(aResCompSolidPtr.get()) {
- if(aCompSolid.get()) {
- isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
- } else {
- aCompSolid = aResCompSolidPtr;
- }
- } else {
- isAllInSameCompSolid = false;
- break;
- }
- }
- }
- }
- anIt++;
-
- std::shared_ptr<ModelAPI_AttributeInteger> anAttrInt = theFeature->integer(*anIt);
- if(anAttrInt) {
- anOperationType = anAttrInt->value();
- }
-
- if(anOperationType == 1) {
- // Fuse operation
- if(anObjectsNb + aToolsNb < 2) {
- theError = "Not enough arguments for Fuse operation.";
- return false;
- } else if(isAllInSameCompSolid) {
- theError = "Operations only between sub-shapes of the same shape not allowed.";
- return false;
- }
- } else {
- if(anObjectsNb < 1) {
- theError = "Objects not selected.";
- return false;
- }
- if(aToolsNb < 1) {
- theError = "Tools not selected.";
- return false;
- }
- if(isAllInSameCompSolid) {
- theError = "Operations only between sub-shapes of the same shape not allowed.";
- return false;
- }
- }
-
- return true;
-}
-
-//=================================================================================================
-bool GeomValidators_BooleanArguments::isNotObligatory(std::string theFeature,
- std::string theAttribute)
-{
- if(theAttribute == "main_objects" || theAttribute == "tool_objects") {
- return true;
- }
-
- return false;
-}
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#ifndef GeomValidators_BooleanArguments_H
-#define GeomValidators_BooleanArguments_H
-
-#include <GeomValidators.h>
-#include <ModelAPI_Feature.h>
-#include <ModelAPI_FeatureValidator.h>
-
-/** \class GeomValidators_BooleanArguments
- * \ingroup Validators
- * \brief Validates that boolean operation have enough arguments.
- */
-class GeomValidators_BooleanArguments : public ModelAPI_FeatureValidator
-{
-public:
- /** \brief Returns true if feature and/or attributes are valid.
- * \param[in] theFeature the validated feature.
- * \param[in] theArguments the arguments in the configuration file for this validator.
- * \param[out] theError error message.
- * \returns true if feature is valid.
- */
- GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::list<std::string>& theArguments,
- Events_InfoMessage& theError) const;
-
- /// \return true if the attribute in feature is not obligatory for the feature execution.
- GEOMVALIDATORS_EXPORT virtual
- bool isNotObligatory(std::string theFeature, std::string theAttribute);
-};
-
-#endif
#include <GeomValidators_Plugin.h>
#include <GeomValidators_BodyShapes.h>
-#include <GeomValidators_BooleanArguments.h>
#include <GeomValidators_ConstructionComposite.h>
#include <GeomValidators_Different.h>
#include <GeomValidators_DifferentShapes.h>
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
aFactory->registerValidator("GeomValidators_BodyShapes", new GeomValidators_BodyShapes);
- aFactory->registerValidator("GeomValidators_BooleanArguments",
- new GeomValidators_BooleanArguments);
aFactory->registerValidator("GeomValidators_ConstructionComposite",
new GeomValidators_ConstructionComposite);
aFactory->registerValidator("GeomValidators_Different", new GeomValidators_Different);
#include <ModelAPI_Events.h>
#include <ModelAPI_Result.h>
+#include <GeomDataAPI_Point.h>
+
#include <Events_Message.h>
#include <Events_InfoMessage.h>
double theX, double theY, double theZ)
{
std::shared_ptr<ModelAPI_Feature> aPoint = theDoc->addFeature("Point");
- //aPoint->string("creation_method")->setValue("by_xyz");
- aPoint->real("x")->setValue(theX);
- aPoint->real("y")->setValue(theY);
- aPoint->real("z")->setValue(theZ);
+ AttributePointPtr aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point>
+ (aPoint->data()->attribute("point3d"));
+ aPointAttr->setValue(theX, theY, theZ);
aPoint->string("creation_method")->setValue("by_xyz");
aPoint->data()->setName(theName);
// don't show automatically created feature in the features history
# Do cut a hole from a box
#=========================================================================
aSession.startOperation()
-aCut1 = aPart.addFeature("Boolean")
+aCut1 = aPart.addFeature("Cut")
aCut1.selectionList("main_objects").append(aBox.firstResult(), None)
aCut1.selectionList("tool_objects").append(aHoleExt.firstResult(), None)
-aCut1.integer("bool_type").setValue(0) # cut
aSession.finishOperation()
#=========================================================================
# Do fuse with a tower. Tower must be an argument (not tool) to add the problem to the faces owners detection.
#=========================================================================
aSession.startOperation()
-aFuse = aPart.addFeature("Boolean")
+aFuse = aPart.addFeature("Fuse")
aFuse.selectionList("main_objects").append(aTower.firstResult(), None)
aFuse.selectionList("tool_objects").append(aCut1.firstResult(), None)
-aFuse.integer("bool_type").setValue(1) # fuse
aSession.finishOperation()
#=========================================================================
# check faces
check_owner("Extrusion_1_1/Generated_Face_1", "face", aBox)
-check_owner("Boolean_2_1/Modified_Face_3", "face", aBox)
-check_owner("Boolean_1_1/Modified_Face_1", "face", aHoleExt)
-check_owner("Boolean_2_1/Modified_Face_1", "face", aTower)
+check_owner("Fuse_1_1/Modified_Face_3", "face", aBox)
+check_owner("Cut_1_1/Modified_Face_1", "face", aHoleExt)
+check_owner("Fuse_1_1/Modified_Face_1", "face", aTower)
# check edges without ambiguity
-check_owner("Boolean_2_1/Modified_Face_2&Extrusion_1_1/Generated_Face_2", "edge", aBox)
-check_owner("Boolean_2_1/Modified_Face_1&Extrusion_3_1/To_Face_1_1", "edge", aTower)
+check_owner("Fuse_1_1/Modified_Face_2&Extrusion_1_1/Generated_Face_2", "edge", aBox)
+check_owner("Fuse_1_1/Modified_Face_1&Extrusion_3_1/To_Face_1_1", "edge", aTower)
# check the connected topology method: solid is not a compound of connected topology
assert(aFuse.firstResult().shape().isConnectedTopology() == False)
Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_1")])
Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_2_2f")], model.selection(), model.selection("FACE", "Extrusion_2_1/From_Face_1"), 0, model.selection(), 0)
Boolean_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_4_1")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Boolean_1_1"), model.selection("SOLID", "Boolean_2_1"), model.selection("FACE", "Face_1_1")])
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cut_1_1"), model.selection("SOLID", "Cut_2_1"), model.selection("FACE", "Face_1_1")])
Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPOUND", "Partition_1_1"))
Remove_SubShapes_1.setSubShapesToKeep([model.selection("COMPSOLID", "Partition_1_1_1")])
model.end()
END_INIT() \
public:
+//--------------------------------------------------------------------------------------
+#define INTERFACE_16(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1, \
+ N_2, AN_2, T_2, C_2, \
+ N_3, AN_3, T_3, C_3, \
+ N_4, AN_4, T_4, C_4, \
+ N_5, AN_5, T_5, C_5, \
+ N_6, AN_6, T_6, C_6, \
+ N_7, AN_7, T_7, C_7, \
+ N_8, AN_8, T_8, C_8, \
+ N_9, AN_9, T_9, C_9, \
+ N_10, AN_10, T_10, C_10, \
+ N_11, AN_11, T_11, C_11, \
+ N_12, AN_12, T_12, C_12, \
+ N_13, AN_13, T_13, C_13, \
+ N_14, AN_14, T_14, C_14, \
+ N_15, AN_15, T_15, C_15) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+ DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+ DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+ DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+ DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+ DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+ DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+ DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+ DEFINE_ATTRIBUTE(N_10, T_10, C_10) \
+ DEFINE_ATTRIBUTE(N_11, T_11, C_11) \
+ DEFINE_ATTRIBUTE(N_12, T_12, C_12) \
+ DEFINE_ATTRIBUTE(N_13, T_13, C_13) \
+ DEFINE_ATTRIBUTE(N_14, T_14, C_14) \
+ DEFINE_ATTRIBUTE(N_15, T_15, C_15) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ SET_ATTRIBUTE(N_2, T_2, AN_2) \
+ SET_ATTRIBUTE(N_3, T_3, AN_3) \
+ SET_ATTRIBUTE(N_4, T_4, AN_4) \
+ SET_ATTRIBUTE(N_5, T_5, AN_5) \
+ SET_ATTRIBUTE(N_6, T_6, AN_6) \
+ SET_ATTRIBUTE(N_7, T_7, AN_7) \
+ SET_ATTRIBUTE(N_8, T_8, AN_8) \
+ SET_ATTRIBUTE(N_9, T_9, AN_9) \
+ SET_ATTRIBUTE(N_10, T_10, AN_10) \
+ SET_ATTRIBUTE(N_11, T_11, AN_11) \
+ SET_ATTRIBUTE(N_12, T_12, AN_12) \
+ SET_ATTRIBUTE(N_13, T_13, AN_13) \
+ SET_ATTRIBUTE(N_14, T_14, AN_14) \
+ SET_ATTRIBUTE(N_15, T_15, AN_15) \
+ END_INIT() \
+ public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_18(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1, \
+ N_2, AN_2, T_2, C_2, \
+ N_3, AN_3, T_3, C_3, \
+ N_4, AN_4, T_4, C_4, \
+ N_5, AN_5, T_5, C_5, \
+ N_6, AN_6, T_6, C_6, \
+ N_7, AN_7, T_7, C_7, \
+ N_8, AN_8, T_8, C_8, \
+ N_9, AN_9, T_9, C_9, \
+ N_10, AN_10, T_10, C_10, \
+ N_11, AN_11, T_11, C_11, \
+ N_12, AN_12, T_12, C_12, \
+ N_13, AN_13, T_13, C_13, \
+ N_14, AN_14, T_14, C_14, \
+ N_15, AN_15, T_15, C_15, \
+ N_16, AN_16, T_16, C_16, \
+ N_17, AN_17, T_17, C_17) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+ DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+ DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+ DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+ DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+ DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+ DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+ DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+ DEFINE_ATTRIBUTE(N_10, T_10, C_10) \
+ DEFINE_ATTRIBUTE(N_11, T_11, C_11) \
+ DEFINE_ATTRIBUTE(N_12, T_12, C_12) \
+ DEFINE_ATTRIBUTE(N_13, T_13, C_13) \
+ DEFINE_ATTRIBUTE(N_14, T_14, C_14) \
+ DEFINE_ATTRIBUTE(N_15, T_15, C_15) \
+ DEFINE_ATTRIBUTE(N_16, T_16, C_16) \
+ DEFINE_ATTRIBUTE(N_17, T_17, C_17) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ SET_ATTRIBUTE(N_2, T_2, AN_2) \
+ SET_ATTRIBUTE(N_3, T_3, AN_3) \
+ SET_ATTRIBUTE(N_4, T_4, AN_4) \
+ SET_ATTRIBUTE(N_5, T_5, AN_5) \
+ SET_ATTRIBUTE(N_6, T_6, AN_6) \
+ SET_ATTRIBUTE(N_7, T_7, AN_7) \
+ SET_ATTRIBUTE(N_8, T_8, AN_8) \
+ SET_ATTRIBUTE(N_9, T_9, AN_9) \
+ SET_ATTRIBUTE(N_10, T_10, AN_10) \
+ SET_ATTRIBUTE(N_11, T_11, AN_11) \
+ SET_ATTRIBUTE(N_12, T_12, AN_12) \
+ SET_ATTRIBUTE(N_13, T_13, AN_13) \
+ SET_ATTRIBUTE(N_14, T_14, AN_14) \
+ SET_ATTRIBUTE(N_15, T_15, AN_15) \
+ SET_ATTRIBUTE(N_16, T_16, AN_16) \
+ SET_ATTRIBUTE(N_17, T_17, AN_17) \
+ END_INIT() \
+ public:
+
//--------------------------------------------------------------------------------------
#define INTERFACE_20(KIND, \
N_0, AN_0, T_0, C_0, \
END_INIT() \
public:
+//--------------------------------------------------------------------------------------
+#define INTERFACE_24(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1, \
+ N_2, AN_2, T_2, C_2, \
+ N_3, AN_3, T_3, C_3, \
+ N_4, AN_4, T_4, C_4, \
+ N_5, AN_5, T_5, C_5, \
+ N_6, AN_6, T_6, C_6, \
+ N_7, AN_7, T_7, C_7, \
+ N_8, AN_8, T_8, C_8, \
+ N_9, AN_9, T_9, C_9, \
+ N_10, AN_10, T_10, C_10, \
+ N_11, AN_11, T_11, C_11, \
+ N_12, AN_12, T_12, C_12, \
+ N_13, AN_13, T_13, C_13, \
+ N_14, AN_14, T_14, C_14, \
+ N_15, AN_15, T_15, C_15, \
+ N_16, AN_16, T_16, C_16, \
+ N_17, AN_17, T_17, C_17, \
+ N_18, AN_18, T_18, C_18, \
+ N_19, AN_19, T_19, C_19, \
+ N_20, AN_20, T_20, C_20, \
+ N_21, AN_21, T_21, C_21, \
+ N_22, AN_22, T_22, C_22, \
+ N_23, AN_23, T_23, C_23) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+ DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+ DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+ DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+ DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+ DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+ DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+ DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+ DEFINE_ATTRIBUTE(N_10, T_10, C_10) \
+ DEFINE_ATTRIBUTE(N_11, T_11, C_11) \
+ DEFINE_ATTRIBUTE(N_12, T_12, C_12) \
+ DEFINE_ATTRIBUTE(N_13, T_13, C_13) \
+ DEFINE_ATTRIBUTE(N_14, T_14, C_14) \
+ DEFINE_ATTRIBUTE(N_15, T_15, C_15) \
+ DEFINE_ATTRIBUTE(N_16, T_16, C_16) \
+ DEFINE_ATTRIBUTE(N_17, T_17, C_17) \
+ DEFINE_ATTRIBUTE(N_18, T_18, C_18) \
+ DEFINE_ATTRIBUTE(N_19, T_19, C_19) \
+ DEFINE_ATTRIBUTE(N_20, T_20, C_20) \
+ DEFINE_ATTRIBUTE(N_21, T_21, C_21) \
+ DEFINE_ATTRIBUTE(N_22, T_22, C_22) \
+ DEFINE_ATTRIBUTE(N_23, T_23, C_23) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ SET_ATTRIBUTE(N_2, T_2, AN_2) \
+ SET_ATTRIBUTE(N_3, T_3, AN_3) \
+ SET_ATTRIBUTE(N_4, T_4, AN_4) \
+ SET_ATTRIBUTE(N_5, T_5, AN_5) \
+ SET_ATTRIBUTE(N_6, T_6, AN_6) \
+ SET_ATTRIBUTE(N_7, T_7, AN_7) \
+ SET_ATTRIBUTE(N_8, T_8, AN_8) \
+ SET_ATTRIBUTE(N_9, T_9, AN_9) \
+ SET_ATTRIBUTE(N_10, T_10, AN_10) \
+ SET_ATTRIBUTE(N_11, T_11, AN_11) \
+ SET_ATTRIBUTE(N_12, T_12, AN_12) \
+ SET_ATTRIBUTE(N_13, T_13, AN_13) \
+ SET_ATTRIBUTE(N_14, T_14, AN_14) \
+ SET_ATTRIBUTE(N_15, T_15, AN_15) \
+ SET_ATTRIBUTE(N_16, T_16, AN_16) \
+ SET_ATTRIBUTE(N_17, T_17, AN_17) \
+ SET_ATTRIBUTE(N_18, T_18, AN_18) \
+ SET_ATTRIBUTE(N_19, T_19, AN_19) \
+ SET_ATTRIBUTE(N_20, T_20, AN_20) \
+ SET_ATTRIBUTE(N_21, T_21, AN_21) \
+ SET_ATTRIBUTE(N_22, T_22, AN_22) \
+ SET_ATTRIBUTE(N_23, T_23, AN_23) \
+ END_INIT() \
+ public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_25(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1, \
+ N_2, AN_2, T_2, C_2, \
+ N_3, AN_3, T_3, C_3, \
+ N_4, AN_4, T_4, C_4, \
+ N_5, AN_5, T_5, C_5, \
+ N_6, AN_6, T_6, C_6, \
+ N_7, AN_7, T_7, C_7, \
+ N_8, AN_8, T_8, C_8, \
+ N_9, AN_9, T_9, C_9, \
+ N_10, AN_10, T_10, C_10, \
+ N_11, AN_11, T_11, C_11, \
+ N_12, AN_12, T_12, C_12, \
+ N_13, AN_13, T_13, C_13, \
+ N_14, AN_14, T_14, C_14, \
+ N_15, AN_15, T_15, C_15, \
+ N_16, AN_16, T_16, C_16, \
+ N_17, AN_17, T_17, C_17, \
+ N_18, AN_18, T_18, C_18, \
+ N_19, AN_19, T_19, C_19, \
+ N_20, AN_20, T_20, C_20, \
+ N_21, AN_21, T_21, C_21, \
+ N_22, AN_22, T_22, C_22, \
+ N_23, AN_23, T_23, C_23, \
+ N_24, AN_24, T_24, C_24) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+ DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+ DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+ DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+ DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+ DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+ DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+ DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+ DEFINE_ATTRIBUTE(N_10, T_10, C_10) \
+ DEFINE_ATTRIBUTE(N_11, T_11, C_11) \
+ DEFINE_ATTRIBUTE(N_12, T_12, C_12) \
+ DEFINE_ATTRIBUTE(N_13, T_13, C_13) \
+ DEFINE_ATTRIBUTE(N_14, T_14, C_14) \
+ DEFINE_ATTRIBUTE(N_15, T_15, C_15) \
+ DEFINE_ATTRIBUTE(N_16, T_16, C_16) \
+ DEFINE_ATTRIBUTE(N_17, T_17, C_17) \
+ DEFINE_ATTRIBUTE(N_18, T_18, C_18) \
+ DEFINE_ATTRIBUTE(N_19, T_19, C_19) \
+ DEFINE_ATTRIBUTE(N_20, T_20, C_20) \
+ DEFINE_ATTRIBUTE(N_21, T_21, C_21) \
+ DEFINE_ATTRIBUTE(N_22, T_22, C_22) \
+ DEFINE_ATTRIBUTE(N_23, T_23, C_23) \
+ DEFINE_ATTRIBUTE(N_24, T_24, C_24) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ SET_ATTRIBUTE(N_2, T_2, AN_2) \
+ SET_ATTRIBUTE(N_3, T_3, AN_3) \
+ SET_ATTRIBUTE(N_4, T_4, AN_4) \
+ SET_ATTRIBUTE(N_5, T_5, AN_5) \
+ SET_ATTRIBUTE(N_6, T_6, AN_6) \
+ SET_ATTRIBUTE(N_7, T_7, AN_7) \
+ SET_ATTRIBUTE(N_8, T_8, AN_8) \
+ SET_ATTRIBUTE(N_9, T_9, AN_9) \
+ SET_ATTRIBUTE(N_10, T_10, AN_10) \
+ SET_ATTRIBUTE(N_11, T_11, AN_11) \
+ SET_ATTRIBUTE(N_12, T_12, AN_12) \
+ SET_ATTRIBUTE(N_13, T_13, AN_13) \
+ SET_ATTRIBUTE(N_14, T_14, AN_14) \
+ SET_ATTRIBUTE(N_15, T_15, AN_15) \
+ SET_ATTRIBUTE(N_16, T_16, AN_16) \
+ SET_ATTRIBUTE(N_17, T_17, AN_17) \
+ SET_ATTRIBUTE(N_18, T_18, AN_18) \
+ SET_ATTRIBUTE(N_19, T_19, AN_19) \
+ SET_ATTRIBUTE(N_20, T_20, AN_20) \
+ SET_ATTRIBUTE(N_21, T_21, AN_21) \
+ SET_ATTRIBUTE(N_22, T_22, AN_22) \
+ SET_ATTRIBUTE(N_23, T_23, AN_23) \
+ SET_ATTRIBUTE(N_24, T_24, AN_24) \
+ END_INIT() \
+ public:
+
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_27(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1, \
+ N_2, AN_2, T_2, C_2, \
+ N_3, AN_3, T_3, C_3, \
+ N_4, AN_4, T_4, C_4, \
+ N_5, AN_5, T_5, C_5, \
+ N_6, AN_6, T_6, C_6, \
+ N_7, AN_7, T_7, C_7, \
+ N_8, AN_8, T_8, C_8, \
+ N_9, AN_9, T_9, C_9, \
+ N_10, AN_10, T_10, C_10, \
+ N_11, AN_11, T_11, C_11, \
+ N_12, AN_12, T_12, C_12, \
+ N_13, AN_13, T_13, C_13, \
+ N_14, AN_14, T_14, C_14, \
+ N_15, AN_15, T_15, C_15, \
+ N_16, AN_16, T_16, C_16, \
+ N_17, AN_17, T_17, C_17, \
+ N_18, AN_18, T_18, C_18, \
+ N_19, AN_19, T_19, C_19, \
+ N_20, AN_20, T_20, C_20, \
+ N_21, AN_21, T_21, C_21, \
+ N_22, AN_22, T_22, C_22, \
+ N_23, AN_23, T_23, C_23, \
+ N_24, AN_24, T_24, C_24, \
+ N_25, AN_25, T_25, C_25, \
+ N_26, AN_26, T_26, C_26) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+ DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+ DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+ DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+ DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+ DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+ DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+ DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+ DEFINE_ATTRIBUTE(N_10, T_10, C_10) \
+ DEFINE_ATTRIBUTE(N_11, T_11, C_11) \
+ DEFINE_ATTRIBUTE(N_12, T_12, C_12) \
+ DEFINE_ATTRIBUTE(N_13, T_13, C_13) \
+ DEFINE_ATTRIBUTE(N_14, T_14, C_14) \
+ DEFINE_ATTRIBUTE(N_15, T_15, C_15) \
+ DEFINE_ATTRIBUTE(N_16, T_16, C_16) \
+ DEFINE_ATTRIBUTE(N_17, T_17, C_17) \
+ DEFINE_ATTRIBUTE(N_18, T_18, C_18) \
+ DEFINE_ATTRIBUTE(N_19, T_19, C_19) \
+ DEFINE_ATTRIBUTE(N_20, T_20, C_20) \
+ DEFINE_ATTRIBUTE(N_21, T_21, C_21) \
+ DEFINE_ATTRIBUTE(N_22, T_22, C_22) \
+ DEFINE_ATTRIBUTE(N_23, T_23, C_23) \
+ DEFINE_ATTRIBUTE(N_24, T_24, C_24) \
+ DEFINE_ATTRIBUTE(N_25, T_25, C_25) \
+ DEFINE_ATTRIBUTE(N_26, T_26, C_26) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ SET_ATTRIBUTE(N_2, T_2, AN_2) \
+ SET_ATTRIBUTE(N_3, T_3, AN_3) \
+ SET_ATTRIBUTE(N_4, T_4, AN_4) \
+ SET_ATTRIBUTE(N_5, T_5, AN_5) \
+ SET_ATTRIBUTE(N_6, T_6, AN_6) \
+ SET_ATTRIBUTE(N_7, T_7, AN_7) \
+ SET_ATTRIBUTE(N_8, T_8, AN_8) \
+ SET_ATTRIBUTE(N_9, T_9, AN_9) \
+ SET_ATTRIBUTE(N_10, T_10, AN_10) \
+ SET_ATTRIBUTE(N_11, T_11, AN_11) \
+ SET_ATTRIBUTE(N_12, T_12, AN_12) \
+ SET_ATTRIBUTE(N_13, T_13, AN_13) \
+ SET_ATTRIBUTE(N_14, T_14, AN_14) \
+ SET_ATTRIBUTE(N_15, T_15, AN_15) \
+ SET_ATTRIBUTE(N_16, T_16, AN_16) \
+ SET_ATTRIBUTE(N_17, T_17, AN_17) \
+ SET_ATTRIBUTE(N_18, T_18, AN_18) \
+ SET_ATTRIBUTE(N_19, T_19, AN_19) \
+ SET_ATTRIBUTE(N_20, T_20, AN_20) \
+ SET_ATTRIBUTE(N_21, T_21, AN_21) \
+ SET_ATTRIBUTE(N_22, T_22, AN_22) \
+ SET_ATTRIBUTE(N_23, T_23, AN_23) \
+ SET_ATTRIBUTE(N_24, T_24, AN_24) \
+ SET_ATTRIBUTE(N_25, T_25, AN_25) \
+ SET_ATTRIBUTE(N_26, T_26, AN_26) \
+ END_INIT() \
+ public:
+
//--------------------------------------------------------------------------------------
#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_MACRO_H_ */
ModuleBase_ActionIntParameter.h
ModuleBase_ChoiceCtrl.h
ModuleBase_WidgetNameEdit.h
+ ModuleBase_WidgetRadiobox.h
+ ModuleBase_WidgetPointInput.h
)
SET(PROJECT_MOC_HEADERS
ModuleBase_WidgetValidated.h
ModuleBase_ChoiceCtrl.h
ModuleBase_WidgetNameEdit.h
+ ModuleBase_WidgetRadiobox.h
+ ModuleBase_WidgetPointInput.h
)
SET(PROJECT_SOURCES
ModuleBase_Dialog.cpp
ModuleBase_ChoiceCtrl.cpp
ModuleBase_WidgetNameEdit.cpp
+ ModuleBase_WidgetRadiobox.cpp
+ ModuleBase_WidgetPointInput.cpp
)
SET(PROJECT_LIBRARIES
double ModuleBase_ParamSpinBox::value() const
{
+ std::string aa = lineEdit()->text().toStdString();
return lineEdit()->text().toDouble();
}
#include <ModelAPI_Tools.h>
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_ResultCompSolid.h>
+#include <ModelAPI_AttributeIntArray.h>
#include "ModuleBase_Tools.h"
#include "ModuleBase_BRepOwner.h"
std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(theResult);
TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
Set(aShape);
+
+ // Set own free boundaries aspect in order to have free an unfree boundaries with different colors
Handle(Prs3d_Drawer) aDrawer = Attributes();
+ Handle(Prs3d_LineAspect) aFreeBndAspect = new Prs3d_LineAspect(Quantity_NOC_GREEN, Aspect_TOL_SOLID, 1);
+ aDrawer->SetFreeBoundaryAspect(aFreeBndAspect);
+
if (aDrawer->HasOwnPointAspect())
aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS);
else
myHiddenSubShapesDrawer->SetShadingAspect(aShadingAspect);
ModuleBase_Tools::setPointBallHighlighting(this);
+
+ // Define colors for wireframe mode
+ setEdgesDefaultColor();
}
//********************************************************************
{
ViewerData_AISShape::SetColor(theColor);
myHiddenSubShapesDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
+ setEdgesDefaultColor();
+}
+
+void ModuleBase_ResultPrs::setEdgesDefaultColor()
+{
+ AttributeIntArrayPtr aColorAttr = myResult->data()->intArray(ModelAPI_Result::COLOR_ID());
+ bool aHasColor = aColorAttr.get() && aColorAttr->isInitialized();
+
+ if (!aHasColor) {
+ Handle(Prs3d_Drawer) aDrawer = Attributes();
+ Handle(Prs3d_LineAspect) anAspect; // = aDrawer->LineAspect();
+ //anAspect->SetColor(Quantity_NOC_YELLOW);
+ //aDrawer->SetLineAspect(anAspect);
+
+ // - unfree boundaries color
+ anAspect = aDrawer->UnFreeBoundaryAspect();
+ anAspect->SetColor(Quantity_NOC_YELLOW);
+ aDrawer->SetUnFreeBoundaryAspect(anAspect);
+ aDrawer->SetUnFreeBoundaryDraw(true);
+
+ // - free boundaries color
+ anAspect = aDrawer->FreeBoundaryAspect();
+ anAspect->SetColor(Quantity_NOC_GREEN);
+ aDrawer->SetFreeBoundaryAspect(anAspect);
+ aDrawer->SetFreeBoundaryDraw(true);
+
+ // - standalone edges color
+ anAspect = aDrawer->WireAspect();
+ anAspect->SetColor(Quantity_NOC_RED);
+ aDrawer->SetWireAspect(anAspect);
+ }
}
+
//********************************************************************
bool ModuleBase_ResultPrs::setSubShapeHidden(const NCollection_List<TopoDS_Shape>& theShapes)
{
void collectSubShapes(BRep_Builder& theBuilder, TopoDS_Shape& theCompound,
const TopoDS_Shape& theShape, const NCollection_List<TopoDS_Shape>& theHiddenSubShapes);
+ void setEdgesDefaultColor();
+
private:
/// Reference to result object
ResultPtr myResult;
#include <ModuleBase_WidgetConcealedObjects.h>
#include <ModuleBase_WidgetLabel.h>
#include <ModuleBase_WidgetToolbox.h>
+#include <ModuleBase_WidgetRadiobox.h>
#include <ModuleBase_PageBase.h>
#include <ModuleBase_PageGroupBox.h>
#include <ModuleBase_WidgetOptionalBox.h>
#include <ModuleBase_WidgetExprEditor.h>
#include <ModuleBase_WidgetCreatorFactory.h>
#include <ModuleBase_WidgetAction.h>
+#include <ModuleBase_WidgetPointInput.h>
#include <ModelAPI_Validator.h>
#include <ModelAPI_Session.h>
QString aCaseId = qs(myWidgetApi->getProperty(_ID));
ModuleBase_PageBase* aPage = new ModuleBase_PageWidget(aWidget);
createWidget(aPage);
- if (aWdgType == WDG_SWITCH || aWdgType == WDG_TOOLBOX) {
+ if (aWdgType == WDG_SWITCH || aWdgType == WDG_TOOLBOX || aWdgType == WDG_RADIOBOX) {
ModuleBase_PagedContainer* aContainer =
qobject_cast<ModuleBase_PagedContainer*>(aWidget);
result = new ModuleBase_WidgetConcealedObjects(theParent, myWidgetApi);
} else if (theType == WDG_TOOLBOX) {
result = new ModuleBase_WidgetToolbox(theParent, myWidgetApi);
+ } else if (theType == WDG_RADIOBOX) {
+ result = new ModuleBase_WidgetRadiobox(theParent, myWidgetApi);
} else if (theType == WDG_SWITCH) {
result = new ModuleBase_WidgetSwitch(theParent, myWidgetApi);
} else if (theType == WDG_TOOLBOX_BOX || theType == WDG_SWITCH_CASE ||
result = NULL;
} else if (theType == WDG_ACTION) {
result = new ModuleBase_WidgetAction(theParent, myWidgetApi);
+ } else if (theType == WDG_POINT_INPUT) {
+ result = new ModuleBase_WidgetPointInput(theParent, myWorkshop, myWidgetApi);
} else {
result = myWorkshop->module()->createWidgetByType(theType, theParent, myWidgetApi);
if (!result)
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "ModuleBase_WidgetPointInput.h"
+#include "ModuleBase_Tools.h"
+#include "ModuleBase_ParamSpinBox.h"
+#include "ModuleBase_ViewerPrs.h"
+
+#include <GeomAPI_Vertex.h>
+#include <GeomAPI_Pnt.h>
+
+#include <GeomDataAPI_Point.h>
+
+#include <Config_WidgetAPI.h>
+#include <Config_Keywords.h>
+
+#include <QFormLayout>
+#include <QLabel>
+
+ModuleBase_WidgetPointInput::ModuleBase_WidgetPointInput(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
+ const Config_WidgetAPI* theData)
+ : ModuleBase_WidgetSelector(theParent, theWorkshop, theData)
+{
+ bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true);
+
+ QFormLayout* aMainlayout = new QFormLayout(this);
+ ModuleBase_Tools::adjustMargins(aMainlayout);
+
+ myXSpin = new ModuleBase_ParamSpinBox(this);
+ myXSpin->setAcceptVariables(aAcceptVariables);
+ myXSpin->setToolTip("X coordinate");
+ myXSpin->setValue(0);
+ QLabel* aXLbl = new QLabel(this);
+ aXLbl->setPixmap(QPixmap(":pictures/x_size.png"));
+ aMainlayout->addRow(aXLbl, myXSpin);
+
+ myYSpin = new ModuleBase_ParamSpinBox(this);
+ myYSpin->setAcceptVariables(aAcceptVariables);
+ myYSpin->setToolTip("Y coordinate");
+ myYSpin->setValue(0);
+ QLabel* aYLbl = new QLabel(this);
+ aYLbl->setPixmap(QPixmap(":pictures/y_size.png"));
+ aMainlayout->addRow(aYLbl, myYSpin);
+
+ myZSpin = new ModuleBase_ParamSpinBox(this);
+ myZSpin->setAcceptVariables(aAcceptVariables);
+ myZSpin->setToolTip("Z coordinate");
+ myZSpin->setValue(0);
+ QLabel* aZLbl = new QLabel(this);
+ aZLbl->setPixmap(QPixmap(":pictures/z_size.png"));
+ aMainlayout->addRow(aZLbl, myZSpin);
+}
+
+ModuleBase_WidgetPointInput::~ModuleBase_WidgetPointInput()
+{
+
+}
+
+
+//********************************************************************
+QList<QWidget*> ModuleBase_WidgetPointInput::getControls() const
+{
+ QList<QWidget*> aList;
+ aList.append(myXSpin);
+ aList.append(myYSpin);
+ aList.append(myZSpin);
+ return aList;
+}
+
+//********************************************************************
+bool ModuleBase_WidgetPointInput::storeValueCustom()
+{
+ AttributePointPtr aAttr = std::dynamic_pointer_cast<GeomDataAPI_Point>(attribute());
+ if (aAttr.get()) {
+ if (myXSpin->hasVariable() || myYSpin->hasVariable() || myZSpin->hasVariable()) {
+ aAttr->setText(myXSpin->text().toStdString(),
+ myYSpin->text().toStdString(), myZSpin->text().toStdString());
+ } else {
+ aAttr->setValue(myXSpin->value(), myYSpin->value(), myZSpin->value());
+ }
+ return true;
+ }
+ return false;
+}
+
+//********************************************************************
+bool ModuleBase_WidgetPointInput::restoreValueCustom()
+{
+ AttributePointPtr aAttr = std::dynamic_pointer_cast<GeomDataAPI_Point>(attribute());
+ if (aAttr.get()) {
+ std::string aXText = aAttr->textX();
+ if (aXText.empty()) {
+ myXSpin->setValue(aAttr->x());
+ } else {
+ myXSpin->setText(aXText.c_str());
+ }
+ std::string aYText = aAttr->textY();
+ if (aYText.empty()) {
+ myYSpin->setValue(aAttr->y());
+ } else {
+ myYSpin->setText(aYText.c_str());
+ }
+ std::string aZText = aAttr->textZ();
+ if (aZText.empty()) {
+ myZSpin->setValue(aAttr->z());
+ } else {
+ myZSpin->setText(aZText.c_str());
+ }
+ return true;
+ }
+ return false;
+}
+
+//********************************************************************
+void ModuleBase_WidgetPointInput::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
+{
+ theModuleSelectionModes = -1;
+ theModes << TopAbs_VERTEX;
+}
+
+//********************************************************************
+QIntList ModuleBase_WidgetPointInput::shapeTypes() const
+{
+ QIntList aList;
+ aList << TopAbs_VERTEX;
+ return aList;
+}
+
+//********************************************************************
+bool ModuleBase_WidgetPointInput
+::setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs)
+{
+ GeomShapePtr aShape = thePrs->shape();
+ if (aShape->isVertex()) {
+ GeomVertexPtr aVertex(new GeomAPI_Vertex(aShape));
+ GeomPointPtr aPnt = aVertex->point();
+ myXSpin->setValue(aPnt->x());
+ myYSpin->setValue(aPnt->y());
+ myZSpin->setValue(aPnt->z());
+ return true;
+ }
+ return false;
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef ModuleBase_WidgetPointInput_H
+#define ModuleBase_WidgetPointInput_H
+
+#include "ModuleBase.h"
+#include "ModuleBase_WidgetSelector.h"
+
+class ModuleBase_ParamSpinBox;
+
+class MODULEBASE_EXPORT ModuleBase_WidgetPointInput : public ModuleBase_WidgetSelector
+{
+ Q_OBJECT
+public:
+ /// Constructor
+ /// \param theParent the parent object
+ /// \param theWorkshop a current workshop
+ /// \param theData the widget configuation. The attribute of the model widget is obtained from
+ ModuleBase_WidgetPointInput(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
+ const Config_WidgetAPI* theData);
+
+ /// Destructor
+ virtual ~ModuleBase_WidgetPointInput();
+
+ /// Returns list of widget controls
+ /// \return a control list
+ virtual QList<QWidget*> getControls() const;
+
+ /// Saves the internal parameters to the given feature
+ /// \return True in success
+ virtual bool storeValueCustom();
+
+ /// Restore value from attribute data to the widget's control
+ virtual bool restoreValueCustom();
+
+ /// Defines if it is supposed that the widget should interact with the viewer.
+ virtual bool isViewerSelector() { return true; }
+
+ /// Fills given container with selection modes if the widget has it
+ /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
+ /// \param [out] theModes a container of modes
+ virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
+
+ /// Fills the attribute with the value of the selected owner
+ /// \param thePrs a selected owner
+ virtual bool setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
+
+protected:
+ /// Retunrs a list of possible shape types
+ /// \return a list of shapes
+ virtual QIntList shapeTypes() const;
+
+protected:
+ ModuleBase_ParamSpinBox* myXSpin;
+ ModuleBase_ParamSpinBox* myYSpin;
+ ModuleBase_ParamSpinBox* myZSpin;
+};
+
+
+#endif
\ No newline at end of file
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <ModuleBase_WidgetRadiobox.h>
+#include <ModuleBase_PageBase.h>
+
+#include <QFormLayout>
+#include <QRadioButton>
+#include <QFrame>
+#include <QButtonGroup>
+
+
+ModuleBase_WidgetRadiobox::ModuleBase_WidgetRadiobox(QWidget* theParent,
+ const Config_WidgetAPI* theData)
+ : ModuleBase_PagedContainer(theParent, theData)
+{
+ myLayout = new QFormLayout(this);
+ ModuleBase_Tools::adjustMargins(myLayout);
+ myGroup = new QButtonGroup(this);
+ myGroup->setExclusive(true);
+
+ connect(myGroup, SIGNAL(buttonToggled(int, bool)), SLOT(onPageChanged()));
+}
+
+ModuleBase_WidgetRadiobox::~ModuleBase_WidgetRadiobox()
+{
+}
+
+int ModuleBase_WidgetRadiobox::addPage(ModuleBase_PageBase* thePage,
+ const QString& theName,
+ const QString& theCaseId,
+ const QPixmap& theIcon)
+{
+ ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon);
+ QWidget* aWgt = new QWidget(this);
+ QVBoxLayout* aLay = new QVBoxLayout(aWgt);
+ aLay->setContentsMargins(0, 0, 0, 0);
+
+ QRadioButton* aButton = new QRadioButton(aWgt);
+ aButton->setToolTip(theName);
+ aLay->addStretch();
+ aLay->addWidget(aButton);
+ aLay->addStretch();
+
+ //QFrame* aFrame = dynamic_cast<QFrame*>(thePage);
+ QWidget* aPage = thePage->pageWidget();
+ myLayout->addRow(aWgt, aPage);
+ myGroup->addButton(aButton, myGroup->buttons().count());
+
+ bool isDefault = theCaseId.toStdString() == getDefaultValue();
+ aButton->setChecked(isDefault);
+ aPage->setEnabled(isDefault);
+ connect(aButton, SIGNAL(toggled(bool)), aPage, SLOT(setEnabled(bool)));
+
+ return myGroup->buttons().count();
+}
+
+int ModuleBase_WidgetRadiobox::currentPageIndex() const
+{
+ return myGroup->checkedId();
+}
+
+void ModuleBase_WidgetRadiobox::setCurrentPageIndex(int theIndex)
+{
+ bool isSignalsBlocked = myGroup->blockSignals(true);
+ myGroup->button(theIndex)->setChecked(true);
+ myGroup->blockSignals(isSignalsBlocked);
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef MODULEBASE_WIDGETRADIOBOX_H_
+#define MODULEBASE_WIDGETRADIOBOX_H_
+
+#include <ModuleBase.h>
+#include <ModuleBase_PagedContainer.h>
+
+class QFormLayout;
+class QButtonGroup;
+class QRadioButton;
+
+class MODULEBASE_EXPORT ModuleBase_WidgetRadiobox : public ModuleBase_PagedContainer
+{
+ Q_OBJECT
+public:
+ /// Constructor
+ /// \param theParent the parent object
+ /// \param theData the widget configuration. The attribute of the model widget is obtained from
+ ModuleBase_WidgetRadiobox(QWidget* theParent, const Config_WidgetAPI* theData);
+ virtual ~ModuleBase_WidgetRadiobox();
+
+
+ /// Add a page to the widget
+ /// \param theWidget a page widget
+ /// \param theName a name of page
+ /// \param theCaseId an Id of the page
+ /// \param theIcon an icon of the page
+ virtual int addPage(ModuleBase_PageBase* theWidget,
+ const QString& theName,
+ const QString& theCaseId,
+ const QPixmap& theIcon);
+
+protected:
+ /// Implements ModuleBase_PagedContainer
+ virtual int currentPageIndex() const;
+
+ /// Implements ModuleBase_PagedContainer
+ virtual void setCurrentPageIndex(int);
+
+private:
+ QFormLayout* myLayout;
+ QButtonGroup* myGroup;
+};
+
+#endif
\ No newline at end of file
XGUI_ViewerProxy.h
XGUI_Workshop.h
XGUI_WorkshopListener.h
+ XGUI_InspectionPanel.h
)
SET(PROJECT_MOC_HEADERS
XGUI_ViewerProxy.h
XGUI_Workshop.h
XGUI_WorkshopListener.h
+ XGUI_InspectionPanel.h
)
# sources / moc wrappings
XGUI_ViewerProxy.cpp
XGUI_Workshop.cpp
XGUI_WorkshopListener.cpp
+ XGUI_InspectionPanel.cpp
)
SET(PROJECT_RESOURCES
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "XGUI_InspectionPanel.h"
+#include "XGUI_SelectionMgr.h"
+#include "XGUI_Selection.h"
+
+#include <QLayout>
+#include <QScrollArea>
+#include <QLabel>
+#include <QLineEdit>
+#include <QTableWidget>
+#include <QHeaderView>
+#include <QTextBrowser>
+
+XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr* theMgr)
+ : QDockWidget(theParent),
+ mySelectionMgr(theMgr)
+{
+ setWindowTitle(tr("Inspection Panel"));
+ setObjectName(INSPECTION_PANEL);
+ setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }");
+
+ QScrollArea* aScrollArea = new QScrollArea(this);
+ setWidget(aScrollArea);
+
+ // Create an internal widget
+ QWidget* aMainWidget = new QWidget(aScrollArea);
+
+ QVBoxLayout* aMainLayout = new QVBoxLayout(aMainWidget);
+ aMainLayout->setContentsMargins(5, 5, 5, 5);
+
+ QWidget* aNameWgt = new QWidget(aMainWidget);
+ QHBoxLayout* aNameLayout = new QHBoxLayout(aNameWgt);
+ aNameLayout->setContentsMargins(0, 0, 0, 0);
+ aNameLayout->addWidget(new QLabel(tr("Object"), aNameWgt));
+ myNameEdt = new QLineEdit(aNameWgt);
+ myNameEdt->setReadOnly(true);
+ aNameLayout->addWidget(myNameEdt);
+
+ aMainLayout->addWidget(aNameWgt);
+
+ // Table with sub-shapes
+ mySubShapesTab = new QTableWidget(9, 2, aMainWidget);
+ mySubShapesTab->setFocusPolicy(Qt::NoFocus);
+ mySubShapesTab->verticalHeader()->hide();
+ QStringList aTitles;
+ aTitles << tr("Sub-shapes") << tr("Number");
+ mySubShapesTab->setHorizontalHeaderLabels(aTitles);
+
+ QStringList aSubShapes;
+ aSubShapes << "SHAPE" << "COMPOUND" << "COMPSOLID" <<
+ "SOLID" << "SHELL" << "FACE" << "WIRE" << "EDGE" << "VERTEX";
+ int i = 0;
+ foreach(QString aType, aSubShapes) {
+ QTableWidgetItem* aItem = new QTableWidgetItem(aType);
+ aItem->setFlags(Qt::ItemIsEnabled);
+ mySubShapesTab->setItem(i++, 0, aItem);
+ }
+ for (i = 0; i < 9; i++) {
+ QTableWidgetItem* aItem = new QTableWidgetItem("0");
+ aItem->setFlags(Qt::ItemIsEnabled);
+ aItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
+ mySubShapesTab->setItem(i, 1, aItem);
+ }
+ mySubShapesTab->setColumnWidth(0, 90);
+ mySubShapesTab->setColumnWidth(1, 70);
+
+ mySubShapesTab->setMaximumWidth(170);
+ mySubShapesTab->setMinimumHeight(300);
+
+ aMainLayout->addWidget(mySubShapesTab);
+
+ // Type of object
+ QWidget* aTypeWgt = new QWidget(aMainWidget);
+ QHBoxLayout* aTypeLayout = new QHBoxLayout(aTypeWgt);
+ aTypeLayout->setContentsMargins(0, 0, 0, 0);
+
+ aTypeLayout->addWidget(new QLabel(tr("Type:"), aTypeWgt));
+ myTypeLbl = new QLabel("No-type", aTypeWgt);
+ aTypeLayout->addWidget(myTypeLbl);
+
+ aMainLayout->addWidget(aTypeWgt);
+
+ myTypeParams = new QTextBrowser(aMainWidget);
+ myTypeParams->setMaximumWidth(170);
+ myTypeParams->setMaximumHeight(160);
+ myTypeParams->setReadOnly(true);
+ myTypeParams->setFocusPolicy(Qt::NoFocus);
+ myTypeParams->setFrameStyle(QFrame::NoFrame);
+ myTypeParams->viewport()->setBackgroundRole(QPalette::Window);
+
+ aMainLayout->addWidget(myTypeParams);
+
+ aScrollArea->setWidget(aMainWidget);
+
+ connect(mySelectionMgr, SIGNAL(selectionChanged()), SLOT(onSelectionChanged()));
+
+ // Test
+ setVertexType(0, 0, 0);
+}
+
+XGUI_InspectionPanel::~XGUI_InspectionPanel()
+{
+}
+
+void XGUI_InspectionPanel::setSubShapeValue(SudShape theId, int theVal)
+{
+ mySubShapesTab->item(theId, 1)->setText(QString::number(theVal));
+}
+
+void XGUI_InspectionPanel::onSelectionChanged()
+{
+ QObjectPtrList aObjects = mySelectionMgr->selection()->selectedObjects();
+ if (aObjects.count() > 0) {
+ ObjectPtr aObj = aObjects.first();
+ setName(aObj->data()->name().c_str());
+ }
+}
+
+void XGUI_InspectionPanel::setName(const QString& theName)
+{
+ myNameEdt->setText(theName);
+}
+
+#define TITLE(val) ("<b>" + val + "</b>")
+
+void XGUI_InspectionPanel::setCylinderType(double theX, double theY, double theZ,
+ double theDX, double theDY, double theDZ, double theRadius, double theHeight)
+{
+ myTypeLbl->setText(tr("Cylinder"));
+ QString aParams = TITLE(tr("Center")) +
+ "<br> X: " + QString::number(theX) +
+ "<br> Y: " + QString::number(theY) +
+ "<br> Z: " + QString::number(theZ) +
+ "<br>" + TITLE(tr("Axis")) +
+ "<br> DX: " + QString::number(theDX) +
+ "<br> DY: " + QString::number(theDY) +
+ "<br> DZ: " + QString::number(theDZ) +
+ "<br>" + TITLE(tr("Dimensions")) +
+ "<br>" + tr("Radius:") + QString::number(theRadius) +
+ "<br>" + tr("Height") + QString::number(theHeight);
+
+ myTypeParams->setText(aParams);
+}
+
+void XGUI_InspectionPanel::setSphereType(double theX, double theY, double theZ, double theRadius)
+{
+ myTypeLbl->setText(tr("Sphere"));
+ QString aParams = TITLE(tr("Center")) +
+ "<br> X: " + QString::number(theX) +
+ "<br> Y: " + QString::number(theY) +
+ "<br> Z: " + QString::number(theZ) +
+ "<br>" + TITLE(tr("Dimensions")) +
+ "<br>" + tr("Radius:") + QString::number(theRadius);
+ myTypeParams->setText(aParams);
+}
+
+void XGUI_InspectionPanel::setBoxType(double theX, double theY, double theZ,
+ double theXsize, double theYsize, double theZsize)
+{
+ myTypeLbl->setText(tr("Box"));
+ QString aParams = TITLE(tr("Position")) +
+ "<br> X: " + QString::number(theX) +
+ "<br> Y: " + QString::number(theY) +
+ "<br> Z: " + QString::number(theZ) +
+ "<br>" + TITLE(tr("Dimensions")) +
+ "<br>" + "Ax :" + QString::number(theXsize) +
+ "<br>" + "Ay :" + QString::number(theYsize) +
+ "<br>" + "Az :" + QString::number(theZsize);
+ myTypeParams->setText(aParams);
+}
+
+
+void XGUI_InspectionPanel::setRotatedBoxType(double theX, double theY, double theZ,
+ double theZaxisX, double theZaxisY, double theZaxisZ,
+ double theXaxisX, double theXaxisY, double theXaxisZ,
+ double theXsize, double theYsize, double theZsize)
+{
+ myTypeLbl->setText(tr("Box"));
+ QString aParams = TITLE(tr("Position")) +
+ "<br> X: " + QString::number(theX) +
+ "<br> Y: " + QString::number(theY) +
+ "<br> Z: " + QString::number(theZ) +
+ "<br>" + TITLE(tr("Z axis")) +
+ "<br> DX: " + QString::number(theZaxisX) +
+ "<br> DY: " + QString::number(theZaxisY) +
+ "<br> DZ: " + QString::number(theZaxisZ) +
+ "<br>" + TITLE(tr("X axis")) +
+ "<br> DX: " + QString::number(theXaxisX) +
+ "<br> DY: " + QString::number(theXaxisY) +
+ "<br> DZ: " + QString::number(theXaxisZ) +
+ "<br>" + TITLE(tr("Dimensions")) +
+ "<br>" + "Ax :" + QString::number(theXsize) +
+ "<br>" + "Ay :" + QString::number(theYsize) +
+ "<br>" + "Az :" + QString::number(theZsize);
+ myTypeParams->setText(aParams);
+}
+
+void XGUI_InspectionPanel::setPlaneType(double theX, double theY, double theZ,
+ double theDX, double theDY, double theDZ)
+{
+ myTypeLbl->setText(tr("Plane"));
+ QString aParams = TITLE(tr("Center")) +
+ "<br> X: " + QString::number(theX) +
+ "<br> Y: " + QString::number(theY) +
+ "<br> Z: " + QString::number(theZ) +
+ "<br>" + TITLE(tr("Normal")) +
+ "<br> DX: " + QString::number(theDX) +
+ "<br> DY: " + QString::number(theDY) +
+ "<br> DZ: " + QString::number(theDZ);
+ myTypeParams->setText(aParams);
+}
+
+void XGUI_InspectionPanel::setVertexType(double theX, double theY, double theZ)
+{
+ myTypeLbl->setText(tr("Vertex"));
+ QString aParams = TITLE(tr("Coordinates")) +
+ "<br> X: " + QString::number(theX) +
+ "<br> Y: " + QString::number(theY) +
+ "<br> Z: " + QString::number(theZ);
+ myTypeParams->setText(aParams);
+}
\ No newline at end of file
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef XGUI_INSPECTIONPANEL_H_
+#define XGUI_INSPECTIONPANEL_H_
+
+#include "XGUI.h"
+
+#include <QDockWidget>
+
+class XGUI_SelectionMgr;
+class QLineEdit;
+class QTableWidget;
+class QLabel;
+class QTextBrowser;
+
+/// Internal name of property panel widget
+const static char* INSPECTION_PANEL = "inspection_panel_dock";
+
+class XGUI_EXPORT XGUI_InspectionPanel : public QDockWidget
+{
+ Q_OBJECT
+public:
+ enum SudShape {
+ ShapeId,
+ CompoundId,
+ CompsolidId,
+ SolidId,
+ ShellId,
+ FaceId,
+ WireId,
+ EdgeId,
+ VertexId
+ };
+
+ /// Constructor
+ /// \param theParent is a parent of the property panel
+ /// \param theMgr operation manager
+ XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr* theMgr);
+
+ virtual ~XGUI_InspectionPanel();
+
+ void setSubShapeValue(SudShape theId, int theVal);
+
+ void setName(const QString& theName);
+
+ // Set of type parameters
+ void setCylinderType(double theX, double theY, double theZ,
+ double theDX, double theDY, double theDZ, double theRadius, double theHeight);
+
+ void setSphereType(double theX, double theY, double theZ, double theRadius);
+
+ void setBoxType(double theX, double theY, double theZ,
+ double theXsize, double theYsize, double theZsize);
+
+ void setRotatedBoxType(double theX, double theY, double theZ,
+ double theZaxisX, double theZaxisY, double theZaxisZ,
+ double theXaxisX, double theXaxisY, double theXaxisZ,
+ double theXsize, double theYsize, double theZsize);
+
+ void setPlaneType(double theX, double theY, double theZ,
+ double theDX, double theDY, double theDZ);
+
+ void setVertexType(double theX, double theY, double theZ);
+
+private slots:
+ void onSelectionChanged();
+
+private:
+ XGUI_SelectionMgr* mySelectionMgr;
+
+ QLineEdit* myNameEdt;
+ QTableWidget* mySubShapesTab;
+ QLabel* myTypeLbl;
+ QTextBrowser* myTypeParams;
+};
+
+#endif
\ No newline at end of file
#include <XGUI_HistoryMenu.h>
#include <XGUI_QtEvents.h>
#include <XGUI_DataModel.h>
+#include <XGUI_InspectionPanel.h>
#ifndef HAVE_SALOME
#include <AppElements_Button.h>
myModule(NULL),
mySalomeConnector(theConnector),
myPropertyPanel(0),
+ myInspectionPanel(0),
myFacesPanel(0),
myObjectBrowser(0),
myDisplayer(0)
Qt::BottomDockWidgetArea);
connect(myFacesPanel, SIGNAL(closed()), myFacesPanel, SLOT(onClosed()));
+ myInspectionPanel = new XGUI_InspectionPanel(aDesktop, mySelector);
+ myInspectionPanel->setAllowedAreas(Qt::LeftDockWidgetArea |
+ Qt::RightDockWidgetArea);
+ aDesktop->addDockWidget(Qt::RightDockWidgetArea, myInspectionPanel);
+
aDesktop->addDockWidget(
#ifdef HAVE_SALOME
Qt::RightDockWidgetArea,
class XGUI_SelectionMgr;
class XGUI_ViewerProxy;
class XGUI_WorkshopListener;
+class XGUI_InspectionPanel;
class ModuleBase_IModule;
class ModuleBase_IViewer;
/// Returns property panel widget
XGUI_PropertyPanel* propertyPanel() const { return myPropertyPanel; }
+ /// Returns property panel widget
+ XGUI_InspectionPanel* inspectionPanel() const { return myInspectionPanel; }
+
/// Returns panel for hide object faces
XGUI_FacesPanel* facesPanel() const { return myFacesPanel; }
/// \param theParent a parent of widget
QDockWidget* createObjectBrowser(QWidget* theParent);
- /// Create property panel widget
- /// \param theParent a parent of widget
- QDockWidget* createPropertyPanel(QWidget* theParent);
-
// Creates Dock widgets: Object browser and Property panel
void createDockWidgets();
QString myCurrentDir; ///< cached the last open directory
QIntList myViewerSelMode; ///< selection modes set in the viewer
Config_DataModelReader* myDataModelXMLReader; ///< XML reader of data model
+ XGUI_InspectionPanel* myInspectionPanel; ///< container of feature attributes widgets
};
#endif