FreeCAD

Форк
0
/
TopoShapeEdgePy.xml 
546 строк · 22.2 Кб
1
<?xml version="1.0" encoding="UTF-8"?>
2
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
3
  <PythonExport
4
      Father="TopoShapePy"
5
      Name="TopoShapeEdgePy"
6
      Twin="TopoShape"
7
      TwinPointer="TopoShape"
8
      Include="Mod/Part/App/TopoShape.h"
9
      Namespace="Part"
10
      FatherInclude="Mod/Part/App/TopoShapePy.h"
11
      FatherNamespace="Part"
12
      Constructor="true">
13
    <Documentation>
14
      <Author Licence="LGPL" Name="Juergen Riegel" EMail="Juergen.Riegel@web.de" />
15
      <UserDocu>TopoShapeEdge is the OpenCasCade topological edge wrapper</UserDocu>
16
    </Documentation>
17
    <Methode Name="getParameterByLength" Const="true">
18
      <Documentation>
19
        <UserDocu>Get the value of the primary parameter at the given distance along the cartesian length of the edge.
20
getParameterByLength(pos, [tolerance = 1e-7]) -> Float
21
--
22
Args:
23
    pos (float or int): The distance along the length of the edge at which to
24
        determine the primary parameter value. See help for the FirstParameter or
25
        LastParameter properties for more information on the primary parameter.
26
        If the given value is positive, the distance from edge start is used.
27
        If the given value is negative, the distance from edge end is used.
28
    tol (float): Computing tolerance. Optional, defaults to 1e-7.
29

30
Returns:
31
    paramval (float): the value of the primary parameter defining the edge at the
32
        given position along its cartesian length.
33
        </UserDocu>
34
      </Documentation>
35
    </Methode>
36
    <Methode Name="tangentAt" Const="true">
37
      <Documentation>
38
        <UserDocu>Get the tangent direction at the given primary parameter value along the Edge if it is defined
39
tangentAt(paramval) -> Vector
40
--
41
Args:
42
    paramval (float or int): The parameter value along the Edge at which to
43
        determine the tangent direction e.g:
44

45
        x = Part.makeCircle(1, FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), 0, 90)
46
        y = x.tangentAt(x.FirstParameter + 0.5 * (x.LastParameter - x.FirstParameter))
47

48
        y is the Vector (-0.7071067811865475, 0.7071067811865476, 0.0)
49

50
        Values with magnitude greater than the Edge length return
51
        values of the tangent on the curve extrapolated beyond its
52
        length. This may not be valid for all Edges. Negative values
53
        similarly return a tangent on the curve extrapolated backwards
54
        (before the start point of the Edge). For example, using the
55
        same shape as above:
56

57
        >>> x.tangentAt(x.FirstParameter + 3.5*(x.LastParameter - x.FirstParameter))
58
        Vector (0.7071067811865477, 0.7071067811865474, 0.0)
59

60
        Which gives the same result as
61

62
        >>> x.tangentAt(x.FirstParameter -0.5*(x.LastParameter - x.FirstParameter))
63
        Vector (0.7071067811865475, 0.7071067811865476, 0.0)
64

65
        Since it is a circle
66

67
Returns:
68
    Vector: representing the tangent to the Edge at the given
69
       location along its length (or extrapolated length)
70
        </UserDocu>
71
      </Documentation>
72
    </Methode>
73
    <Methode Name="valueAt" Const="true">
74
      <Documentation>
75
        <UserDocu>Get the value of the cartesian parameter value at the given parameter value along the Edge
76
valueAt(paramval) -> Vector
77
--
78
Args:
79
    paramval (float or int): The parameter value along the Edge at which to
80
        determine the value in terms of the main parameter defining
81
        the edge, what the parameter value is depends on the type of
82
        edge. See  e.g:
83

84
        For a circle value
85

86
        x = Part.makeCircle(1, FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), 0, 90)
87
        y = x.valueAt(x.FirstParameter + 0.5 * (x.LastParameter - x.FirstParameter))
