1 '''Features module or theia, to represent objects as FreeCAD Python features.'''
2
3
4
5
6
7
8
9
10 import Part
11 from FreeCAD import Base
12
14 '''Mother class for all FeaturePython objects.
15
16 This is to define the mandatory execute method, which is ran for every
17 object of the document on the recompute function.
18
19 fact: Factor to compensate for unit difference with FreeCAD. [float]
20 '''
21 fact = 0.001
23 '''Custom properties of the object.
24 '''
25 obj.Proxy = self
26
28 '''We're not doing anything on recompute yet.
29 '''
30 pass
31
34 super(FCMirror, self).__init__(obj)
35 obj.addProperty("App::PropertyAngle", "Wedge", "Mirror",
36 "Wedge of the mirror").Wedge = mirror.Wedge
37 obj.addProperty("App::PropertyString", "HRK", "Mirror",
38 "HR curvature").HRK = str(mirror.HRK) + ' m^-1'
39 obj.addProperty("App::PropertyString", "ARK", "Mirror",
40 "AR curvature").ARK = str(mirror.ARK) + ' m^-1'
41 obj.addProperty("App::PropertyDistance", "Thick", "Mirror",
42 "Thickness of mirror").Thick = mirror.Thick/self.fact
43 obj.addProperty("App::PropertyFloat", "N", "Mirror",
44 "Optical index").N = mirror.N
45 obj.addProperty("App::PropertyDistance", "Dia", "Mirror",
46 "Diameter").Dia = mirror.Dia/.001
47
50 super(FCLens, self).__init__(obj)
51 if lens.Name == "ThinLens":
52 obj.addProperty("App::PropertyDistance", "Focal", "Lens",
53 "FocalLength").Focal = lens.Focal/self.fact
54 else:
55 obj.addProperty("App::PropertyString", "K1", "Lens",
56 "K1 curvature").K1 = str(lens.HRK) + ' m^-1'
57 obj.addProperty("App::PropertyString", "K2", "Lens",
58 "K2 curvature").K2 = str(lens.ARK) + ' m^-1'
59 obj.addProperty("App::PropertyDistance", "Thick", "Lens",
60 "Thickness of lens").Thick = lens.Thick/self.fact
61 obj.addProperty("App::PropertyFloat", "N", "Lens",
62 "Optical index").N = lens.N
63
64 obj.addProperty("App::PropertyDistance", "Dia", "Lens",
65 "Diameter").Dia = lens.Dia/self.fact
66
69 super(FCBeamDump, self).__init__(obj)
70 obj.addProperty("App::PropertyDistance", "Thick", "BeamDump",
71 "Thickness of beamdump").Thick = beamDump.Thick/self.fact
72 obj.addProperty("App::PropertyDistance", "Dia", "BeamDump",
73 "Diameter").Dia = beamDump.Dia/self.fact
74
77 super(FCBeam, self).__init__(obj)
78 obj.addProperty("App::PropertyString", "Order", "Beam",
79 "Order of the beam").Order = str(beam.StrayOrder)
80 obj.addProperty("App::PropertyString", "P", "Beam",
81 "Power of the beam").P = str(beam.P/self.fact) + 'mW'
82 obj.addProperty("App::PropertyDistance", "WDx", "Beam",
83 "Waist distance X").WDx = beam.waistPos()[0]/self.fact
84 obj.addProperty("App::PropertyDistance", "WDy", "Beam",
85 "Waist distance Y").WDy = beam.waistPos()[1]/self.fact
86 obj.addProperty("App::PropertyDistance", "Wx", "Beam",
87 "Waist on X").Wx = beam.waistSize()[0]/self.fact
88 obj.addProperty("App::PropertyDistance", "Wy", "Beam",
89 "Waist on Y").Wy = beam.waistSize()[1]/self.fact
90