|
|
| Menu location |
|---|
| 스케치 → 구속 → 굴절 구속 |
| Workbenches |
| 스케치 작업대 |
| Default shortcut |
| K W |
| Introduced in version |
| 0.15 |
| See also |
| None |
"스넬의 (굴절)법칙 구속"도구는 두 선이 서로 다른 굴절률을 가진 두 물질이 만나는 경계면을 통과할 때 빛의 굴절 법칙을 따르도록 구속합니다. 자세한 설명은 스넬의 법칙을 참고하세요.
스넬의 굴절 법칙
클릭 순서는 숫자가 표시된 노란색 화살표로 나타내었으며, n1과 n2는 공기와 물처럼 서로 다른 매질의 굴절률을 나타냅니다.
이 굴절구속은 매크로 또는 아래의 함수를 사용하여 파이썬콘솔에서 생성할 수 있습니다.
Sketch.addConstraint(Sketcher.Constraint('SnellsLaw',line1,pointpos1,line2,pointpos2,interface,n2byn1))
여기서:
Sketch는 스케치 대상체입니다.line1 및 pointpos1은 굴절률이 n1인 매질에서 선의 끝점을 나타내는 두 개의 정수입니다. line1은 스케치에서 선의 인덱스(Sketch.addGeometry에서 반환되는 값)이고, pointpos1은 시작점의 경우 1, 끝점의 경우 2여야 합니다.line2 및 pointpos2는 두 번째 줄(중간 n2에서)의 끝점을 지정하는 인덱스입니다.interface는 매질 'n1'과 매질 'n2' 사이의 경계 위치를 나타내는 선을 지정하는 인덱스입니다.n2byn1은 굴절률 비율 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()