Sketcher ConstrainSnellsLaw/ko

Sketcher ConstrainSnellsLaw

Menu location
스케치 → 구속 → 굴절 구속
Workbenches
스케치 작업대
Default shortcut
K W
Introduced in version
0.15
See also
None

설명

"스넬의 (굴절)법칙 구속"도구는 두 선이 서로 다른 굴절률을 가진 두 물질이 만나는 경계면을 통과할 때 빛의 굴절 법칙을 따르도록 구속합니다. 자세한 설명은 스넬의 법칙을 참고하세요.

스넬의 굴절 법칙

용법

클릭 순서는 숫자가 표시된 노란색 화살표로 나타내었으며, n1과 n2는 공기와 물처럼 서로 다른 매질의 굴절률을 나타냅니다.

  1. 광선을 나타내는 두 개의 선과 경계면 역할을 하는 또다른 (경계)선을 준비하세요. 두 선은 경계선의 서로 다른 쪽에 있어야 합니다. 경계선은 직선, , 또는 원뿔곡선이 될 수 있습니다.
  2. 첫 번째 선의 끝점, 두 번째 선의 끝점, 경계선을 선택합니다. 끝점을 선택하는 순서를 기억해 두세요.
  3. 이 굴절구속 도구를 실행하는 방법은 여러 가지가 있습니다.
    • 메뉴에서 스케치 → 구속 → 굴절 구속을 선택하세요.
    • 키보드 단축키 K를 사용한 다음 W를 사용하세요.
  4. 굴절률 비율 대화 상자가 열립니다.
  5. n2/n1 비율을 입력하세요. 여기서 n2는 두 번째로 선택된 광선이 통과하는 매질(의 굴절율)을 나타내고, n1은 첫 번째 광선이 통과하는 매질(의 굴절율)을 나타냅니다.
  6. 굴절 구속이 적용되었습니다. 필요한 경우 끝점들은 일치되고 선위에 점 으로 구속됩니다. 이러한 추가 구속은 보조 구속이라고 합니다.

보충 설명

스크립트

이 굴절구속은 매크로 또는 아래의 함수를 사용하여 파이썬콘솔에서 생성할 수 있습니다.

Sketch.addConstraint(Sketcher.Constraint('SnellsLaw',line1,pointpos1,line2,pointpos2,interface,n2byn1))

여기서:

  • Sketch는 스케치 대상체입니다.
  • line1pointpos1은 굴절률이 n1인 매질에서 선의 끝점을 나타내는 두 개의 정수입니다. line1은 스케치에서 선의 인덱스(Sketch.addGeometry에서 반환되는 값)이고, pointpos1은 시작점의 경우 1, 끝점의 경우 2여야 합니다.
  • line2pointpos2는 두 번째 줄(중간 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()