88

89
        y is theVector (0.7071067811865476, 0.7071067811865475, 0.0)
90

91
        Values with magnitude greater than the Edge length return
92
        values on the curve extrapolated beyond its length. This may
93
        not be valid for all Edges. Negative values similarly return
94
        a parameter value on the curve extrapolated backwards (before the
95
        start point of the Edge). For example, using the same shape
96
        as above:
97

98
        >>> x.valueAt(x.FirstParameter + 3.5*(x.LastParameter - x.FirstParameter))
99
        Vector (0.7071067811865474, -0.7071067811865477, 0.0)
100

101
        Which gives the same result as
102

103
        >>> x.valueAt(x.FirstParameter -0.5*(x.LastParameter - x.FirstParameter))
104
        Vector (0.7071067811865476, -0.7071067811865475, 0.0)
105

106
        Since it is a circle
107

108
Returns:
109
    Vector: representing the cartesian location on the Edge at the given
110
       distance along its length (or extrapolated length)
111
          </UserDocu>
112
        </Documentation>
113
      </Methode>
114
      <Methode Name="parameters" Const="true">
115
        <Documentation>
116
          <UserDocu>Get the list of parameters of the tessellation of an edge.
117
parameters([face]) -> list
118
--
119
If the edge is part of a face then this face is required as argument.
120
An exception is raised if the edge has no polygon.
121
          </UserDocu>
122
        </Documentation>
123
      </Methode>
124
      <Methode Name="parameterAt" Const="true">
125
          <Documentation>
126
            <UserDocu>Get the parameter at the given vertex if lying on the edge
127
parameterAt(Vertex) -> Float
128
            </UserDocu>
129
          </Documentation>
130
      </Methode>
131
      <Methode Name="normalAt" Const="true">
132
        <Documentation>
133
          <UserDocu>Get the normal direction at the given parameter value along the Edge if it is defined
134
normalAt(paramval) -> Vector
135
--
136
Args:
137
    paramval (float or int): The parameter value along the Edge at which to
138
        determine the normal direction e.g:
139

140
        x = Part.makeCircle(1, FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), 0, 90)
141
        y = x.normalAt(x.FirstParameter + 0.5 * (x.LastParameter - x.FirstParameter))
142

143
        y is the Vector (-0.7071067811865476, -0.7071067811865475, 0.0)
144

145
        Values with magnitude greater than the Edge length return
146
        values of the normal on the curve extrapolated beyond its
147
        length. This may not be valid for all Edges. Negative values
148
        similarly return a normal on the curve extrapolated backwards
149
        (before the start point of the Edge). For example, using the
150
        same shape as above:
151

152
        >>> x.normalAt(x.FirstParameter + 3.5*(x.LastParameter - x.FirstParameter))
153
        Vector (-0.7071067811865474, 0.7071067811865477, 0.0)
154

155
        Which gives the same result as
156

157
        >>> x.normalAt(x.FirstParameter -0.5*(x.LastParameter - x.FirstParameter))
158
        Vector (-0.7071067811865476, 0.7071067811865475, 0.0)
159

160
        Since it is a circle
161

162
Returns:
163
    Vector: representing the normal to the Edge at the given
164
       location along its length (or extrapolated length)
165
          </UserDocu>
166
        </Documentation>
167
      </Methode>
168
      <Methode Name="derivative1At" Const="true">
169
        <Documentation>
170
          <UserDocu>Get the first derivative at the given parameter value along the Edge if it is defined
171
derivative1At(paramval) -> Vector
172
--
173
Args:
174
    paramval (float or int): The parameter value along the Edge at which to
175
        determine the first derivative e.g:
176

177
        x = Part.makeCircle(1, FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), 0, 90)
178
        y = x.derivative1At(x.FirstParameter + 0.5 * (x.LastParameter - x.FirstParameter))
179

180
        y is the Vector (-0.7071067811865475, 0.7071067811865476, 0.0)
181

182
        Values with magnitude greater than the Edge length return
