void ConstructionAPI_Point::setByProjectionOnEdge(const ModelHighAPI_Selection& theVertex,
const ModelHighAPI_Selection& theEdge)
{
- fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION_ON_EDGE(),
+ fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION(),
mycreationMethod);
- fillAttribute(theVertex, mypoinToProjectOnEdge);
+ 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_ON_FACE(),
+ fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION(),
mycreationMethod);
- fillAttribute(theVertex, mypoinToProjectOnFace);
+ fillAttribute(ConstructionPlugin_Point::PROJECTION_TYPE_ON_FACE(),
+ myprojectionType);
+ fillAttribute(theVertex, mypoinToProject);
fillAttribute(theFace, myfaceForPointProjection);
execute();
theDumper << ratio() << ", " << true;
}
theDumper << ", " << reverse()->value();
- } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION_ON_EDGE()) {
- theDumper << mypoinToProjectOnEdge << ", " << myedgeForPointProjection;
- } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION_ON_FACE()) {
- theDumper << mypoinToProjectOnFace << ", " << myfaceForPointProjection;
+ } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION()) {
+ theDumper << mypoinToProject << ", ";
+ if (projectionType()->value() == ConstructionPlugin_Point::PROJECTION_TYPE_ON_EDGE()) {
+ theDumper << myedgeForPointProjection;
+ } else {
+ theDumper << myfaceForPointProjection;
+ }
}
theDumper << ")" << std::endl;
ModelAPI_AttributeDouble, /** Ratio */,
reverse, ConstructionPlugin_Point::REVERSE(),
ModelAPI_AttributeBoolean, /** Reverse */,
- poinToProjectOnFace, ConstructionPlugin_Point::POINT_TO_PROJECT_ON_FACE(),
- ModelAPI_AttributeSelection, /** Point to project on face */,
+ 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 */,
- poinToProjectOnEdge, ConstructionPlugin_Point::POINT_TO_PROJECT_ON_EDGE(),
ModelAPI_AttributeSelection, /** Point to project on edge */,
edgeForPointProjection, ConstructionPlugin_Point::EDGE_FOR_POINT_PROJECTION(),
ModelAPI_AttributeSelection, /** Edge for point projection */)
data()->addAttribute(RATIO(), ModelAPI_AttributeDouble::typeId());
data()->addAttribute(REVERSE(), ModelAPI_AttributeBoolean::typeId());
- data()->addAttribute(POINT_TO_PROJECT_ON_EDGE(), ModelAPI_AttributeSelection::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(POINT_TO_PROJECT_ON_FACE(), ModelAPI_AttributeSelection::typeId());
data()->addAttribute(FACE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection::typeId());
}
aShape = createByXYZ();
} else if(aCreationMethod == CREATION_METHOD_BY_DISTANCE_ON_EDGE()) {
aShape = createByDistanceOnEdge();
- } else if(aCreationMethod == CREATION_METHOD_BY_PROJECTION_ON_EDGE()) {
- aShape = createByProjectionOnEdge();
- } else if(aCreationMethod == CREATION_METHOD_BY_PROJECTION_ON_FACE()) {
- aShape = createByProjectionOnFace();
+ } else if(aCreationMethod == CREATION_METHOD_BY_PROJECTION()) {
+ if (string(PROJECTION_TYPE())->value() == PROJECTION_TYPE_ON_EDGE()) {
+ aShape = createByProjectionOnEdge();
+ } else {
+ aShape = createByProjectionOnFace();
+ }
} /* else if(aCreationMethod == CREATION_METHOD_BY_LINES_INTERSECTION()) {
aShape = createByLinesIntersection();
} */ else if(aCreationMethod == CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()) {
std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByProjectionOnEdge()
{
// Get point.
- AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT_ON_EDGE());
+ AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT());
GeomShapePtr aPointShape = aPointSelection->value();
if (!aPointShape.get()) {
aPointShape = aPointSelection->context()->shape();
std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByProjectionOnFace()
{
// Get point.
- AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT_ON_FACE());
+ AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT());
GeomShapePtr aPointShape = aPointSelection->value();
if(!aPointShape.get()) {
aPointShape = aPointSelection->context()->shape();
}
/// Attribute name for creation method.
- inline static const std::string& CREATION_METHOD_BY_PROJECTION_ON_EDGE()
+ inline static const std::string& CREATION_METHOD_BY_PROJECTION()
{
- static const std::string MY_CREATION_METHOD_ID("by_projection_on_edge");
- return MY_CREATION_METHOD_ID;
- }
-
- /// Attribute name for creation method.
- inline static const std::string& CREATION_METHOD_BY_PROJECTION_ON_FACE()
- {
- static const std::string MY_CREATION_METHOD_ID("by_projection_on_face");
+ static const std::string MY_CREATION_METHOD_ID("by_projection");
return MY_CREATION_METHOD_ID;
}
return ATTR_ID;
}
- /// Attribute name for point to project on edge.
- inline static const std::string& POINT_TO_PROJECT_ON_EDGE()
+ /// Attribute name for point to projection.
+ inline static const std::string& POINT_TO_PROJECT()
{
- static const std::string ATTR_ID("point_to_project_on_edge");
+ static const std::string ATTR_ID("point_to_project");
return ATTR_ID;
}
- /// Attribute name for edge for point projection.
- inline static const std::string& EDGE_FOR_POINT_PROJECTION()
+ /// Attribute name for projection type.
+ inline static const std::string& PROJECTION_TYPE()
{
- static const std::string ATTR_ID("edge_for_point_projection");
+ static const std::string ATTR_ID("projection_type");
return ATTR_ID;
}
- /// Attribute name for point to project on surface.
- inline static const std::string& POINT_TO_PROJECT_ON_FACE()
+ /// Attribute name for projection type on edge.
+ inline static const std::string& PROJECTION_TYPE_ON_EDGE()
{
- static const std::string ATTR_ID("point_to_project_on_face");
+ static const std::string ATTR_ID("projection_type_on_edge");
+ return ATTR_ID;
+ }
+
+ /// Attribute name for projection type on face.
+ inline static const std::string& PROJECTION_TYPE_ON_FACE()
+ {
+ static const std::string ATTR_ID("projection_type_on_face");
+ return ATTR_ID;
+ }
+
+ /// 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;
}
assert (len(Point_3.results()) > 0)
rightPosition = GeomAPI_Vertex(50, 50, 0)
-assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()))
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
assert(model.checkPythonDump())
tooltip="Distance from edge end point."
default="false"/>
</box>
- <box id="by_projection_on_edge"
- title="By projection on edge"
- tooltip="Point on edge by projection selected point."
- icon="icons/Construction/point_by_projection_on_edge_32x32.png">
- <shape_selector id="point_to_project_on_edge"
+ <box id="by_projection"
+ 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_to_project"
label="Point"
tooltip="Point for projection."
icon="icons/Construction/point.png"
shape_types="vertex">
</shape_selector>
- <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="by_projection_on_face"
- title="By projection on face"
- tooltip="Point on face surface by projection selected point."
- icon="icons/Construction/point_by_projection_on_face_32x32.png">
- <shape_selector id="point_to_project_on_face"
- label="Point"
- tooltip="Point for projection."
- icon="icons/Construction/point.png"
- shape_types="vertex">
- </shape_selector>
- <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>
+ <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"