-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
COCKATOO_CreateFinalNetworkTopology.py
62 lines (47 loc) · 2.05 KB
/
COCKATOO_CreateFinalNetworkTopology.py
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
"""
Create the final network topology by sampling the previously generated courses
with the stitch width and creating all final 'weft' and 'warp' edges using a
previously generated mapping network.
TODO: Update docstring!
Inputs:
Toggle: Set to true to activate {item, boolean}
KnitNetwork: An initialized KnitNetwork. {item, KnitNetwork}
Output:
MappingNetwork: The KnitNetwork with 'weft' connections created. {item, polyline}
Remarks:
Author: Max Eschenbach
License: Apache License 2.0
Version: 200414
"""
# PYTHON STANDARD LIBRARY IMPORTS
from __future__ import division
# GPYTHON SDK IMPORTS
from ghpythonlib.componentbase import executingcomponent as component
import Grasshopper, GhPython
import System
import Rhino
import rhinoscriptsyntax as rs
# LOCAL MODULE IMPORTS
import Cockatoo
# GHENV COMPONENT SETTINGS
ghenv.Component.Name = "CreateFinalNetworkTopology"
ghenv.Component.NickName ="CFNT"
ghenv.Component.Category = "COCKATOO"
ghenv.Component.SubCategory = "6 KnitNetwork"
class CreateFinalNetworkTopology(component):
def RunScript(self, Toggle, KN, StitchWidth, IncludeEnds=True):
if Toggle and KN and StitchWidth:
KN = Cockatoo.KnitNetwork(KN)
# SAMPLING OF SEGMENT CONTOURS -------------------------------------
KN.SampleSegmentContours(StitchWidth)
# CREATION OF FINAL WEFT CONNECTIONS -------------------------------
KN.CreateFinalWeftConnections()
# CREATION OF WARP CONNECTIONS -------------------------------------
KN.CreateFinalWarpConnections(max_connections=4,
include_end_nodes=IncludeEnds,
precise=False,
verbose=False)
else:
KN = Grasshopper.DataTree[object]()
# return outputs if you have them; here I try it for you:
return KN