183
        values of the first derivative on the curve extrapolated
184
        beyond its length. This may not be valid for all Edges.
185
        Negative values similarly return a first derivative on the
186
        curve extrapolated backwards (before the start point of the
187
        Edge). For example, using the same shape as above:
188

189
        >>> x.derivative1At(x.FirstParameter + 3.5*(x.LastParameter - x.FirstParameter))
190
        Vector (0.7071067811865477, 0.7071067811865474, 0.0)
191

192
        Which gives the same result as
193

194
        >>> x.derivative1At(x.FirstParameter -0.5*(x.LastParameter - x.FirstParameter))
195
        Vector (0.7071067811865475, 0.7071067811865476, 0.0)
196

197
        Since it is a circle
198

199
Returns:
200
    Vector: representing the first derivative to the Edge at the
201
       given location along its length (or extrapolated length)
202
          </UserDocu>
203
        </Documentation>
204
      </Methode>
205
      <Methode Name="derivative2At" Const="true">
206
        <Documentation>
207
          <UserDocu>Get the second derivative at the given parameter value along the Edge if it is defined
208
derivative2At(paramval) -> Vector
209
--
210
Args:
211
    paramval (float or int): The parameter value along the Edge at which to
212
        determine the second derivative e.g:
213

214
        x = Part.makeCircle(1, FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), 0, 90)
215
        y = x.derivative2At(x.FirstParameter + 0.5 * (x.LastParameter - x.FirstParameter))
216

217
        y is the Vector (-0.7071067811865476, -0.7071067811865475, 0.0)
218

219
        Values with magnitude greater than the Edge length return
220
        values of the second derivative on the curve extrapolated
221
        beyond its length. This may not be valid for all Edges.
222
        Negative values similarly return a second derivative on the
223
        curve extrapolated backwards (before the start point of the
224
        Edge). For example, using the same shape as above:
225

226
        >>> x.derivative2At(x.FirstParameter + 3.5*(x.LastParameter - x.FirstParameter))
227
        Vector (-0.7071067811865474, 0.7071067811865477, 0.0)
228

229
        Which gives the same result as
230

231
        >>> x.derivative2At(x.FirstParameter -0.5*(x.LastParameter - x.FirstParameter))
232
        Vector (-0.7071067811865476, 0.7071067811865475, 0.0)
233

234
        Since it is a circle
235

236
Returns:
237
    Vector: representing the second derivative to the Edge at the
238
       given location along its length (or extrapolated length)
239
          </UserDocu>
240
        </Documentation>
241
      </Methode>
242
      <Methode Name="derivative3At" Const="true">
243
        <Documentation>
244
          <UserDocu>Get the third derivative at the given parameter value along the Edge if it is defined
245
derivative3At(paramval) -> Vector
246
--
247
Args:
248
    paramval (float or int): The parameter value along the Edge at which to
249
        determine the third derivative e.g:
250

251
        x = Part.makeCircle(1, FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), 0, 90)
252
        y = x.derivative3At(x.FirstParameter + 0.5 * (x.LastParameter - x.FirstParameter))
253

254
        y is the Vector (0.7071067811865475, -0.7071067811865476, -0.0)
255

256
        Values with magnitude greater than the Edge length return
257
        values of the third derivative on the curve extrapolated
258
        beyond its length. This may not be valid for all Edges.
259
        Negative values similarly return a third derivative on the
260
        curve extrapolated backwards (before the start point of the
261
        Edge). For example, using the same shape as above:
262

263
        >>> x.derivative3At(x.FirstParameter + 3.5*(x.LastParameter - x.FirstParameter))
264
        Vector (-0.7071067811865477, -0.7071067811865474, 0.0)
265

266
        Which gives the same result as
267

268
        >>> x.derivative3At(x.FirstParameter -0.5*(x.LastParameter - x.FirstParameter))
269
        Vector (-0.7071067811865475, -0.7071067811865476, 0.0)
270

271
        Since it is a circle
272

