スケッチャー・屈折率拘束(スネルの法則)
Appearance
|
|
| Menu location |
|---|
| Sketch → Constraints → Refraction Constraint |
| Workbenches |
| Sketcher |
| Default shortcut |
| K W |
| Introduced in version |
| 0.15 |
| See also |
| None |
Description
The Sketcher ConstrainSnellsLaw tool constrains two lines to follow the law of refraction of light as it penetrates through an interface where two materials with different refraction indices meet. See Snell's law.
Snell's Law
Usage
The sequence of clicks is indicated by yellow arrows with numbers, n1 and n2 show where the indices of refraction are
- Prepare two lines to represent a beam of light, and an edge to act as an interface. The lines should be on different sides of the interface. The interface can be a line, an arc, a circle or a conic.
- Select an endpoint of the first line, an endpoint of the second line, and the interface edge. Note the selection order of the endpoints.
- There are several ways to invoke the tool:
- The Refractive Index Ratio dialog opens.
- Enter the Ratio n2/n1. Where n2 is for the medium where the second selected line resides, and n1 is for the first line's medium.
- A refraction constraint is added. If required the endpoints are made coincident and constrained onto the interface. These additional constraints are called helper constraints.
Notes
- The actual Snell's law constraint enforces the plain law equation n1*sin(theta1) = n2*sin(theta2). It needs the line ends to be made coincident and on the interface by other constraints, otherwise the behavior is undefined. The necessary helper constraints are added automatically based on the current coordinates of the elements.
- In Python the helper constraints must be added manually (see Scripting).
- These helper constraints can be temporarily deleted and the endpoints dragged apart, which can be useful in case one wants to construct a reflected ray or birefringence rays.
- Unlike the reality, refraction indices are associated with rays of light, but not according to the sides of the boundary. This is useful to emulate birefringence, construct paths of different wavelengths due to refraction, and easily construct angle of onset of total internal reflection.
- Both rays can be on the same side of the interface, satisfying the constraint equation. This is physical nonsense, unless the ratio n2/n1 is 1.0, in which case the constraint emulates a reflection.
- Arcs of circle and ellipse are also accepted as rays. But this is also physical nonsense.
Scripting
The constraints can be created from macros and from the Python console by using the following function:
Sketch.addConstraint(Sketcher.Constraint('SnellsLaw',line1,pointpos1,line2,pointpos2,interface,n2byn1))
where:
Sketchis a sketch objectline1andpointpos1are two integers identifying the endpoint of the line in medium with refractive index of n1.line1is the line's index in the sketch (the value, returned by Sketch.addGeometry), andpointpos1should be 1 for start point and 2 for end point.line2andpointpos2are the indexes specifying the endpoint of the second line (in medium n2)interfaceis the index specifying the line indicating the position of the interface between medium n1 and medium n2n2byn1is a floating-point number equal to the ratio of refractive indices n2/n1
The Sketcher scripting page explains the values which can be used for line1, pointpos1, line2, pointpos2 and interface and contains further examples on how to create constraints from Python scripts.
Example:
import Sketcher
import Part
import FreeCAD
StartPoint = 1
EndPoint = 2
f = App.activeDocument().addObject("Sketcher::SketchObject","Sketch")
# add geometry to the sketch
icir = f.addGeometry(Part.Circle(App.Vector(-547.612366,227.479736,0),App.Vector(0,0,1),68.161979))
iline1 = f.addGeometry(Part.LineSegment(App.Vector(-667.331726,244.127090,0),App.Vector(-604.284241,269.275238,0)))
iline2 = f.addGeometry(Part.LineSegment(App.Vector(-604.284241,269.275238,0),App.Vector(-490.940491,256.878265,0)))
# add constraints
# helper constraints:
f.addConstraint(Sketcher.Constraint('Coincident',iline1,EndPoint,iline2,StartPoint))
f.addConstraint(Sketcher.Constraint('PointOnObject',iline1,EndPoint,icir))
# the Snell's law:
f.addConstraint(Sketcher.Constraint('SnellsLaw',iline1,EndPoint,iline2,StartPoint,icir,1.47))
App.ActiveDocument.recompute()
- 全般: スケッチを作成、スケッチを編集、スケッチをアタッチ、スケッチの方向を変更、スケッチを検証、スケッチをマージ、スケッチを鏡像化、スケッチの編集を終了、スケッチを表示、セクション表示、グリッドの表示を切り替え、スナップの切り替え、レンダリング順を設定、操作を停止
- スケッチャージオメトリー: 点を作成、ポリライン(折れ線)を作成、線分を作成、中心点から円弧を作成、3点指定円弧を作成、楕円弧を作成、双曲線の円弧を作成、放物線の円弧を作成、中心を指定して円を作成、3点で円を作成、中心点を指定して楕円を作成、3点を指定して楕円を作成、長方形を作成、中心配置長方形、角丸長方形、正三角形, 正方形、正五角形、正六角形、正七角形、正八角形、正多角形、長円形を作成、円弧状の長円形を作成、制御点によるBスプライン, 制御点によるBスプライン、制御点によるBスプライン、ノットによる周期的Bスプライン、構築ジオメトリの切り替え
- スケッチャー拘束:
- 寸法拘束: 寸法、水平距離拘束、垂直距離拘束、距離拘束、半径/直径を自動拘束、半径拘束、直径拘束、角度を拘束、ロック拘束
- 幾何拘束: 一致拘束(統合)、一致拘束、点がオブジェクト上にある拘束、水平/垂直拘束、水平拘束、垂直拘束、 並行拘束, 直角拘束、正接拘束または共線拘束、等値拘束、対称拘束、固定拘束
- その他の拘束: 屈折率拘束(スネルの法則)
- 拘束ツール: 駆動拘束/参照拘束の切り替え、駆動拘束/参照拘束の切り替え
- スケッチャーツール フレットを作成、面取りを作成、エッジをトリム、エッジを分割、エッジを延長、外部ジオメトリを作成、カーボンコピーを作成、原点を選択, 水平軸を選択、垂直軸を選択、配列変換, 軸周変換、スケール変換、オフセット、対称、軸方向の拘束を解除、すべてのジオメトリーを削除, すべての拘束を削除
- スケッチャーBスプラインツール: ジオメトリをB-スプラインに変換、Bスプラインの次数を増やす、Bスプラインの次数を減らす、ノット多重度を増やす, ノット多重度を減らす、ノットを挿入、曲線を結合
- スケッチャー表示ツール: 未拘束の自由度を選択、関連する拘束を選択、関連する要素を選択、冗長な拘束を選択、競合する拘束を選択、円弧の補助円を表示/非表示、Bスプライン次数の表示/非表示, Bスプライン制御ポリゴンの表示/非表示、Bスプライン曲率コームの表示/非表示、Bスプラインノット多重度の表示/非表示、Bスプライン制御点重みの表示/非表示、内部ジオメトリの表示/非表示、仮想スペース切り替え
- はじめてみよう
- インストール: ダウンロード、Windowsへのインストール、Linuxへのインストール、Macへのインストール、付加機能のインストール、Dockerでのコンパイル、AppImage、Ubuntu Snap
- 基本: FreeCADについて、ユーザー・インタフェース、Mマウス・ナビゲーション、オブジェクトの選択方法、オブジェクトの名前、設定、ワークベンチ、FreeCADファイルの構造、プロパティ、FreeCADへの貢献、寄付
- ヘルプ: チュートリアル、チュートリアル動画
- ワークベンチ: 共通ツール、アセンブリー、BIM、CAM、ドラフト、FEM、インスペクション、マテリアル、メッシュ、OpenSCAD、 パート、パートデザイン、ポイント、リバースエンジニアリング、ロボット、スケッチャー、スプレッドシート、サーフェス、テックドロー、テストフレームワーク
- 情報ハブ: ユーザー向けハブ、パワーユーザー向けハブ、開発者向けハブ