QWidget* result = new QWidget(theParent);
QVBoxLayout* aLabelLay = new QVBoxLayout(result);
QLabel* aLabel = new QLabel(result);
+ aLabel->setWordWrap(true);
aLabel->setText(qs(myWidgetApi->getProperty(INFO_WDG_TEXT)));
aLabel->setToolTip(qs(myWidgetApi->getProperty(INFO_WDG_TOOLTIP)));
aLabelLay->addWidget(aLabel);
bool PartSet_OperationFeatureCreate::canProcessKind(const std::string& theId)
{
return theId == SKETCH_LINE_KIND || theId == SKETCH_POINT_KIND ||
- theId == SKETCH_CIRCLE_KIND /*||
- theId == SKETCH_ARC_KIND*/ ||
+ theId == SKETCH_CIRCLE_KIND ||
+ theId == SKETCH_ARC_KIND ||
theId == SKETCH_CONSTRAINT_DISTANCE_KIND ||
theId == SKETCH_CONSTRAINT_LENGTH_KIND ||
theId == SKETCH_CONSTRAINT_RADIUS_KIND /*||
return;
}
- double aX, anY;
+ double aX = 0, anY = 0;
gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
if (theSelected.empty()) {
#include "SketchPlugin_Sketch.h"
#include <ModelAPI_Data.h>
+#include <GeomAPI_Circ2d.h>
#include <GeomAPI_Pnt2d.h>
#include <GeomDataAPI_Point2D.h>
#include <GeomAlgoAPI_EdgeBuilder.h>
#include <GeomAlgoAPI_CompoundBuilder.h>
+#include <Precision.hxx>
+
SketchPlugin_Arc::SketchPlugin_Arc()
: SketchPlugin_Feature()
{
boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aSketch->data()->attribute(SKETCH_ATTR_NORM));
bool aHasPlane = aNDir && !(aNDir->x() == 0 && aNDir->y() == 0 && aNDir->z() == 0);
if (aHasPlane) {
- boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z()));
+ boost::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
// compute the arc start point
boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr =
boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(ARC_ATTR_START));
boost::shared_ptr<GeomAPI_Pnt> aStartPoint(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
- // compute the arc end point
+ // compute and change the arc end point
boost::shared_ptr<GeomDataAPI_Point2D> anEndAttr =
boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(ARC_ATTR_END));
+ if (anEndAttr->isInitialized())
+ {
+ boost::shared_ptr<GeomAPI_Circ2d> aCircleForArc(
+ new GeomAPI_Circ2d(aCenterAttr->pnt(), aStartAttr->pnt()));
+ boost::shared_ptr<GeomAPI_Pnt2d> aProjection = aCircleForArc->project(anEndAttr->pnt());
+ if (aProjection && anEndAttr->pnt()->distance(aProjection) > Precision::Confusion())
+ anEndAttr->setValue(aProjection);
+ }
boost::shared_ptr<GeomAPI_Pnt> aEndPoint(aSketch->to3D(anEndAttr->x(), anEndAttr->y()));
boost::shared_ptr<GeomAPI_Shape> aCircleShape =
void SketchPlugin_ConstraintLength::initAttributes()
{
data()->addAttribute(CONSTRAINT_ATTR_VALUE, ModelAPI_AttributeDouble::type());
- //data()->addAttribute(CONSTRAINT_ATTR_FLYOUT_VALUE, ModelAPI_AttributeDouble::type());
data()->addAttribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT, GeomDataAPI_Point2D::type());
data()->addAttribute(CONSTRAINT_ATTR_ENTITY_A, ModelAPI_AttributeRefAttr::type());
}
if (!aFeature || aFeature->getKind() != SKETCH_LINE_KIND)
return thePrevious;
- //boost::shared_ptr<ModelAPI_AttributeDouble> aFlyoutAttr =
- // boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE));
- //double aFlyout = aFlyoutAttr->value();
// fly out calculation
boost::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr =
boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT));
*
* These constraint has two attributes:
* CONSTRAINT_ATTR_VALUE (length) and CONSTRAINT_ATTR_ENTITY_A (segment),
- * CONSTRAINT_ATTR_FLYOUT_VALUE (distance of a constraints handle)
+ * CONSTRAINT_ATTR_FLYOUT_VALUE_PNT (distance of a constraints handle)
*/
class SketchPlugin_ConstraintLength: public SketchPlugin_Constraint
{