273
Returns:
274
    Vector: representing the third derivative to the Edge at the
275
       given location along its length (or extrapolated length)
276
          </UserDocu>
277
        </Documentation>
278
      </Methode>
279
      <Methode Name="curvatureAt" Const="true">
280
        <Documentation>
281
          <UserDocu>Get the curvature at the given parameter [First|Last] if defined
282
curvatureAt(paramval) -> Float
283
          </UserDocu>
284
        </Documentation>
285
      </Methode>
286
      <Methode Name="centerOfCurvatureAt" Const="true">
287
        <Documentation>
288
          <UserDocu>Get the center of curvature at the given parameter [First|Last] if defined
289
centerOfCurvatureAt(paramval) -> Vector
290
          </UserDocu>
291
        </Documentation>
292
      </Methode>
293
      <Methode Name="firstVertex" Const="true">
294
        <Documentation>
295
          <UserDocu>Returns the Vertex of orientation FORWARD in this edge.
296
firstVertex([Orientation=False]) -> Vertex
297
--
298
If there is none a Null shape is returned.
299
Orientation = True : taking into account the edge orientation
300
          </UserDocu>
301
        </Documentation>
302
      </Methode>
303
      <Methode Name="lastVertex" Const="true">
304
        <Documentation>
305
          <UserDocu>Returns the Vertex of orientation REVERSED in this edge.
306
lastVertex([Orientation=False]) -> Vertex
307
--
308
If there is none a Null shape is returned.
309
Orientation = True : taking into account the edge orientation
310
          </UserDocu>
311
        </Documentation>
312
      </Methode>
313
      <Methode Name="discretize" Const="true" Keyword="true">
314
        <Documentation>
315
          <UserDocu>Discretizes the edge and returns a list of points.
316
discretize(kwargs) -> list
317
--
318
The function accepts keywords as argument:
319
discretize(Number=n) => gives a list of 'n' equidistant points
320
discretize(QuasiNumber=n) => gives a list of 'n' quasi equidistant points (is faster than the method above)
321
discretize(Distance=d) => gives a list of equidistant points with distance 'd'
322
discretize(Deflection=d) => gives a list of points with a maximum deflection 'd' to the edge
323
discretize(QuasiDeflection=d) => gives a list of points with a maximum deflection 'd' to the edge (faster)
324
discretize(Angular=a,Curvature=c,[Minimum=m]) => gives a list of points with an angular deflection of 'a'
325
                                    and a curvature deflection of 'c'. Optionally a minimum number of points
326
                                    can be set which by default is set to 2.
327

328
Optionally you can set the keywords 'First' and 'Last' to define a sub-range of the parameter range
329
of the edge.
330

331
If no keyword is given then it depends on whether the argument is an int or float.
332
If it's an int then the behaviour is as if using the keyword 'Number', if it's float
333
then the behaviour is as if using the keyword 'Distance'.
334

335
Example:
336

337
import Part
338
e=Part.makeCircle(5)
339
p=e.discretize(Number=50,First=3.14)
340
s=Part.Compound([Part.Vertex(i) for i in p])
341
Part.show(s)
342

343

344
p=e.discretize(Angular=0.09,Curvature=0.01,Last=3.14,Minimum=100)
345
s=Part.Compound([Part.Vertex(i) for i in p])
346
Part.show(s)
347
          </UserDocu>
348
        </Documentation>
349
      </Methode>
350
      <Methode Name="countNodes" Const="true">
351
      <Documentation>
352
        <UserDocu>Returns the number of nodes of the 3D polygon of the edge.</UserDocu>
353
      </Documentation>
354
      </Methode>
355
      <Methode Name="split" Const="true">
356
        <Documentation>
357
          <UserDocu>Splits the edge at the given parameter values and builds a wire out of it
358
split(paramval) -> Wire
359
--
360
Args:
361
    paramval (float or list_of_floats): The parameter values along the Edge at which to
362
        split it e.g:
363

364
        edge = Part.makeCircle(1, FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), 0, 90)
