/
TopoShapeEdgePy.xml
543 lines (460 loc) · 21.5 KB
/
TopoShapeEdgePy.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="TopoShapePy"
Name="TopoShapeEdgePy"
Twin="TopoShape"
TwinPointer="TopoShape"
Include="Mod/Part/App/TopoShape.h"
Namespace="Part"
FatherInclude="Mod/Part/App/TopoShapePy.h"
FatherNamespace="Part"
Constructor="true">
<Documentation>
<Author Licence="LGPL" Name="Juergen Riegel" EMail="Juergen.Riegel@web.de" />
<UserDocu>TopoShapeEdge is the OpenCasCade topological edge wrapper</UserDocu>
</Documentation>
<Methode Name="getParameterByLength" Const="true">
<Documentation>
<UserDocu>paramval = getParameterByLength(pos, [tolerance = 1e-7])
Get the value of the primary parameter at the given distance along the cartesian
length of the edge.
Args:
pos (float or int): The distance along the length of the edge at which to
determine the primary parameter value. See help for the FirstParameter or
LastParameter properties for more information on the primary parameter.
If the given value is positive, the distance from edge start is used.
If the given value is negative, the distance from edge end is used.
tol (float): Computing tolerance. Optional, defaults to 1e-7.
Returns:
paramval (float): the value of the primary parameter defining the edge at the
given position along its cartesian length.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="tangentAt" Const="true">
<Documentation>
<UserDocu>Vector = tangentAt(paramval)
Get the tangent direction at the given primary parameter value along the Edge
if it is defined
Args:
paramval (float or int): The parameter value along the Edge at which to
determine the tangent direction e.g:
x = Part.makeCircle(1, FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), 0, 90)
y = x.tangentAt(x.FirstParameter + 0.5 * (x.LastParameter - x.FirstParameter))
y is the Vector (-0.7071067811865475, 0.7071067811865476, 0.0)
Values with magnitude greater than the Edge length return
values of the tangent on the curve extrapolated beyond its
length. This may not be valid for all Edges. Negative values
similarly return a tangent on the curve extrapolated backwards
(before the start point of the Edge). For example, using the
same shape as above:
>>> x.tangentAt(x.FirstParameter + 3.5*(x.LastParameter - x.FirstParameter))
Vector (0.7071067811865477, 0.7071067811865474, 0.0)
Which gives the same result as
>>> x.tangentAt(x.FirstParameter -0.5*(x.LastParameter - x.FirstParameter))
Vector (0.7071067811865475, 0.7071067811865476, 0.0)
Since it is a circle
Returns:
Vector: representing the tangent to the Edge at the given
location along its length (or extrapolated length)
</UserDocu>
</Documentation>
</Methode>
<Methode Name="valueAt" Const="true">
<Documentation>
<UserDocu>Vector = valueAt(paramval)
Get the value of the cartesian parameter value at the given parameter value along
the Edge
Args:
paramval (float or int): The parameter value along the Edge at which to
determine the value in terms of the main parameter defining
the edge, what the parameter value is depends on the type of
edge. See e.g:
For a circle value
x = Part.makeCircle(1, FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), 0, 90)
y = x.valueAt(x.FirstParameter + 0.5 * (x.LastParameter - x.FirstParameter))
y is theVector (0.7071067811865476, 0.7071067811865475, 0.0)
Values with magnitude greater than the Edge length return
values on the curve extrapolated beyond its length. This may
not be valid for all Edges. Negative values similarly return
a parameter value on the curve extrapolated backwards (before the
start point of the Edge). For example, using the same shape
as above:
>>> x.valueAt(x.FirstParameter + 3.5*(x.LastParameter - x.FirstParameter))
Vector (0.7071067811865474, -0.7071067811865477, 0.0)
Which gives the same result as
>>> x.valueAt(x.FirstParameter -0.5*(x.LastParameter - x.FirstParameter))
Vector (0.7071067811865476, -0.7071067811865475, 0.0)
Since it is a circle
Returns:
Vector: representing the cartesian location on the Edge at the given
distance along its length (or extrapolated length)
</UserDocu>
</Documentation>
</Methode>
<Methode Name="parameters" Const="true">
<Documentation>
<UserDocu>
parameters([face]) --> list
Get the list of parameters of the tessellation of an edge. If the edge is part of
a face then this face is required as argument.
An exception is raised if the edge has no polygon.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="parameterAt" Const="true">
<Documentation>
<UserDocu>Float = parameterAt(Vertex) - Get the parameter at the given vertex if lying on the edge</UserDocu>
</Documentation>
</Methode>
<Methode Name="normalAt" Const="true">
<Documentation>
<UserDocu>Vector = normalAt(paramval)
Get the normal direction at the given parameter value along the Edge if it
is defined
Args:
paramval (float or int): The parameter value along the Edge at which to
determine the normal direction e.g:
x = Part.makeCircle(1, FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), 0, 90)
y = x.normalAt(x.FirstParameter + 0.5 * (x.LastParameter - x.FirstParameter))
y is the Vector (-0.7071067811865476, -0.7071067811865475, 0.0)
Values with magnitude greater than the Edge length return
values of the normal on the curve extrapolated beyond its
length. This may not be valid for all Edges. Negative values
similarly return a normal on the curve extrapolated backwards
(before the start point of the Edge). For example, using the
same shape as above:
>>> x.normalAt(x.FirstParameter + 3.5*(x.LastParameter - x.FirstParameter))
Vector (-0.7071067811865474, 0.7071067811865477, 0.0)
Which gives the same result as
>>> x.normalAt(x.FirstParameter -0.5*(x.LastParameter - x.FirstParameter))
Vector (-0.7071067811865476, 0.7071067811865475, 0.0)
Since it is a circle
Returns:
Vector: representing the normal to the Edge at the given
location along its length (or extrapolated length)
</UserDocu>
</Documentation>
</Methode>
<Methode Name="derivative1At" Const="true">
<Documentation>
<UserDocu>Vector = derivative1At(paramval)
Get the first derivative at the given parameter value along the Edge if it
is defined
Args:
paramval (float or int): The parameter value along the Edge at which to
determine the first derivative e.g:
x = Part.makeCircle(1, FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), 0, 90)
y = x.derivative1At(x.FirstParameter + 0.5 * (x.LastParameter - x.FirstParameter))
y is the Vector (-0.7071067811865475, 0.7071067811865476, 0.0)
Values with magnitude greater than the Edge length return
values of the first derivative on the curve extrapolated
beyond its length. This may not be valid for all Edges.
Negative values similarly return a first derivative on the
curve extrapolated backwards (before the start point of the
Edge). For example, using the same shape as above:
>>> x.derivative1At(x.FirstParameter + 3.5*(x.LastParameter - x.FirstParameter))
Vector (0.7071067811865477, 0.7071067811865474, 0.0)
Which gives the same result as
>>> x.derivative1At(x.FirstParameter -0.5*(x.LastParameter - x.FirstParameter))
Vector (0.7071067811865475, 0.7071067811865476, 0.0)
Since it is a circle
Returns:
Vector: representing the first derivative to the Edge at the
given location along its length (or extrapolated length)
</UserDocu>
</Documentation>
</Methode>
<Methode Name="derivative2At" Const="true">
<Documentation>
<UserDocu>Vector = derivative2At(paramval)
Get the second derivative at the given parameter value along the Edge if it
is defined
Args:
paramval (float or int): The parameter value along the Edge at which to
determine the second derivative e.g:
x = Part.makeCircle(1, FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), 0, 90)
y = x.derivative2At(x.FirstParameter + 0.5 * (x.LastParameter - x.FirstParameter))
y is the Vector (-0.7071067811865476, -0.7071067811865475, 0.0)
Values with magnitude greater than the Edge length return
values of the second derivative on the curve extrapolated
beyond its length. This may not be valid for all Edges.
Negative values similarly return a second derivative on the
curve extrapolated backwards (before the start point of the
Edge). For example, using the same shape as above:
>>> x.derivative2At(x.FirstParameter + 3.5*(x.LastParameter - x.FirstParameter))
Vector (-0.7071067811865474, 0.7071067811865477, 0.0)
Which gives the same result as
>>> x.derivative2At(x.FirstParameter -0.5*(x.LastParameter - x.FirstParameter))
Vector (-0.7071067811865476, 0.7071067811865475, 0.0)
Since it is a circle
Returns:
Vector: representing the second derivative to the Edge at the
given location along its length (or extrapolated length)
</UserDocu>
</Documentation>
</Methode>
<Methode Name="derivative3At" Const="true">
<Documentation>
<UserDocu>Vector = derivative3At(paramval)
Get the third derivative at the given parameter value along the Edge if it
is defined
Args:
paramval (float or int): The parameter value along the Edge at which to
determine the third derivative e.g:
x = Part.makeCircle(1, FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), 0, 90)
y = x.derivative3At(x.FirstParameter + 0.5 * (x.LastParameter - x.FirstParameter))
y is the Vector (0.7071067811865475, -0.7071067811865476, -0.0)
Values with magnitude greater than the Edge length return
values of the third derivative on the curve extrapolated
beyond its length. This may not be valid for all Edges.
Negative values similarly return a third derivative on the
curve extrapolated backwards (before the start point of the
Edge). For example, using the same shape as above:
>>> x.derivative3At(x.FirstParameter + 3.5*(x.LastParameter - x.FirstParameter))
Vector (-0.7071067811865477, -0.7071067811865474, 0.0)
Which gives the same result as
>>> x.derivative3At(x.FirstParameter -0.5*(x.LastParameter - x.FirstParameter))
Vector (-0.7071067811865475, -0.7071067811865476, 0.0)
Since it is a circle
Returns:
Vector: representing the third derivative to the Edge at the
given location along its length (or extrapolated length)
</UserDocu>
</Documentation>
</Methode>
<Methode Name="curvatureAt" Const="true">
<Documentation>
<UserDocu>Float = curvatureAt(paramval) - Get the curvature at the given parameter [First|Last] if defined</UserDocu>
</Documentation>
</Methode>
<Methode Name="centerOfCurvatureAt" Const="true">
<Documentation>
<UserDocu>Vector = centerOfCurvatureAt(float pos) - Get the center of curvature at the given parameter [First|Last] if defined</UserDocu>
</Documentation>
</Methode>
<Methode Name="firstVertex" Const="true">
<Documentation>
<UserDocu>Vertex = firstVertex(Orientation=False)
Returns the Vertex of orientation FORWARD in this edge.
If there is none a Null shape is returned.
Orientation = True : taking into account the edge orientation
</UserDocu>
</Documentation>
</Methode>
<Methode Name="lastVertex" Const="true">
<Documentation>
<UserDocu>Vertex = lastVertex(Orientation=False)
Returns the Vertex of orientation REVERSED in this edge.
If there is none a Null shape is returned.
Orientation = True : taking into account the edge orientation
</UserDocu>
</Documentation>
</Methode>
<Methode Name="discretize" Const="true" Keyword="true">
<Documentation>
<UserDocu>Discretizes the edge and returns a list of points.
The function accepts keywords as argument:
discretize(Number=n) => gives a list of 'n' equidistant points
discretize(QuasiNumber=n) => gives a list of 'n' quasi equidistant points (is faster than the method above)
discretize(Distance=d) => gives a list of equidistant points with distance 'd'
discretize(Deflection=d) => gives a list of points with a maximum deflection 'd' to the edge
discretize(QuasiDeflection=d) => gives a list of points with a maximum deflection 'd' to the edge (faster)
discretize(Angular=a,Curvature=c,[Minimum=m]) => gives a list of points with an angular deflection of 'a'
and a curvature deflection of 'c'. Optionally a minimum number of points
can be set which by default is set to 2.
Optionally you can set the keywords 'First' and 'Last' to define a sub-range of the parameter range
of the edge.
If no keyword is given then it depends on whether the argument is an int or float.
If it's an int then the behaviour is as if using the keyword 'Number', if it's float
then the behaviour is as if using the keyword 'Distance'.
Example:
import Part
e=Part.makeCircle(5)
p=e.discretize(Number=50,First=3.14)
s=Part.Compound([Part.Vertex(i) for i in p])
Part.show(s)
p=e.discretize(Angular=0.09,Curvature=0.01,Last=3.14,Minimum=100)
s=Part.Compound([Part.Vertex(i) for i in p])
Part.show(s)
</UserDocu>
</Documentation>
</Methode>
<Methode Name="split" Const="true">
<Documentation>
<UserDocu>Wire = split(paramval)
Splits the edge at the given parameter values and builds a wire out of it
Args:
paramval (float or int): The parameter value along the Edge at which to
split it e.g:
x = Part.makeCircle(1, FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), 0, 90)
y = x.derivative3At(x.FirstParameter + 0.5 * (x.LastParameter - x.FirstParameter))
Returns:
Wire: wire made up of two Edges
</UserDocu>
</Documentation>
</Methode>
<Methode Name="isSeam" Const="true">
<Documentation>
<UserDocu>isSeam(Face) - Checks whether the edge is a seam edge.</UserDocu>
</Documentation>
</Methode>
<Attribute Name="Tolerance">
<Documentation>
<UserDocu>Set or get the tolerance of the vertex</UserDocu>
</Documentation>
<Parameter Name="Tolerance" Type="Float"/>
</Attribute>
<Attribute Name="Length" ReadOnly="true">
<Documentation>
<UserDocu>Returns the cartesian length of the curve</UserDocu>
</Documentation>
<Parameter Name="Length" Type="Float"/>
</Attribute>
<Attribute Name="ParameterRange" ReadOnly="true">
<Documentation>
<UserDocu>
Returns a 2 tuple with the range of the primary parameter
defining the curve. This is the same as would be returned by
the FirstParameter and LastParameter properties, i.e.
(LastParameter,FirstParameter)
What the parameter is depends on what type of edge it is. For a
Line the parameter is simply its cartesian length. Some other
examples are shown below:
Type Parameter
---------------------------------------------------------------
Circle Angle swept by circle (or arc) in radians
BezierCurve Unitless number in the range 0.0 to 1.0
Helix Angle swept by helical turns in radians
</UserDocu>
</Documentation>
<Parameter Name="ParameterRange" Type="Tuple"/>
</Attribute>
<Attribute Name="FirstParameter" ReadOnly="true">
<Documentation>
<UserDocu>
Returns the start value of the range of the primary parameter
defining the curve.
What the parameter is depends on what type of edge it is. For a
Line the parameter is simply its cartesian length. Some other
examples are shown below:
Type Parameter
-----------------------------------------------------------
Circle Angle swept by circle (or arc) in radians
BezierCurve Unitless number in the range 0.0 to 1.0
Helix Angle swept by helical turns in radians
</UserDocu>
</Documentation>
<Parameter Name="FirstParameter" Type="Float"/>
</Attribute>
<Attribute Name="LastParameter" ReadOnly="true">
<Documentation>
<UserDocu>
Returns the end value of the range of the primary parameter
defining the curve.
What the parameter is depends on what type of edge it is. For a
Line the parameter is simply its cartesian length. Some other
examples are shown below:
Type Parameter
-----------------------------------------------------------
Circle Angle swept by circle (or arc) in radians
BezierCurve Unitless number in the range 0.0 to 1.0
Helix Angle swept by helical turns in radians
</UserDocu>
</Documentation>
<Parameter Name="LastParameter" Type="Float"/>
</Attribute>
<Attribute Name="Curve" ReadOnly="true">
<Documentation>
<UserDocu>Returns the 3D curve of the edge</UserDocu>
</Documentation>
<Parameter Name="Curve" Type="Object"/>
</Attribute>
<Attribute Name="Closed" ReadOnly="true">
<Documentation>
<UserDocu>Returns true if the edge is closed</UserDocu>
</Documentation>
<Parameter Name="Closed" Type="Boolean"/>
</Attribute>
<Attribute Name="Degenerated" ReadOnly="true">
<Documentation>
<UserDocu>Returns true if the edge is degenerated</UserDocu>
</Documentation>
<Parameter Name="Degenerated" Type="Boolean"/>
</Attribute>
<Attribute Name="Mass" ReadOnly="true">
<Documentation>
<UserDocu>Returns the mass of the current system.</UserDocu>
</Documentation>
<Parameter Name="Mass" Type="Object"/>
</Attribute>
<Attribute Name="CenterOfMass" ReadOnly="true">
<Documentation>
<UserDocu>Returns the center of mass of the current system.
If the gravitational field is uniform, it is the center of gravity.
The coordinates returned for the center of mass are expressed in the
absolute Cartesian coordinate system.</UserDocu>
</Documentation>
<Parameter Name="CenterOfMass" Type="Object"/>
</Attribute>
<Attribute Name="MatrixOfInertia" ReadOnly="true">
<Documentation>
<UserDocu>Returns the matrix of inertia. It is a symmetrical matrix.
The coefficients of the matrix are the quadratic moments of
inertia.
| Ixx Ixy Ixz 0 |
| Ixy Iyy Iyz 0 |
| Ixz Iyz Izz 0 |
| 0 0 0 1 |
The moments of inertia are denoted by Ixx, Iyy, Izz.
The products of inertia are denoted by Ixy, Ixz, Iyz.
The matrix of inertia is returned in the central coordinate
system (G, Gx, Gy, Gz) where G is the centre of mass of the
system and Gx, Gy, Gz the directions parallel to the X(1,0,0)
Y(0,1,0) Z(0,0,1) directions of the absolute cartesian
coordinate system.</UserDocu>
</Documentation>
<Parameter Name="MatrixOfInertia" Type="Object"/>
</Attribute>
<Attribute Name="StaticMoments" ReadOnly="true">
<Documentation>
<UserDocu>Returns Ix, Iy, Iz, the static moments of inertia of the
current system; i.e. the moments of inertia about the
three axes of the Cartesian coordinate system.</UserDocu>
</Documentation>
<Parameter Name="StaticMoments" Type="Object"/>
</Attribute>
<Attribute Name="PrincipalProperties" ReadOnly="true">
<Documentation>
<UserDocu>Computes the principal properties of inertia of the current system.
There is always a set of axes for which the products
of inertia of a geometric system are equal to 0; i.e. the
matrix of inertia of the system is diagonal. These axes
are the principal axes of inertia. Their origin is
coincident with the center of mass of the system. The
associated moments are called the principal moments of inertia.
This function computes the eigen values and the
eigen vectors of the matrix of inertia of the system.</UserDocu>
</Documentation>
<Parameter Name="PrincipalProperties" Type="Dict"/>
</Attribute>
<Attribute Name="Continuity" ReadOnly="true">
<Documentation>
<UserDocu>Returns the continuity</UserDocu>
</Documentation>
<Parameter Name="Continuity" Type="String"/>
</Attribute>
<Methode Name="curveOnSurface" Const="true">
<Documentation>
<UserDocu>curveOnSurface(idx) -> None or tuple
Returns the 2D curve, the surface, the placement and the parameter range of index idx.
Returns None if index idx is out of range.
Returns a 5-items tuple of a curve, a surface, a placement, first parameter and last parameter.
</UserDocu>
</Documentation>
</Methode>
<ClassDeclarations>
</ClassDeclarations>
</PythonExport>
</GenerateModel>