Sketcher ConstrainInternalAlignment

From FreeCAD Documentation
Revision as of 12:23, 29 September 2020 by David69 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎italiano • ‎română • ‎русский

Sketcher ConstrainInternalAlignment.svg Sketcher ConstrainInternalAlignment

Menu location
Sketch → Sketcher constraints → Constrain InternalAlignment
Workbenches
Sketcher
Default shortcut
Ctrl + A
Introduced in version
0.15
See also
Sketcher Show/Hide Internal Geometry, Sketcher Ellipse


Description

This constraint aligns lines and points to particular places of a complex sketcher element (there is just one "complex" element so far, the Ellipse).

For Sketcher CreateEllipseByCenter.svg Ellipse and Sketcher CreateArcOfEllipse.svg Arc of ellipse, it supports constraining lines to become major and minor diameters, and constraining Sketcher CreatePoint.svg points to positions of ellipse's foci.

The constraint requires a lot of effort to use in the way other constraints are. It is hidden in the menu, and not exposed on any toolbars by default. There is a helper tool called Sketcher RestoreInternalAlignmentGeometry.svg Show/Hide internal geometry which is exposed on workbenches' toolbars and aimed to completely remove the need to invoke the constraint manually.

Operation on Ellipse

  1. Select elements to be aligned and an ellipse. The ellipse must be selected last. Accepted are up to two lines and up to two points.
  2. Invoking the constraint can be done several ways:
    • Pressing the Sketcher ConstrainInternalAlignment.svg Constrain internal alignment button in the toolbar.
    • Using the Ctrl + A keyboard shortcut.
    • Using the Sketch → Sketcher constraints → Sketcher ConstrainInternalAlignment.svg Constrain InternalAlignment entry from the top menu.

The first line that was selected gets aligned to become ellipse's major diameter (but if it is not occupied already by another line, otherwise it will become minor diameter). The second line is aligned to become minor radius. The lines are automatically switched to construction.

Likewise, the first point is constrained to become the first unoccupied focus, and the second point goes to the other focus.

Scripting

Sketch.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseMajorDiameter', index_of_line, index_of_ellipse))
Sketch.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseMinorDiameter', index_of_line, index_of_ellipse))
Sketch.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseFocus1', index_of_point, 1, index_of_ellipse))
Sketch.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseFocus2', index_of_point, 1, index_of_ellipse))

Remarks:

Sketch is a sketch object.
Number 1 in the focus calls stands for starting point of a point element (it is ignored).