Sketcher ConstrainSnellsLaw

From FreeCAD Documentation
Revision as of 21:25, 12 January 2015 by Renatorivo (talk | contribs) (N)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Under construction!

Constraint SnellsLaw

Menu location
Sketch → Sketcher Constraints → Constrain refraction (Snell's law)
Workbenches
Sketcher, PartDesign
Default shortcut
None
Introduced in version
-
See also
None

Description

Constrains two lines to follow the law of refraction of light as it penetrates through an interface, where two materials of different refraction indices meet. See Snell's law on Wikipedia for more info.

How to use

The sequence of clicks is indicated by yellow arrows with numbers. n1, n2 are labeles on this picture to show where the indices of refraction are.
  • You'll need two lines that are to follow a beam of light, and a curve to act as an interface. The lines should be on different sides of the interface.
  • Select the endpoint of one line, an endpoint of another line, and the interface edge. The interface can be a line, circle/arc, ellipse/arc of ellipse. Note the order you've selected the endpoints.
  • Invoke the constraint. A dialog will appear asking for a ratio of indices of refraction n2/n1. n2 corresponds to the medium where the second selected endpoint's line resides, n1 is for the first line.
  • The endpoints will be made coincident (if needed), constrained onto the interface (if needed), and the Snell's law will become constrained.

Note that there are several helper constraints smart-added (point-on-object, coincident), and they can be deleted if they cause redundancy, or added manually if they were not added automatically. For the actual Snell's law constraint, the endpoints of lines must coincide and lie on the interface, otherwise the behavior is undefined.

Using polyline tool, it is possible to speedup drawing of rays of light. In this case, one can select two coincident endpoints by box selection.

Scripting

The ExampleCommandModel tool can by used in macros and from the python console by using the following function:

makeExampleCommandModel (Data, Data)
  • Creates a CommandModel using Data.
  • Returns the newly created object.

Example:

import FreeCAD, Base
Base.makeExampleCommandModel(FreeCAD.Data,FreeCAD.Data)

Other

Optional