topologicpy 0.2.1__py3-none-any.whl → 0.2.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- topologicpy/Cell.py +129 -127
- topologicpy/CellComplex.py +21 -23
- topologicpy/Cluster.py +7 -11
- topologicpy/DGL.py +10 -5
- topologicpy/Face.py +124 -38
- topologicpy/Honeybee.py +158 -334
- topologicpy/Plotly.py +51 -33
- topologicpy/Shell.py +30 -50
- topologicpy/Topology.py +231 -79
- topologicpy/UnitTest.py +2 -2
- topologicpy/Vector.py +242 -17
- topologicpy/Wire.py +38 -66
- topologicpy/__init__.py +1 -1
- {topologicpy-0.2.1.dist-info → topologicpy-0.2.3.dist-info}/METADATA +3 -1
- {topologicpy-0.2.1.dist-info → topologicpy-0.2.3.dist-info}/RECORD +18 -18
- {topologicpy-0.2.1.dist-info → topologicpy-0.2.3.dist-info}/LICENSE +0 -0
- {topologicpy-0.2.1.dist-info → topologicpy-0.2.3.dist-info}/WHEEL +0 -0
- {topologicpy-0.2.1.dist-info → topologicpy-0.2.3.dist-info}/top_level.txt +0 -0
topologicpy/Vector.py
CHANGED
|
@@ -7,8 +7,6 @@ class Vector(list):
|
|
|
7
7
|
@staticmethod
|
|
8
8
|
def Angle(vectorA, vectorB, mantissa=4):
|
|
9
9
|
"""
|
|
10
|
-
Description
|
|
11
|
-
----------
|
|
12
10
|
Returns the angle in degrees between the two input vectors
|
|
13
11
|
|
|
14
12
|
Parameters
|
|
@@ -34,12 +32,32 @@ class Vector(list):
|
|
|
34
32
|
cosang = np.dot(vectorA, vectorB)
|
|
35
33
|
sinang = la.norm(np.cross(vectorA, vectorB))
|
|
36
34
|
return round(math.degrees(np.arctan2(sinang, cosang)), mantissa)
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def ByCoordinates(x, y, z):
|
|
38
|
+
"""
|
|
39
|
+
Creates a vector by the specified x, y, z inputs.
|
|
37
40
|
|
|
41
|
+
Parameters
|
|
42
|
+
----------
|
|
43
|
+
x : float
|
|
44
|
+
The X coordinate.
|
|
45
|
+
y : float
|
|
46
|
+
The Y coordinate.
|
|
47
|
+
z : float
|
|
48
|
+
The Z coodinate.
|
|
49
|
+
|
|
50
|
+
Returns
|
|
51
|
+
-------
|
|
52
|
+
list
|
|
53
|
+
The created vector.
|
|
54
|
+
|
|
55
|
+
"""
|
|
56
|
+
return [x,y,z]
|
|
57
|
+
|
|
38
58
|
@staticmethod
|
|
39
59
|
def CompassAngle(vectorA, vectorB, mantissa=4, tolerance=0.0001):
|
|
40
60
|
"""
|
|
41
|
-
Description
|
|
42
|
-
----------
|
|
43
61
|
Returns the horizontal compass angle in degrees between the two input vectors. The angle is measured in counter-clockwise fashion. Only the first two elements in the input vectors are considered.
|
|
44
62
|
|
|
45
63
|
Parameters
|
|
@@ -70,10 +88,52 @@ class Vector(list):
|
|
|
70
88
|
return round(rad2deg((ang1 - ang2) % (2 * pi)), mantissa)
|
|
71
89
|
|
|
72
90
|
@staticmethod
|
|
73
|
-
def
|
|
91
|
+
def Coordinates(vector, outputType="xyz", mantissa=4):
|
|
74
92
|
"""
|
|
75
|
-
|
|
93
|
+
Returns the coordinates of the input vector.
|
|
94
|
+
|
|
95
|
+
Parameters
|
|
76
96
|
----------
|
|
97
|
+
vector : list
|
|
98
|
+
The input vector.
|
|
99
|
+
outputType : string, optional
|
|
100
|
+
The desired output type. Could be any permutation or substring of "xyz" or the string "matrix". The default is "xyz". The input is case insensitive and the coordinates will be returned in the specified order.
|
|
101
|
+
mantissa : int , optional
|
|
102
|
+
The desired length of the mantissa. The default is 4.
|
|
103
|
+
|
|
104
|
+
Returns
|
|
105
|
+
-------
|
|
106
|
+
list
|
|
107
|
+
The coordinates of the input vertex.
|
|
108
|
+
|
|
109
|
+
"""
|
|
110
|
+
if not isinstance(vector, list):
|
|
111
|
+
return None
|
|
112
|
+
x = round(vector[0], mantissa)
|
|
113
|
+
y = round(vector[1], mantissa)
|
|
114
|
+
z = round(vector[2], mantissa)
|
|
115
|
+
matrix = [[1,0,0,x],
|
|
116
|
+
[0,1,0,y],
|
|
117
|
+
[0,0,1,z],
|
|
118
|
+
[0,0,0,1]]
|
|
119
|
+
output = []
|
|
120
|
+
outputType = outputType.lower()
|
|
121
|
+
if outputType == "matrix":
|
|
122
|
+
return matrix
|
|
123
|
+
else:
|
|
124
|
+
outputType = list(outputType)
|
|
125
|
+
for axis in outputType:
|
|
126
|
+
if axis == "x":
|
|
127
|
+
output.append(x)
|
|
128
|
+
elif axis == "y":
|
|
129
|
+
output.append(y)
|
|
130
|
+
elif axis == "z":
|
|
131
|
+
output.append(z)
|
|
132
|
+
return output
|
|
133
|
+
|
|
134
|
+
@staticmethod
|
|
135
|
+
def Cross(vectorA, vectorB, mantissa=4, tolerance=0.0001):
|
|
136
|
+
"""
|
|
77
137
|
Returns the cross product of the two input vectors. The resulting vector is perpendicular to the plane defined by the two input vectors.
|
|
78
138
|
|
|
79
139
|
Parameters
|
|
@@ -104,11 +164,33 @@ class Vector(list):
|
|
|
104
164
|
return None
|
|
105
165
|
return [round(vecC[0], mantissa), round(vecC[1], mantissa), round(vecC[2], mantissa)]
|
|
106
166
|
|
|
167
|
+
@staticmethod
|
|
168
|
+
def Down():
|
|
169
|
+
"""
|
|
170
|
+
Returns the vector representing the *down* direction. In Topologic, the negative ZAxis direction is considered *down* ([0,0,-1]).
|
|
171
|
+
|
|
172
|
+
Returns
|
|
173
|
+
-------
|
|
174
|
+
list
|
|
175
|
+
The vector representing the *down* direction.
|
|
176
|
+
"""
|
|
177
|
+
return [0,0,-1]
|
|
178
|
+
|
|
179
|
+
@staticmethod
|
|
180
|
+
def East():
|
|
181
|
+
"""
|
|
182
|
+
Returns the vector representing the *east* direction. In Topologic, the positive XAxis direction is considered *east* ([1,0,0]).
|
|
183
|
+
|
|
184
|
+
Returns
|
|
185
|
+
-------
|
|
186
|
+
list
|
|
187
|
+
The vector representing the *east* direction.
|
|
188
|
+
"""
|
|
189
|
+
return [1,0,0]
|
|
190
|
+
|
|
107
191
|
@staticmethod
|
|
108
192
|
def IsCollinear(vectorA, vectorB, tolerance=0.1):
|
|
109
193
|
"""
|
|
110
|
-
Description
|
|
111
|
-
-----------
|
|
112
194
|
Returns True if the input vectors are collinear. Returns False otherwise.
|
|
113
195
|
|
|
114
196
|
Parameters
|
|
@@ -129,8 +211,6 @@ class Vector(list):
|
|
|
129
211
|
@staticmethod
|
|
130
212
|
def Magnitude(vector, mantissa=4):
|
|
131
213
|
"""
|
|
132
|
-
Description
|
|
133
|
-
-----------
|
|
134
214
|
Returns the magnitude of the input vector.
|
|
135
215
|
|
|
136
216
|
Parameters
|
|
@@ -146,13 +226,11 @@ class Vector(list):
|
|
|
146
226
|
The magnitude of the input vector.
|
|
147
227
|
"""
|
|
148
228
|
|
|
149
|
-
return
|
|
229
|
+
return round(np.linalg.norm(np.array(vector)), mantissa)
|
|
150
230
|
|
|
151
231
|
@staticmethod
|
|
152
232
|
def Multiply(vector, magnitude, tolerance=0.0001):
|
|
153
233
|
"""
|
|
154
|
-
Description
|
|
155
|
-
----------
|
|
156
234
|
Multiplies the input vector by the input magnitude.
|
|
157
235
|
|
|
158
236
|
Parameters
|
|
@@ -184,8 +262,6 @@ class Vector(list):
|
|
|
184
262
|
@staticmethod
|
|
185
263
|
def Normalize(vector):
|
|
186
264
|
"""
|
|
187
|
-
Description
|
|
188
|
-
-----------
|
|
189
265
|
Returns a normalized vector of the input vector. A normalized vector has the same direction as the input vector, but its magnitude is 1.
|
|
190
266
|
|
|
191
267
|
Parameters
|
|
@@ -201,11 +277,45 @@ class Vector(list):
|
|
|
201
277
|
|
|
202
278
|
return list(vector / np.linalg.norm(vector))
|
|
203
279
|
|
|
280
|
+
@staticmethod
|
|
281
|
+
def North():
|
|
282
|
+
"""
|
|
283
|
+
Returns the vector representing the *north* direction. In Topologic, the positive YAxis direction is considered *north* ([0,1,0]).
|
|
284
|
+
|
|
285
|
+
Returns
|
|
286
|
+
-------
|
|
287
|
+
list
|
|
288
|
+
The vector representing the *north* direction.
|
|
289
|
+
"""
|
|
290
|
+
return [0,1,0]
|
|
291
|
+
|
|
292
|
+
@staticmethod
|
|
293
|
+
def NorthEast():
|
|
294
|
+
"""
|
|
295
|
+
Returns the vector representing the *northeast* direction. In Topologic, the positive YAxis direction is considered *north* and the positive XAxis direction is considered *east*. Therefore *northeast* is ([1,1,0]).
|
|
296
|
+
|
|
297
|
+
Returns
|
|
298
|
+
-------
|
|
299
|
+
list
|
|
300
|
+
The vector representing the *northeast* direction.
|
|
301
|
+
"""
|
|
302
|
+
return [1,1,0]
|
|
303
|
+
|
|
304
|
+
@staticmethod
|
|
305
|
+
def NorthWest():
|
|
306
|
+
"""
|
|
307
|
+
Returns the vector representing the *northwest* direction. In Topologic, the positive YAxis direction is considered *north* and the negative XAxis direction is considered *west*. Therefore *northwest* is ([-1,1,0]).
|
|
308
|
+
|
|
309
|
+
Returns
|
|
310
|
+
-------
|
|
311
|
+
list
|
|
312
|
+
The vector representing the *northwest* direction.
|
|
313
|
+
"""
|
|
314
|
+
return [-1,1,0]
|
|
315
|
+
|
|
204
316
|
@staticmethod
|
|
205
317
|
def Reverse(vector):
|
|
206
318
|
"""
|
|
207
|
-
Description
|
|
208
|
-
-----------
|
|
209
319
|
Returns a reverse vector of the input vector. A reverse vector multiplies all components by -1.
|
|
210
320
|
|
|
211
321
|
Parameters
|
|
@@ -221,3 +331,118 @@ class Vector(list):
|
|
|
221
331
|
if not isinstance(vector, list):
|
|
222
332
|
return None
|
|
223
333
|
return [x*-1 for x in vector]
|
|
334
|
+
|
|
335
|
+
@staticmethod
|
|
336
|
+
def SetMagnitude(vector: list, magnitude: float) -> list:
|
|
337
|
+
"""
|
|
338
|
+
Sets the magnitude of the input vector to the input magnitude.
|
|
339
|
+
|
|
340
|
+
Parameters
|
|
341
|
+
----------
|
|
342
|
+
vector : list
|
|
343
|
+
The input vector.
|
|
344
|
+
magnitude : float
|
|
345
|
+
The desired magnitude.
|
|
346
|
+
|
|
347
|
+
Returns
|
|
348
|
+
-------
|
|
349
|
+
list
|
|
350
|
+
The created vector.
|
|
351
|
+
"""
|
|
352
|
+
return (Vector.Multiply(vector=Vector.Normalize(vector), magnitude=magnitude))
|
|
353
|
+
|
|
354
|
+
@staticmethod
|
|
355
|
+
def South():
|
|
356
|
+
"""
|
|
357
|
+
Returns the vector representing the *south* direction. In Topologic, the negative YAxis direction is considered *south* ([0,-1,0]).
|
|
358
|
+
|
|
359
|
+
Returns
|
|
360
|
+
-------
|
|
361
|
+
list
|
|
362
|
+
The vector representing the *south* direction.
|
|
363
|
+
"""
|
|
364
|
+
return [0,-1,0]
|
|
365
|
+
|
|
366
|
+
@staticmethod
|
|
367
|
+
def SouthEast():
|
|
368
|
+
"""
|
|
369
|
+
Returns the vector representing the *southeast* direction. In Topologic, the negative YAxis direction is considered *south* and the positive XAxis direction is considered *east*. Therefore *southeast* is ([1,-1,0]).
|
|
370
|
+
|
|
371
|
+
Returns
|
|
372
|
+
-------
|
|
373
|
+
list
|
|
374
|
+
The vector representing the *southeast* direction.
|
|
375
|
+
"""
|
|
376
|
+
return [1,-1,0]
|
|
377
|
+
|
|
378
|
+
@staticmethod
|
|
379
|
+
def SouthWest():
|
|
380
|
+
"""
|
|
381
|
+
Returns the vector representing the *southwest* direction. In Topologic, the negative YAxis direction is considered *south* and the negative XAxis direction is considered *west*. Therefore *southwest* is ([-1,-1,0]).
|
|
382
|
+
|
|
383
|
+
Returns
|
|
384
|
+
-------
|
|
385
|
+
list
|
|
386
|
+
The vector representing the *southwest* direction.
|
|
387
|
+
"""
|
|
388
|
+
return [-1,-1,0]
|
|
389
|
+
|
|
390
|
+
@staticmethod
|
|
391
|
+
def Up():
|
|
392
|
+
"""
|
|
393
|
+
Returns the vector representing the up direction. In Topologic, the positive ZAxis direction is considered "up" ([0,0,1]).
|
|
394
|
+
|
|
395
|
+
Returns
|
|
396
|
+
-------
|
|
397
|
+
list
|
|
398
|
+
The vector representing the "up" direction.
|
|
399
|
+
"""
|
|
400
|
+
return [0,0,1]
|
|
401
|
+
|
|
402
|
+
@staticmethod
|
|
403
|
+
def West():
|
|
404
|
+
"""
|
|
405
|
+
Returns the vector representing the *west* direction. In Topologic, the negative XAxis direction is considered *west* ([-1,0,0]).
|
|
406
|
+
|
|
407
|
+
Returns
|
|
408
|
+
-------
|
|
409
|
+
list
|
|
410
|
+
The vector representing the *west* direction.
|
|
411
|
+
"""
|
|
412
|
+
return [-1,0,0]
|
|
413
|
+
|
|
414
|
+
@staticmethod
|
|
415
|
+
def XAxis():
|
|
416
|
+
"""
|
|
417
|
+
Returns the vector representing the XAxis ([1,0,0])
|
|
418
|
+
|
|
419
|
+
Returns
|
|
420
|
+
-------
|
|
421
|
+
list
|
|
422
|
+
The vector representing the XAxis.
|
|
423
|
+
"""
|
|
424
|
+
return [1,0,0]
|
|
425
|
+
|
|
426
|
+
@staticmethod
|
|
427
|
+
def YAxis():
|
|
428
|
+
"""
|
|
429
|
+
Returns the vector representing the YAxis ([0,1,0])
|
|
430
|
+
|
|
431
|
+
Returns
|
|
432
|
+
-------
|
|
433
|
+
list
|
|
434
|
+
The vector representing the YAxis.
|
|
435
|
+
"""
|
|
436
|
+
return [0,1,0]
|
|
437
|
+
|
|
438
|
+
@staticmethod
|
|
439
|
+
def ZAxis():
|
|
440
|
+
"""
|
|
441
|
+
Returns the vector representing the ZAxis ([0,0,1])
|
|
442
|
+
|
|
443
|
+
Returns
|
|
444
|
+
-------
|
|
445
|
+
list
|
|
446
|
+
The vector representing the ZAxis.
|
|
447
|
+
"""
|
|
448
|
+
return [0,0,1]
|
topologicpy/Wire.py
CHANGED
|
@@ -469,8 +469,7 @@ class Wire(topologic.Wire):
|
|
|
469
469
|
return Wire.ByVertices(vertices, close)
|
|
470
470
|
|
|
471
471
|
@staticmethod
|
|
472
|
-
def Circle(origin=None, radius=0.5, sides=16, fromAngle=0, toAngle=360, close=True,
|
|
473
|
-
dirY=0, dirZ=1, placement="center", tolerance=0.0001):
|
|
472
|
+
def Circle(origin=None, radius=0.5, sides=16, fromAngle=0, toAngle=360, close=True, direction=[0,0,1], placement="center", tolerance=0.0001):
|
|
474
473
|
"""
|
|
475
474
|
Creates a circle.
|
|
476
475
|
|
|
@@ -488,12 +487,8 @@ class Wire(topologic.Wire):
|
|
|
488
487
|
The angle in degrees at which to end creating the arc of the circle. The default is 360.
|
|
489
488
|
close : bool , optional
|
|
490
489
|
If set to True, arcs will be closed by connecting the last vertex to the first vertex. Otherwise, they will be left open.
|
|
491
|
-
|
|
492
|
-
The
|
|
493
|
-
dirY : float , optional
|
|
494
|
-
The Y component of the vector representing the up direction of the circle. The default is 0.
|
|
495
|
-
dirZ : float , optional
|
|
496
|
-
The Z component of the vector representing the up direction of the circle. The default is 1.
|
|
490
|
+
direction : list , optional
|
|
491
|
+
The vector representing the up direction of the circle. The default is [0,0,1].
|
|
497
492
|
placement : str , optional
|
|
498
493
|
The description of the placement of the origin of the circle. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
|
|
499
494
|
tolerance : float , optional
|
|
@@ -512,7 +507,8 @@ class Wire(topologic.Wire):
|
|
|
512
507
|
radius = abs(radius)
|
|
513
508
|
if radius < tolerance:
|
|
514
509
|
return None
|
|
515
|
-
|
|
510
|
+
|
|
511
|
+
if (abs(direction[0]) + abs(direction[1]) + abs(direction[2])) < tolerance:
|
|
516
512
|
return None
|
|
517
513
|
baseV = []
|
|
518
514
|
xList = []
|
|
@@ -542,9 +538,9 @@ class Wire(topologic.Wire):
|
|
|
542
538
|
x1 = origin.X()
|
|
543
539
|
y1 = origin.Y()
|
|
544
540
|
z1 = origin.Z()
|
|
545
|
-
x2 = origin.X() +
|
|
546
|
-
y2 = origin.Y() +
|
|
547
|
-
z2 = origin.Z() +
|
|
541
|
+
x2 = origin.X() + direction[0]
|
|
542
|
+
y2 = origin.Y() + direction[1]
|
|
543
|
+
z2 = origin.Z() + direction[2]
|
|
548
544
|
dx = x2 - x1
|
|
549
545
|
dy = y2 - y1
|
|
550
546
|
dz = z2 - z1
|
|
@@ -698,7 +694,7 @@ class Wire(topologic.Wire):
|
|
|
698
694
|
return edges
|
|
699
695
|
|
|
700
696
|
@staticmethod
|
|
701
|
-
def Ellipse(origin=None, inputMode=1, width=2.0, length=1.0, focalLength=0.866025, eccentricity=0.866025, majorAxisLength=1.0, minorAxisLength=0.5, sides=32, fromAngle=0, toAngle=360, close=True,
|
|
697
|
+
def Ellipse(origin=None, inputMode=1, width=2.0, length=1.0, focalLength=0.866025, eccentricity=0.866025, majorAxisLength=1.0, minorAxisLength=0.5, sides=32, fromAngle=0, toAngle=360, close=True, direction=[0,0,1], placement="center", tolerance=0.0001):
|
|
702
698
|
"""
|
|
703
699
|
Creates an ellipse and returns all its geometry and parameters.
|
|
704
700
|
|
|
@@ -733,12 +729,8 @@ class Wire(topologic.Wire):
|
|
|
733
729
|
The angle in degrees at which to end creating the arc of the ellipse. The default is 360.
|
|
734
730
|
close : bool , optional
|
|
735
731
|
If set to True, arcs will be closed by connecting the last vertex to the first vertex. Otherwise, they will be left open.
|
|
736
|
-
|
|
737
|
-
The
|
|
738
|
-
dirY : float , optional
|
|
739
|
-
The Y component of the vector representing the up direction of the ellipse. The default is 0.
|
|
740
|
-
dirZ : float , optional
|
|
741
|
-
The Z component of the vector representing the up direction of the ellipse. The default is 1.
|
|
732
|
+
direction : list , optional
|
|
733
|
+
The vector representing the up direction of the ellipse. The default is [0,0,1].
|
|
742
734
|
placement : str , optional
|
|
743
735
|
The description of the placement of the origin of the ellipse. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
|
|
744
736
|
tolerance : float , optional
|
|
@@ -750,11 +742,11 @@ class Wire(topologic.Wire):
|
|
|
750
742
|
The created ellipse
|
|
751
743
|
|
|
752
744
|
"""
|
|
753
|
-
ellipseAll = Wire.EllipseAll(origin=origin, inputMode=inputMode, width=width, length=length, focalLength=focalLength, eccentricity=eccentricity, majorAxisLength=majorAxisLength, minorAxisLength=minorAxisLength, sides=sides, fromAngle=fromAngle, toAngle=toAngle, close=close,
|
|
745
|
+
ellipseAll = Wire.EllipseAll(origin=origin, inputMode=inputMode, width=width, length=length, focalLength=focalLength, eccentricity=eccentricity, majorAxisLength=majorAxisLength, minorAxisLength=minorAxisLength, sides=sides, fromAngle=fromAngle, toAngle=toAngle, close=close, direction=direction, placement=placement, tolerance=tolerance)
|
|
754
746
|
return ellipseAll["ellipse"]
|
|
755
747
|
|
|
756
748
|
@staticmethod
|
|
757
|
-
def EllipseAll(origin=None, inputMode=1, width=2.0, length=1.0, focalLength= 0.866025, eccentricity=0.866025, majorAxisLength=1.0, minorAxisLength=0.5, sides=32, fromAngle=0, toAngle=360, close=True,
|
|
749
|
+
def EllipseAll(origin=None, inputMode=1, width=2.0, length=1.0, focalLength= 0.866025, eccentricity=0.866025, majorAxisLength=1.0, minorAxisLength=0.5, sides=32, fromAngle=0, toAngle=360, close=True, direction=[0,0,1], placement="center", tolerance=0.0001):
|
|
758
750
|
"""
|
|
759
751
|
Creates an ellipse and returns all its geometry and parameters.
|
|
760
752
|
|
|
@@ -789,12 +781,8 @@ class Wire(topologic.Wire):
|
|
|
789
781
|
The angle in degrees at which to end creating the arc of the ellipse. The default is 360.
|
|
790
782
|
close : bool , optional
|
|
791
783
|
If set to True, arcs will be closed by connecting the last vertex to the first vertex. Otherwise, they will be left open.
|
|
792
|
-
|
|
793
|
-
The
|
|
794
|
-
dirY : float , optional
|
|
795
|
-
The Y component of the vector representing the up direction of the ellipse. The default is 0.
|
|
796
|
-
dirZ : float , optional
|
|
797
|
-
The Z component of the vector representing the up direction of the ellipse. The default is 1.
|
|
784
|
+
direction : list , optional
|
|
785
|
+
The vector representing the up direction of the ellipse. The default is [0,0,1].
|
|
798
786
|
placement : str , optional
|
|
799
787
|
The description of the placement of the origin of the ellipse. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
|
|
800
788
|
tolerance : float , optional
|
|
@@ -822,7 +810,7 @@ class Wire(topologic.Wire):
|
|
|
822
810
|
return None
|
|
823
811
|
if placement.lower() not in ["center", "lowerleft"]:
|
|
824
812
|
return None
|
|
825
|
-
if (abs(
|
|
813
|
+
if (abs(direction[0]) + abs(direction[1]) + abs(direction[2])) < tolerance:
|
|
826
814
|
return None
|
|
827
815
|
width = abs(width)
|
|
828
816
|
length = abs(length)
|
|
@@ -834,7 +822,6 @@ class Wire(topologic.Wire):
|
|
|
834
822
|
if width < tolerance or length < tolerance or focalLength < tolerance or eccentricity < tolerance or majorAxisLength < tolerance or minorAxisLength < tolerance or sides < 3:
|
|
835
823
|
return None
|
|
836
824
|
if inputMode == 1:
|
|
837
|
-
# origin, w, l, sides, fromAngle, toAngle, close, dirX, dirY, dirZ = item
|
|
838
825
|
w = width
|
|
839
826
|
l = length
|
|
840
827
|
a = width/2
|
|
@@ -842,7 +829,6 @@ class Wire(topologic.Wire):
|
|
|
842
829
|
c = math.sqrt(abs(b**2 - a**2))
|
|
843
830
|
e = c/a
|
|
844
831
|
elif inputMode == 2:
|
|
845
|
-
# origin, c, e, sides, fromAngle, toAngle, close, dirX, dirY, dirZ = item
|
|
846
832
|
c = focalLength
|
|
847
833
|
e = eccentricity
|
|
848
834
|
a = c/e
|
|
@@ -850,7 +836,6 @@ class Wire(topologic.Wire):
|
|
|
850
836
|
w = a*2
|
|
851
837
|
l = b*2
|
|
852
838
|
elif inputMode == 3:
|
|
853
|
-
# origin, c, b, sides, fromAngle, toAngle, close, dirX, dirY, dirZ = item
|
|
854
839
|
c = focalLength
|
|
855
840
|
b = minorAxisLength
|
|
856
841
|
a = math.sqrt(abs(b**2 + c**2))
|
|
@@ -858,7 +843,6 @@ class Wire(topologic.Wire):
|
|
|
858
843
|
w = a*2
|
|
859
844
|
l = b*2
|
|
860
845
|
elif inputMode == 4:
|
|
861
|
-
# origin, a, b, sides, fromAngle, toAngle, close, dirX, dirY, dirZ = item
|
|
862
846
|
a = majorAxisLength
|
|
863
847
|
b = minorAxisLength
|
|
864
848
|
c = math.sqrt(abs(b**2 - a**2))
|
|
@@ -896,9 +880,9 @@ class Wire(topologic.Wire):
|
|
|
896
880
|
x1 = origin.X()
|
|
897
881
|
y1 = origin.Y()
|
|
898
882
|
z1 = origin.Z()
|
|
899
|
-
x2 = origin.X() +
|
|
900
|
-
y2 = origin.Y() +
|
|
901
|
-
z2 = origin.Z() +
|
|
883
|
+
x2 = origin.X() + direction[0]
|
|
884
|
+
y2 = origin.Y() + direction[1]
|
|
885
|
+
z2 = origin.Z() + direction[2]
|
|
902
886
|
dx = x2 - x1
|
|
903
887
|
dy = y2 - y1
|
|
904
888
|
dz = z2 - z1
|
|
@@ -1289,7 +1273,7 @@ class Wire(topologic.Wire):
|
|
|
1289
1273
|
return w
|
|
1290
1274
|
|
|
1291
1275
|
@staticmethod
|
|
1292
|
-
def Rectangle(origin=None, width=1.0, length=1.0,
|
|
1276
|
+
def Rectangle(origin=None, width=1.0, length=1.0, direction=[0,0,1], placement="center", tolerance=0.0001):
|
|
1293
1277
|
"""
|
|
1294
1278
|
Creates a rectangle.
|
|
1295
1279
|
|
|
@@ -1301,12 +1285,8 @@ class Wire(topologic.Wire):
|
|
|
1301
1285
|
The width of the rectangle. The default is 1.0.
|
|
1302
1286
|
length : float , optional
|
|
1303
1287
|
The length of the rectangle. The default is 1.0.
|
|
1304
|
-
|
|
1305
|
-
The
|
|
1306
|
-
dirY : float , optional
|
|
1307
|
-
The Y component of the vector representing the up direction of the rectangle. The default is 0.
|
|
1308
|
-
dirZ : float , optional
|
|
1309
|
-
The Z component of the vector representing the up direction of the rectangle. The default is 1.
|
|
1288
|
+
direction : list , optional
|
|
1289
|
+
The ector representing the up direction of the rectangle. The default is [0,0,1].
|
|
1310
1290
|
placement : str , optional
|
|
1311
1291
|
The description of the placement of the origin of the rectangle. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
|
|
1312
1292
|
tolerance : float , optional
|
|
@@ -1330,7 +1310,7 @@ class Wire(topologic.Wire):
|
|
|
1330
1310
|
length = abs(length)
|
|
1331
1311
|
if width < tolerance or length < tolerance:
|
|
1332
1312
|
return None
|
|
1333
|
-
if (abs(
|
|
1313
|
+
if (abs(direction[0]) + abs(direction[1]) + abs(direction[2])) < tolerance:
|
|
1334
1314
|
return None
|
|
1335
1315
|
xOffset = 0
|
|
1336
1316
|
yOffset = 0
|
|
@@ -1347,9 +1327,9 @@ class Wire(topologic.Wire):
|
|
|
1347
1327
|
x1 = origin.X()
|
|
1348
1328
|
y1 = origin.Y()
|
|
1349
1329
|
z1 = origin.Z()
|
|
1350
|
-
x2 = origin.X() +
|
|
1351
|
-
y2 = origin.Y() +
|
|
1352
|
-
z2 = origin.Z() +
|
|
1330
|
+
x2 = origin.X() + direction[0]
|
|
1331
|
+
y2 = origin.Y() + direction[1]
|
|
1332
|
+
z2 = origin.Z() + direction[2]
|
|
1353
1333
|
dx = x2 - x1
|
|
1354
1334
|
dy = y2 - y1
|
|
1355
1335
|
dz = z2 - z1
|
|
@@ -1521,7 +1501,7 @@ class Wire(topologic.Wire):
|
|
|
1521
1501
|
|
|
1522
1502
|
|
|
1523
1503
|
@staticmethod
|
|
1524
|
-
def Star(origin=None, radiusA=1.0, radiusB=0.4, rays=5,
|
|
1504
|
+
def Star(origin=None, radiusA=1.0, radiusB=0.4, rays=5, direction=[0,0,1], placement="center", tolerance=0.0001):
|
|
1525
1505
|
"""
|
|
1526
1506
|
Creates a star.
|
|
1527
1507
|
|
|
@@ -1535,12 +1515,8 @@ class Wire(topologic.Wire):
|
|
|
1535
1515
|
The outer radius of the star. The default is 0.4.
|
|
1536
1516
|
rays : int , optional
|
|
1537
1517
|
The number of star rays. The default is 5.
|
|
1538
|
-
|
|
1539
|
-
The
|
|
1540
|
-
dirY : float , optional
|
|
1541
|
-
The Y component of the vector representing the up direction of the star. The default is 0.
|
|
1542
|
-
dirZ : float , optional
|
|
1543
|
-
The Z component of the vector representing the up direction of the star. The default is 1.
|
|
1518
|
+
direction : list , optional
|
|
1519
|
+
The vector representing the up direction of the star. The default is [0,0,1].
|
|
1544
1520
|
placement : str , optional
|
|
1545
1521
|
The description of the placement of the origin of the star. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
|
|
1546
1522
|
tolerance : float , optional
|
|
@@ -1601,9 +1577,9 @@ class Wire(topologic.Wire):
|
|
|
1601
1577
|
x1 = origin.X()
|
|
1602
1578
|
y1 = origin.Y()
|
|
1603
1579
|
z1 = origin.Z()
|
|
1604
|
-
x2 = origin.X() +
|
|
1605
|
-
y2 = origin.Y() +
|
|
1606
|
-
z2 = origin.Z() +
|
|
1580
|
+
x2 = origin.X() + direction[0]
|
|
1581
|
+
y2 = origin.Y() + direction[1]
|
|
1582
|
+
z2 = origin.Z() + direction[2]
|
|
1607
1583
|
dx = x2 - x1
|
|
1608
1584
|
dy = y2 - y1
|
|
1609
1585
|
dz = z2 - z1
|
|
@@ -1619,7 +1595,7 @@ class Wire(topologic.Wire):
|
|
|
1619
1595
|
|
|
1620
1596
|
|
|
1621
1597
|
@staticmethod
|
|
1622
|
-
def Trapezoid(origin=None, widthA=1.0, widthB=0.75, offsetA=0.0, offsetB=0.0, length=1.0,
|
|
1598
|
+
def Trapezoid(origin=None, widthA=1.0, widthB=0.75, offsetA=0.0, offsetB=0.0, length=1.0, direction=[0,0,1], placement="center", tolerance=0.0001):
|
|
1623
1599
|
"""
|
|
1624
1600
|
Creates a trapezoid.
|
|
1625
1601
|
|
|
@@ -1637,12 +1613,8 @@ class Wire(topologic.Wire):
|
|
|
1637
1613
|
The offset of the top edge of the trapezoid. The default is 0.0.
|
|
1638
1614
|
length : float , optional
|
|
1639
1615
|
The length of the trapezoid. The default is 1.0.
|
|
1640
|
-
|
|
1641
|
-
The
|
|
1642
|
-
dirY : float , optional
|
|
1643
|
-
The Y component of the vector representing the up direction of the trapezoid. The default is 0.
|
|
1644
|
-
dirZ : float , optional
|
|
1645
|
-
The Z component of the vector representing the up direction of the trapezoid. The default is 1.
|
|
1616
|
+
direction : list , optional
|
|
1617
|
+
The vector representing the up direction of the trapezoid. The default is [0,0,1].
|
|
1646
1618
|
placement : str , optional
|
|
1647
1619
|
The description of the placement of the origin of the trapezoid. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
|
|
1648
1620
|
tolerance : float , optional
|
|
@@ -1683,9 +1655,9 @@ class Wire(topologic.Wire):
|
|
|
1683
1655
|
x1 = origin.X()
|
|
1684
1656
|
y1 = origin.Y()
|
|
1685
1657
|
z1 = origin.Z()
|
|
1686
|
-
x2 = origin.X() +
|
|
1687
|
-
y2 = origin.Y() +
|
|
1688
|
-
z2 = origin.Z() +
|
|
1658
|
+
x2 = origin.X() + direction[0]
|
|
1659
|
+
y2 = origin.Y() + direction[1]
|
|
1660
|
+
z2 = origin.Z() + direction[2]
|
|
1689
1661
|
dx = x2 - x1
|
|
1690
1662
|
dy = y2 - y1
|
|
1691
1663
|
dz = z2 - z1
|
topologicpy/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: topologicpy
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: An Advanced Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
|
|
5
5
|
Author-email: Wassim Jabi <wassim.jabi@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/wassimj/TopologicPy
|
|
@@ -12,6 +12,8 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Requires-Python: >=3.8
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
+
Requires-Dist: honeybee-energy
|
|
16
|
+
Requires-Dist: honeybee-radiance
|
|
15
17
|
Requires-Dist: ifcopenshell
|
|
16
18
|
Requires-Dist: plotly
|
|
17
19
|
Requires-Dist: numpy
|