//--------------------------------------------------------------------------------------
void SketchAPI_IntersectionPoint::setByExternalLine(const ModelHighAPI_Selection & theExternalLine)
{
- fillAttribute(theExternalLine, externalLine());
+ fillAttribute(theExternalLine, externalFeature());
execute();
}
void SketchAPI_IntersectionPoint::setByExternalLineName(const std::string & theExternalLineName)
{
- fillAttribute(ModelHighAPI_Selection("EDGE", theExternalLineName), externalLine());
+ fillAttribute(ModelHighAPI_Selection("EDGE", theExternalLineName), externalFeature());
execute();
}
FeaturePtr aBase = feature();
const std::string& aSketchName = theDumper.parentName(aBase);
- AttributeSelectionPtr aLine = externalLine();
+ AttributeSelectionPtr aLine = externalFeature();
theDumper << aBase << " = " <<
aSketchName << ".addIntersectionPoint(" << aLine << ")" << std::endl;
// dump "auxiliary" flag if necessary
SKETCHAPI_EXPORT
virtual ~SketchAPI_IntersectionPoint();
- INTERFACE_2(SketchPlugin_IntersectionPoint::ID(),
+ INTERFACE_4(SketchPlugin_IntersectionPoint::ID(),
coordinates, SketchPlugin_IntersectionPoint::COORD_ID(),
GeomDataAPI_Point2D, /** IntersectionPoint coordinates */,
- externalLine, SketchPlugin_IntersectionPoint::EXTERNAL_LINE_ID(),
- ModelAPI_AttributeSelection, /** External line */
+ externalFeature, SketchPlugin_IntersectionPoint::EXTERNAL_FEATURE_ID(),
+ ModelAPI_AttributeSelection, /** External edge */,
+ external, SketchPlugin_IntersectionPoint::EXTERNAL_ID(),
+ ModelAPI_AttributeSelection, /** External */,
+ includeToResult, SketchPlugin_IntersectionPoint::INCLUDE_INTO_RESULT(),
+ ModelAPI_AttributeBoolean, /** Include into result */
)
/// Set by external
SketchPlugin_Tools.h
SketchPlugin_Trim.h
SketchPlugin_Validators.h
- SketchPlugin_Intersection.h
)
SET(PROJECT_SOURCES
SketchPlugin_Tools.cpp
SketchPlugin_Trim.cpp
SketchPlugin_Validators.cpp
- SketchPlugin_Intersection.cpp
)
SET(PROJECT_LIBRARIES
#include <GeomDataAPI_Point2D.h>
SketchPlugin_IntersectionPoint::SketchPlugin_IntersectionPoint()
- : SketchPlugin_Point()
+ : SketchPlugin_Point()
{
}
void SketchPlugin_IntersectionPoint::initDerivedClassAttributes()
{
- data()->addAttribute(EXTERNAL_LINE_ID(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(EXTERNAL_FEATURE_ID(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(INCLUDE_INTO_RESULT(), ModelAPI_AttributeBoolean::typeId());
SketchPlugin_Point::initDerivedClassAttributes();
+
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), AUXILIARY_ID());
}
void SketchPlugin_IntersectionPoint::execute()
void SketchPlugin_IntersectionPoint::attributeChanged(const std::string& theID)
{
- if (theID == EXTERNAL_LINE_ID()) {
+ if (theID == EXTERNAL_FEATURE_ID()) {
// compute intersection between line and sketch plane
computePoint();
}
void SketchPlugin_IntersectionPoint::computePoint()
{
AttributeSelectionPtr aLineAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(attribute(EXTERNAL_LINE_ID()));
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(attribute(EXTERNAL_FEATURE_ID()));
std::shared_ptr<GeomAPI_Edge> anEdge;
if(aLineAttr && aLineAttr->value() && aLineAttr->value()->isEdge()) {
return MY_KIND;
}
- static const std::string& EXTERNAL_LINE_ID()
+ static const std::string& EXTERNAL_FEATURE_ID()
{
- static std::string MY_LINE_ID("ExternalLine");
- return MY_LINE_ID;
+ static std::string MY_FEATURE_ID("ExternalFeature");
+ return MY_FEATURE_ID;
+ }
+
+ static const std::string& INCLUDE_INTO_RESULT()
+ {
+ static std::string MY_INCLUDE("IncludeToResult");
+ return MY_INCLUDE;
}
/// Returns true because intersection point is always external
virtual bool isFixed()
{ return true; }
+ /// Returns true if the feature and the feature results can be displayed.
+ /// \return false
+ virtual bool canBeDisplayed() const
+ { return false; }
+
/// Creates a new part document if needed
SKETCHPLUGIN_EXPORT virtual void execute();
#include <SketchPlugin_Circle.h>
#include <SketchPlugin_Arc.h>
#include <SketchPlugin_Projection.h>
-#include <SketchPlugin_Intersection.h>
#include <SketchPlugin_ConstraintAngle.h>
#include <SketchPlugin_ConstraintCoincidence.h>
#include <SketchPlugin_ConstraintCollinear.h>
return FeaturePtr(new SketchPlugin_Arc);
} else if (theFeatureID == SketchPlugin_Projection::ID()) {
return FeaturePtr(new SketchPlugin_Projection);
- } else if (theFeatureID == SketchPlugin_Intersection::ID()) {
- return FeaturePtr(new SketchPlugin_Intersection);
} else if (theFeatureID == SketchPlugin_ConstraintCoincidence::ID()) {
return FeaturePtr(new SketchPlugin_ConstraintCoincidence);
} else if (theFeatureID == SketchPlugin_ConstraintCollinear::ID()) {
nested="SketchPoint SketchIntersectionPoint SketchLine
SketchCircle SketchMacroCircle SketchArc SketchMacroArc
SketchRectangle
- SketchProjection SketchIntersection
+ SketchProjection
SketchConstraintLength SketchConstraintRadius SketchConstraintDistance SketchConstraintDistanceHorizontal SketchConstraintDistanceVertical
SketchConstraintParallel SketchConstraintPerpendicular
SketchConstraintRigid SketchConstraintHorizontal SketchConstraintVertical
</excluded>
<group id="Projection">
- <!-- Intersection Point -->
- <!-- feature
- id="SketchIntersectionPoint"
- title="Intersection Point"
- tooltip="Create intersection point"
- icon="icons/Sketch/intersection_point.png">
- <sketch_shape_selector
- id="ExternalLine"
- label="Edge"
- tooltip="Select external line."
- shape_types="edge"
- use_external="false"
- use_sketch_plane="false">
- <validator id="GeomValidators_ShapeType" parameters="line"/>
- <validator id="SketchPlugin_IntersectionValidator"/>
- </sketch_shape_selector>
- </feature -->
-
<!-- Projected feature -->
<feature
id="SketchProjection"
<validator id="PartSet_ProjectionSelection"/>
</feature>
- <!-- Intersection feature -->
+ <!-- Intersection Point -->
<feature
- id="SketchIntersection"
+ id="SketchIntersectionPoint"
title="Intersection"
tooltip="Intersect edge with sketch plane"
icon="icons/Sketch/intersection.png">
use_external="true"
can_create_external="false"
use_sketch_plane="false">
- <validator id="SketchPlugin_ProjectionValidator"/>
+ <validator id="SketchPlugin_IntersectionValidator"/>
</sketch_shape_selector>
<boolvalue id="IncludeToResult" label="Include into the sketch result" default="true" tooltip="Include projected feature into the sketch result"/>
<validator id="PartSet_IntersectionSelection"/>