365
        wire = edge.split([0.5, 1.0])
366

367
Returns:
368
    Wire: wire made up of two Edges
369
          </UserDocu>
370
        </Documentation>
371
      </Methode>
372
      <Methode Name="isSeam" Const="true">
373
        <Documentation>
374
          <UserDocu>Checks whether the edge is a seam edge.
375
isSeam(Face)
376
          </UserDocu>
377
        </Documentation>
378
      </Methode>
379
      <Methode Name="curveOnSurface" Const="true">
380
        <Documentation>
381
          <UserDocu>Returns the 2D curve, the surface, the placement and the parameter range of index idx.
382
curveOnSurface(idx) -> None or tuple
383
--
384
Returns None if index idx is out of range.
385
Returns a 5-items tuple of a curve, a surface, a placement, first parameter and last parameter.
386
          </UserDocu>
387
        </Documentation>
388
      </Methode>
389
      <Attribute Name="Tolerance">
390
        <Documentation>
391
          <UserDocu>Set or get the tolerance of the vertex</UserDocu>
392
        </Documentation>
393
        <Parameter Name="Tolerance" Type="Float"/>
394
      </Attribute>
395
      <Attribute Name="Length" ReadOnly="true">
396
        <Documentation>
397
          <UserDocu>Returns the cartesian length of the curve</UserDocu>
398
        </Documentation>
399
        <Parameter Name="Length" Type="Float"/>
400
      </Attribute>
401
      <Attribute Name="ParameterRange" ReadOnly="true">
402
        <Documentation>
403
          <UserDocu>
404
Returns a 2 tuple with the range of the primary parameter
405
defining the curve. This is the same as would be returned by
406
the FirstParameter and LastParameter properties, i.e.
407

408
(LastParameter,FirstParameter)
409

410
What the parameter is depends on what type of edge it is. For a
411
Line the parameter is simply its cartesian length. Some other
412
examples are shown below:
413

414
Type                 Parameter
415
---------------------------------------------------------------
416
Circle               Angle swept by circle (or arc) in radians
417
BezierCurve          Unitless number in the range 0.0 to 1.0
418
Helix                Angle swept by helical turns in radians
419
          </UserDocu>
420
        </Documentation>
421
        <Parameter Name="ParameterRange" Type="Tuple"/>
422
      </Attribute>
423
      <Attribute Name="FirstParameter" ReadOnly="true">
424
        <Documentation>
425
          <UserDocu>
426
Returns the start value of the range of the primary parameter
427
defining the curve.
428

429
What the parameter is depends on what type of edge it is. For a
430
Line the parameter is simply its cartesian length. Some other
431
examples are shown below:
432

433
Type                 Parameter
434
-----------------------------------------------------------
435
Circle               Angle swept by circle (or arc) in radians
436
BezierCurve          Unitless number in the range 0.0 to 1.0
437
Helix                Angle swept by helical turns in radians
438
          </UserDocu>
439
        </Documentation>
440
        <Parameter Name="FirstParameter" Type="Float"/>
441
      </Attribute>
442
      <Attribute Name="LastParameter" ReadOnly="true">
443
        <Documentation>
444
          <UserDocu>
445
Returns the end value of the range of the primary parameter
446
defining the curve.
447

448
What the parameter is depends on what type of edge it is. For a
449
Line the parameter is simply its cartesian length. Some other
450
examples are shown below:
451

452
Type                 Parameter
453
-----------------------------------------------------------
454
Circle               Angle swept by circle (or arc) in radians
455
BezierCurve          Unitless number in the range 0.0 to 1.0
456
Helix                Angle swept by helical turns in radians
457
          </UserDocu>
458
        </Documentation>
459
        <Parameter Name="LastParameter" Type="Float"/>
460
      </Attribute>
461
      <Attribute Name="Curve" ReadOnly="true">
462
        <Documentation>
463
          <UserDocu>Returns the 3D curve of the edge</UserDocu>
464
        </Documentation>
