FreeCAD

Форк
0
/
DraftGeomUtils.py 
176 строк · 8.0 Кб
1
# ***************************************************************************
2
# *   Copyright (c) 2009, 2010 Yorik van Havre <yorik@uncreated.net>        *
3
# *   Copyright (c) 2009, 2010 Ken Cline <cline@frii.com>                   *
4
# *                                                                         *
5
# *   This program is free software; you can redistribute it and/or modify  *
6
# *   it under the terms of the GNU Lesser General Public License (LGPL)    *
7
# *   as published by the Free Software Foundation; either version 2 of     *
8
# *   the License, or (at your option) any later version.                   *
9
# *   for detail see the LICENCE text file.                                 *
10
# *                                                                         *
11
# *   This program is distributed in the hope that it will be useful,       *
12
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14
# *   GNU Library General Public License for more details.                  *
15
# *                                                                         *
16
# *   You should have received a copy of the GNU Library General Public     *
17
# *   License along with this program; if not, write to the Free Software   *
18
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
19
# *   USA                                                                   *
20
# *                                                                         *
21
# ***************************************************************************
22
"""Define geometry functions for manipulating shapes in the Draft Workbench.
23

24
These functions are used by different object creation functions
25
of the Draft Workbench, both in `Draft.py` and `DraftTools.py`.
26
They operate on the internal shapes (`Part::TopoShape`) of different objects
27
and on their subelements, that is, vertices, edges, and faces.
28
"""
29
## \defgroup DRAFTGEOMUTILS DraftGeomUtils
30
#  \ingroup UTILITIES
31
#  \brief Shape manipulation utilities for the Draft workbench
32
#
33
# Shapes manipulation utilities
34

35
## \addtogroup DRAFTGEOMUTILS
36
#  @{
37

38
__title__ = "FreeCAD Draft Workbench - Geometry library"
39
__author__ = "Yorik van Havre, Jacques-Antoine Gaudin, Ken Cline"
40
__url__ = ["https://www.freecad.org"]
41

42
# Doesn't need requisites
43
from draftgeoutils.linear_algebra import (linearFromPoints,
44
                                          determinant)
45

46
# Needs math, Part, and vector tools
47
from draftgeoutils.general import NORM
48

49
from draftgeoutils.general import (precision,
50
                                   vec,
51
                                   edg,
52
                                   getVerts,
53
                                   v1,
54
                                   isNull,
55
                                   isPtOnEdge,
56
                                   hasCurves,
57
                                   isAligned,
58
                                   getQuad,
59
                                   areColinear,
60
                                   hasOnlyWires,
61
                                   geomType,
62
                                   isValidPath,
63
                                   findClosest,
64
                                   getBoundaryAngles)
65

66
# Needs general functions
67
from draftgeoutils.geometry import (findPerpendicular,
68
                                    findDistance,
69
                                    getSplineNormal,
70
                                    get_spline_normal,
71
                                    getNormal,
72
                                    get_normal,
73
                                    getRotation,
74
                                    isPlanar,
75
                                    is_planar,
76
                                    calculatePlacement,
77
                                    mirror,
78
                                    are_coplanar,
79
                                    is_straight_line,
80
                                    mirror_matrix,
81
                                    uv_vectors_from_face,
82
                                    placement_from_face,
83
                                    placement_from_points,
84
                                    distance_to_plane,
85
                                    project_point_on_plane)
86

87
from draftgeoutils.edges import (findEdge,
88
                                 orientEdge,
89
                                 isSameLine,
90
                                 isLine,
91
                                 is_line,
92
                                 invert,
93
                                 findMidpoint,
94
                                 getTangent,
95
                                 get_referenced_edges)
96

97
from draftgeoutils.faces import (concatenate,
98
                                 getBoundary,
99
                                 isCoplanar,
100
                                 is_coplanar,
101
                                 bind,
102
                                 cleanFaces,
103
                                 removeSplitter)
104

105
from draftgeoutils.arcs import (isClockwise,
106
                                isWideAngle,
107
                                arcFrom2Pts,
108
                                arcFromSpline)
109

110
from draftgeoutils.cuboids import (isCubic,
111
                                   getCubicDimensions)
112

113
# Needs geometry functions
114
from draftgeoutils.circle_inversion import (pointInversion,
115
                                            polarInversion,
116
                                            circleInversion)
117

118
# Needs edges functions
119
from draftgeoutils.sort_edges import (sortEdges,
120
                                      sortEdgesOld)
121

122
from draftgeoutils.intersections import (findIntersection,
123
                                         wiresIntersect,
124
                                         connect,
125
                                         angleBisection)
126

127
from draftgeoutils.wires import (findWires,
128
                                 findWiresOld,
129
                                 findWiresOld2,
130
                                 flattenWire,
131
                                 superWire,
132
                                 isReallyClosed,
133
                                 curvetowire,
134
                                 curvetosegment,
135
                                 rebaseWire,
136
                                 removeInterVertices,
137
                                 cleanProjection,
138
                                 tessellateProjection,
139
                                 get_placement_perpendicular_to_wire,
140
                                 get_extended_wire)
141

142
# Needs wires functions
143
from draftgeoutils.fillets import (fillet,
144
                                   filletWire)
145

146
# Needs intersections functions
147
from draftgeoutils.offsets import (pocket2d,
148
                                   offset,
149
                                   offsetWire)
150

151
from draftgeoutils.circles import (findClosestCircle,
152
                                   getCircleFromSpline,
153
                                   circlefrom1Line2Points,
154
                                   circlefrom2Lines1Point,
155
                                   circleFrom2LinesRadius,
156
                                   circleFrom3LineTangents,
157
                                   circleFromPointLineRadius,
158
                                   circleFrom2PointsRadius,
159
                                   findHomotheticCenterOfCircles,
160
                                   findRadicalAxis,
161
                                   findRadicalCenter)
162

163
from draftgeoutils.circles_apollonius import (outerSoddyCircle,
164
                                              innerSoddyCircle,
165
                                              circleFrom3CircleTangents)
166

167
# Needs circles_apollonius functions
168
# These functions are not imported because they are incomplete;
169
# they require pre-requisite functions that haven't been written
170
# from draftgeoutils.circles_incomplete import (circleFrom2tan1pt,
171
#                                               circleFrom2tan1rad,
172
#                                               circleFrom1tan2pt,
173
#                                               circleFrom1tan1pt1rad,
174
#                                               circleFrom3tan)
175

176
##  @}
177

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

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

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

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