// compute a circle point in 3D view
boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr =
boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(CIRCLE_ATTR_CENTER));
- boost::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
- // make a visible point
- boost::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
- aShapes.push_back(aCenterPointShape);
-
- // make a visible circle
- boost::shared_ptr<GeomDataAPI_Dir> aNDir =
- 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()));
- // compute the circle radius
- AttributeDoublePtr aRadiusAttr =
- boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(CIRCLE_ATTR_RADIUS));
- double aRadius = aRadiusAttr->value();
-
- boost::shared_ptr<GeomAPI_Shape> aCircleShape =
- GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aRadius);
- aShapes.push_back(aCircleShape);
+ if (aCenterAttr->isInitialized()) {
+ boost::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
+ // make a visible point
+ boost::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
+ aShapes.push_back(aCenterPointShape);
+
+ // make a visible circle
+ boost::shared_ptr<GeomDataAPI_Dir> aNDir =
+ 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()));
+ // compute the circle radius
+ AttributeDoublePtr aRadiusAttr =
+ boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(CIRCLE_ATTR_RADIUS));
+ double aRadius = aRadiusAttr->value();
+
+ boost::shared_ptr<GeomAPI_Shape> aCircleShape =
+ GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aRadius);
+ aShapes.push_back(aCircleShape);
+ }
}
boost::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
setPreview(aCompound);
<feature_selector id="ConstraintEntityA" label="First point" tooltip="Select an entity in the viewer" keysequence="SketchPoint"/>
<feature_selector id="ConstraintEntityB" label="Last point" tooltip="Select an entity in the viewer" keysequence="SketchPoint"/>
<point_selector id="ConstraintFlyoutValuePnt" internal="1"/>
- <doublevalue_editor id="ConstraintValue"/>
+ <doublevalue_editor label="Value" tooltip="Constraint value" id="ConstraintValue"/>
</feature>
<feature id="SketchConstraintLength" title="Length of a line" tooltip="Create constraint for the given length of a line segment">
<label title="Select a line entity on which to calculate lenght" tooltip="Select a line entity on which to calculate lenght"/>
<feature_selector id="ConstraintEntityA" label="Line" tooltip="Select an entity in the viewer" keysequence="SketchLine"/>
<point_selector id="ConstraintFlyoutValuePnt" internal="1"/>
- <doublevalue_editor id="ConstraintValue"/>
+ <doublevalue_editor label="Value" tooltip="Constraint value" id="ConstraintValue"/>
</feature>
<feature id="SketchConstraintRadius" title="Radius of a circle or an arc" tooltip="Create constraint for the given radius of a circle or an arc">
<label title="Select two points on a circle or an arc of circle on which to calculate radius" tooltip="Select two points on a circle or an arc of circle on which to calculate radius"/>
<feature_selector id="ConstraintEntityA" label="Circle or Arc" tooltip="Select an entity in the viewer" keysequence="SketchCircle SketchArc"/>
<point_selector id="ConstraintFlyoutValuePnt" internal="1"/>
- <doublevalue_editor id="ConstraintValue"/>
+ <doublevalue_editor label="Value" tooltip="Constraint value" id="ConstraintValue"/>
</feature>
<feature id="SketchConstraintParallel" title="Parallelism of a lines" tooltip="Create constraint defining two parallel lines">
<feature_selector id="ConstraintEntityA" label="First line" tooltip="Select an entity in the viewer" keysequence="SketchLine"/>