data()->addAttribute(START_ID(), GeomDataAPI_Point2D::typeId());
data()->addAttribute(END_ID(), GeomDataAPI_Point2D::typeId());
data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId());
+#ifndef LINE_LENGHT_BLOCKED
data()->addAttribute(LENGTH_ID(), ModelAPI_AttributeDouble::typeId());
+#endif
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID());
}
void SketchPlugin_Line::updateLenghtValue()
{
+#ifndef LINE_LENGHT_BLOCKED
std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(START_ID()));
std::shared_ptr<GeomDataAPI_Point2D> anEndAttr = std::dynamic_pointer_cast<
double aDistance = aStartAttr->pnt()->distance(anEndAttr->pnt());
data()->real(LENGTH_ID())->setValue(aDistance);
}
+#endif
}
#include <SketchPlugin_Sketch.h>
#include <list>
+#define LINE_LENGHT_BLOCKED
class GeomAPI_Pnt2d;
/**\class SketchPlugin_Line
}
/// Line length.
+#ifndef LINE_LENGHT_BLOCKED
static const std::string& LENGTH_ID()
{
static const std::string MY_LENGTH("LineLength");
return MY_LENGTH;
}
-
+#endif
/// Returns the kind of a feature
SKETCHPLUGIN_EXPORT virtual const std::string& getKind();
enable_value="enable_by_preferences"/>
<sketch-2dpoint_selector id="EndPoint" accept_expressions="0" title="End point" tooltip="End point coordinates"
enable_value="enable_by_preferences"/>
+ <!--LINE_LENGHT_BLOCKED
<doublevalue id="LineLength" accept_expressions="0" label="Length:" default="computed" icon="icons/Sketch/distance_value.png"
- tooltip="Line length" obligatory="0" enable_value="false"/>
+ tooltip="Line length" obligatory="0" enable_value="false"/> -->
<boolvalue id="Auxiliary" label="Auxiliary" default="false" tooltip="Construction element" obligatory="0"/>
<validator id="GeomValidators_Different" parameters="StartPoint,EndPoint"/>
</feature>