465
        <Parameter Name="Curve" Type="Object"/>
466
      </Attribute>
467
      <Attribute Name="Closed" ReadOnly="true">
468
        <Documentation>
469
          <UserDocu>Returns true if the edge is closed</UserDocu>
470
        </Documentation>
471
        <Parameter Name="Closed" Type="Boolean"/>
472
      </Attribute>
473
      <Attribute Name="Degenerated" ReadOnly="true">
474
        <Documentation>
475
          <UserDocu>Returns true if the edge is degenerated</UserDocu>
476
        </Documentation>
477
        <Parameter Name="Degenerated" Type="Boolean"/>
478
      </Attribute>
479
      <Attribute Name="Mass" ReadOnly="true">
480
        <Documentation>
481
          <UserDocu>Returns the mass of the current system.</UserDocu>
482
        </Documentation>
483
        <Parameter Name="Mass" Type="Object"/>
484
      </Attribute>
485
      <Attribute Name="CenterOfMass" ReadOnly="true">
486
        <Documentation>
487
          <UserDocu>Returns the center of mass of the current system.
488
If the gravitational field is uniform, it is the center of gravity.
489
The coordinates returned for the center of mass are expressed in the
490
absolute Cartesian coordinate system.</UserDocu>
491
        </Documentation>
492
        <Parameter Name="CenterOfMass" Type="Object"/>
493
      </Attribute>
494
      <Attribute Name="MatrixOfInertia" ReadOnly="true">
495
        <Documentation>
496
          <UserDocu>Returns the matrix of inertia. It is a symmetrical matrix.
497
The coefficients of the matrix are the quadratic moments of
498
inertia.
499

500
 | Ixx Ixy Ixz 0 |
501
 | Ixy Iyy Iyz 0 |
502
 | Ixz Iyz Izz 0 |
503
 | 0   0   0   1 |
504

505
The moments of inertia are denoted by Ixx, Iyy, Izz.
506
The products of inertia are denoted by Ixy, Ixz, Iyz.
507
The matrix of inertia is returned in the central coordinate
508
system (G, Gx, Gy, Gz) where G is the centre of mass of the
509
system and Gx, Gy, Gz the directions parallel to the X(1,0,0)
510
Y(0,1,0) Z(0,0,1) directions of the absolute cartesian
511
coordinate system.</UserDocu>
512
        </Documentation>
513
        <Parameter Name="MatrixOfInertia" Type="Object"/>
514
      </Attribute>
515
      <Attribute Name="StaticMoments" ReadOnly="true">
516
        <Documentation>
517
          <UserDocu>Returns Ix, Iy, Iz, the static moments of inertia of the
518
 current system; i.e. the moments of inertia about the
519
 three axes of the Cartesian coordinate system.</UserDocu>
520
        </Documentation>
521
        <Parameter Name="StaticMoments" Type="Object"/>
522
      </Attribute>
523
      <Attribute Name="PrincipalProperties" ReadOnly="true">
524
        <Documentation>
525
          <UserDocu>Computes the principal properties of inertia of the current system.
526
 There is always a set of axes for which the products
527
 of inertia of a geometric system are equal to 0; i.e. the
528
 matrix of inertia of the system is diagonal. These axes
529
 are the principal axes of inertia. Their origin is
530
 coincident with the center of mass of the system. The
531
 associated moments are called the principal moments of inertia.
532
 This function computes the eigen values and the
533
 eigen vectors of the matrix of inertia of the system.</UserDocu>
534
        </Documentation>
535
        <Parameter Name="PrincipalProperties" Type="Dict"/>
536
      </Attribute>
537
      <Attribute Name="Continuity" ReadOnly="true">
538
        <Documentation>
539
          <UserDocu>Returns the continuity</UserDocu>
540
        </Documentation>
541
        <Parameter Name="Continuity" Type="String"/>
542
      </Attribute>
543
      <ClassDeclarations>
544
      </ClassDeclarations>
545
    </PythonExport>
546
</GenerateModel>
547

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.