topologicpy 0.7.52__py3-none-any.whl → 0.7.55__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 +1 -6
- topologicpy/CellComplex.py +1 -6
- topologicpy/EnergyModel.py +6 -8
- topologicpy/Face.py +15 -4
- topologicpy/Graph.py +120 -72
- topologicpy/Honeybee.py +2 -3
- topologicpy/PyG.py +6 -1
- topologicpy/Topology.py +21 -489
- topologicpy/Wire.py +31 -47
- topologicpy/version.py +1 -1
- {topologicpy-0.7.52.dist-info → topologicpy-0.7.55.dist-info}/METADATA +1 -1
- {topologicpy-0.7.52.dist-info → topologicpy-0.7.55.dist-info}/RECORD +15 -15
- {topologicpy-0.7.52.dist-info → topologicpy-0.7.55.dist-info}/WHEEL +1 -1
- {topologicpy-0.7.52.dist-info → topologicpy-0.7.55.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.52.dist-info → topologicpy-0.7.55.dist-info}/top_level.txt +0 -0
topologicpy/Graph.py
CHANGED
@@ -2382,6 +2382,7 @@ class Graph:
|
|
2382
2382
|
toOutposts: bool = False,
|
2383
2383
|
idKey: str = "TOPOLOGIC_ID",
|
2384
2384
|
outpostsKey: str = "outposts",
|
2385
|
+
nodeTypeKey: str = "node_type",
|
2385
2386
|
useInternalVertex: bool =True,
|
2386
2387
|
storeBREP: bool =False,
|
2387
2388
|
mantissa: int = 6,
|
@@ -2413,6 +2414,16 @@ class Graph:
|
|
2413
2414
|
The key to use to find outpost by ID. It is case insensitive. The default is "TOPOLOGIC_ID".
|
2414
2415
|
outpostsKey : str , optional
|
2415
2416
|
The key to use to find the list of outposts. It is case insensitive. The default is "outposts".
|
2417
|
+
nodeTypeKey : str , optional
|
2418
|
+
The key under which to store the node type. Node types are:
|
2419
|
+
0 : main topology
|
2420
|
+
1 : shared topology
|
2421
|
+
2 : shared aperture
|
2422
|
+
3 : exterior topology
|
2423
|
+
4 : exterior aperture
|
2424
|
+
5 : content
|
2425
|
+
6 : outpost
|
2426
|
+
The default is "node_type".
|
2416
2427
|
useInternalVertex : bool , optional
|
2417
2428
|
If set to True, use an internal vertex to represent the subtopology. Otherwise, use its centroid. The default is False.
|
2418
2429
|
storeBREP : bool , optional
|
@@ -2592,8 +2603,7 @@ class Graph:
|
|
2592
2603
|
if len(sharedt) > 0:
|
2593
2604
|
apertureExists = False
|
2594
2605
|
for x in sharedt:
|
2595
|
-
apList =
|
2596
|
-
_ = x.Apertures(apList)
|
2606
|
+
apList = Topology.Apertures(x)
|
2597
2607
|
if len(apList) > 0:
|
2598
2608
|
apTopList = []
|
2599
2609
|
for ap in apList:
|
@@ -2635,13 +2645,23 @@ class Graph:
|
|
2635
2645
|
vop = Topology.CenterOfMass(outpost)
|
2636
2646
|
vcc = Topology.CenterOfMass(topology)
|
2637
2647
|
d1 = Topology.Dictionary(vcc)
|
2648
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 0) # main topology
|
2638
2649
|
if storeBREP:
|
2639
2650
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(topology), Topology.Type(topology), Topology.TypeAsString(topology)])
|
2640
2651
|
d3 = mergeDictionaries2([d1, d2])
|
2641
2652
|
_ = vcc.SetDictionary(d3)
|
2642
2653
|
else:
|
2643
2654
|
_ = vcc.SetDictionary(d1)
|
2655
|
+
d1 = Topology.Dictionary(vop)
|
2656
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 6) # outpost
|
2657
|
+
if storeBREP:
|
2658
|
+
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(outpost), Topology.Type(outpost), Topology.TypeAsString(outpost)])
|
2659
|
+
d3 = mergeDictionaries2([d1, d2])
|
2660
|
+
_ = vop.SetDictionary(d3)
|
2661
|
+
else:
|
2662
|
+
_ = vop.SetDictionary(d1)
|
2644
2663
|
vertices.append(vcc)
|
2664
|
+
vertices.append(vop)
|
2645
2665
|
tempe = Edge.ByStartVertexEndVertex(vcc, vop, tolerance=tolerance)
|
2646
2666
|
tempd = Dictionary.ByKeysValues(["relationship"],["To Outposts"])
|
2647
2667
|
_ = tempe.SetDictionary(tempd)
|
@@ -2655,14 +2675,6 @@ class Graph:
|
|
2655
2675
|
vCell = Topology.InternalVertex(aCell, tolerance=tolerance)
|
2656
2676
|
else:
|
2657
2677
|
vCell = aCell.CenterOfMass()
|
2658
|
-
d1 = aCell.GetDictionary()
|
2659
|
-
if storeBREP:
|
2660
|
-
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(aCell), Topology.Type(aCell), Topology.TypeAsString(aCell)])
|
2661
|
-
d3 = mergeDictionaries2([d1, d2])
|
2662
|
-
_ = vCell.SetDictionary(d3)
|
2663
|
-
else:
|
2664
|
-
_ = vCell.SetDictionary(d1)
|
2665
|
-
vertices.append(vCell)
|
2666
2678
|
faces = []
|
2667
2679
|
_ = aCell.Faces(None, faces)
|
2668
2680
|
sharedTopologies = []
|
@@ -2676,14 +2688,12 @@ class Graph:
|
|
2676
2688
|
_ = aFace.Cells(topology, cells1)
|
2677
2689
|
if len(cells1) > 1:
|
2678
2690
|
sharedTopologies.append(aFace)
|
2679
|
-
apertures =
|
2680
|
-
_ = aFace.Apertures(apertures)
|
2691
|
+
apertures = Topology.Apertures(aFace)
|
2681
2692
|
for anAperture in apertures:
|
2682
2693
|
sharedApertures.append(anAperture)
|
2683
2694
|
else:
|
2684
2695
|
exteriorTopologies.append(aFace)
|
2685
|
-
apertures =
|
2686
|
-
_ = aFace.Apertures(apertures)
|
2696
|
+
apertures = Topology.Apertures(aFace)
|
2687
2697
|
for anAperture in apertures:
|
2688
2698
|
exteriorApertures.append(anAperture)
|
2689
2699
|
|
@@ -2694,6 +2704,7 @@ class Graph:
|
|
2694
2704
|
else:
|
2695
2705
|
vst = sharedTopology.CenterOfMass()
|
2696
2706
|
d1 = sharedTopology.GetDictionary()
|
2707
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 1) # shared topology
|
2697
2708
|
if storeBREP:
|
2698
2709
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(sharedTopology), Topology.Type(sharedTopology), Topology.TypeAsString(sharedTopology)])
|
2699
2710
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -2716,6 +2727,7 @@ class Graph:
|
|
2716
2727
|
else:
|
2717
2728
|
vst2 = content.CenterOfMass()
|
2718
2729
|
d1 = content.GetDictionary()
|
2730
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
2719
2731
|
vst2 = Vertex.ByCoordinates(Vertex.X(vst2, mantissa=mantissa), Vertex.Y(vst2, mantissa=mantissa), Vertex.Z(vst2, mantissa=mantissa))
|
2720
2732
|
if storeBREP:
|
2721
2733
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
@@ -2729,13 +2741,13 @@ class Graph:
|
|
2729
2741
|
_ = tempe.SetDictionary(tempd)
|
2730
2742
|
edges.append(tempe)
|
2731
2743
|
if viaSharedApertures:
|
2732
|
-
for
|
2733
|
-
sharedAp = sharedAperture.Topology()
|
2744
|
+
for sharedAp in sharedApertures:
|
2734
2745
|
if useInternalVertex == True:
|
2735
2746
|
vsa = Topology.InternalVertex(sharedAp, tolerance)
|
2736
2747
|
else:
|
2737
2748
|
vsa = sharedAp.CenterOfMass()
|
2738
2749
|
d1 = sharedAp.GetDictionary()
|
2750
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 2) # shared aperture
|
2739
2751
|
vsa = Vertex.ByCoordinates(Vertex.X(vsa, mantissa=mantissa)+(tolerance*100), Vertex.Y(vsa, mantissa=mantissa)+(tolerance*100), Vertex.Z(vsa, mantissa=mantissa)+(tolerance*100))
|
2740
2752
|
if storeBREP:
|
2741
2753
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(sharedAp), Topology.Type(sharedAp), Topology.TypeAsString(sharedAp)])
|
@@ -2756,6 +2768,7 @@ class Graph:
|
|
2756
2768
|
vet = exteriorTopology.CenterOfMass()
|
2757
2769
|
_ = vet.SetDictionary(exteriorTopology.GetDictionary())
|
2758
2770
|
d1 = exteriorTopology.GetDictionary()
|
2771
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 3) # exterior topology
|
2759
2772
|
if storeBREP:
|
2760
2773
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exteriorTopology), Topology.Type(exteriorTopology), Topology.TypeAsString(exteriorTopology)])
|
2761
2774
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -2778,6 +2791,7 @@ class Graph:
|
|
2778
2791
|
else:
|
2779
2792
|
vst2 = content.CenterOfMass()
|
2780
2793
|
d1 = content.GetDictionary()
|
2794
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
2781
2795
|
vst2 = Vertex.ByCoordinates(Vertex.X(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst2, mantissa=mantissa)+(tolerance*100))
|
2782
2796
|
if storeBREP:
|
2783
2797
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
@@ -2791,13 +2805,13 @@ class Graph:
|
|
2791
2805
|
_ = tempe.SetDictionary(tempd)
|
2792
2806
|
edges.append(tempe)
|
2793
2807
|
if toExteriorApertures:
|
2794
|
-
for
|
2795
|
-
exTop = exteriorAperture.Topology()
|
2808
|
+
for exTop in exteriorApertures:
|
2796
2809
|
if useInternalVertex == True:
|
2797
2810
|
vea = Topology.InternalVertex(exTop, tolerance)
|
2798
2811
|
else:
|
2799
2812
|
vea = exTop.CenterOfMass()
|
2800
2813
|
d1 = exTop.GetDictionary()
|
2814
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 4) # exterior aperture
|
2801
2815
|
vea = Vertex.ByCoordinates(Vertex.X(vea, mantissa=mantissa)+(tolerance*100), Vertex.Y(vea, mantissa=mantissa)+(tolerance*100), Vertex.Z(vea, mantissa=mantissa)+(tolerance*100))
|
2802
2816
|
if storeBREP:
|
2803
2817
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exTop), Topology.Type(exTop), Topology.TypeAsString(exTop)])
|
@@ -2822,6 +2836,7 @@ class Graph:
|
|
2822
2836
|
vcn = content.CenterOfMass()
|
2823
2837
|
vcn = Vertex.ByCoordinates(Vertex.X(vcn, mantissa=mantissa)+(tolerance*100), Vertex.Y(vcn, mantissa=mantissa)+(tolerance*100), Vertex.Z(vcn, mantissa=mantissa)+(tolerance*100))
|
2824
2838
|
d1 = content.GetDictionary()
|
2839
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
2825
2840
|
if storeBREP:
|
2826
2841
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
2827
2842
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -2840,6 +2855,7 @@ class Graph:
|
|
2840
2855
|
else:
|
2841
2856
|
vCell = aCell.CenterOfMass()
|
2842
2857
|
d1 = aCell.GetDictionary()
|
2858
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 0) # main topology
|
2843
2859
|
if storeBREP:
|
2844
2860
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(aCell), Topology.Type(aCell), Topology.TypeAsString(aCell)])
|
2845
2861
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -2858,6 +2874,7 @@ class Graph:
|
|
2858
2874
|
else:
|
2859
2875
|
vCell = topology.CenterOfMass()
|
2860
2876
|
d1 = topology.GetDictionary()
|
2877
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 0) # main topology
|
2861
2878
|
if storeBREP:
|
2862
2879
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(topology), Topology.Type(topology), Topology.TypeAsString(topology)])
|
2863
2880
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -2889,6 +2906,15 @@ class Graph:
|
|
2889
2906
|
tempd = Dictionary.ByKeysValues(["relationship"],["To Outposts"])
|
2890
2907
|
_ = tempe.SetDictionary(tempd)
|
2891
2908
|
edges.append(tempe)
|
2909
|
+
d1 = outpost.GetDictionary()
|
2910
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 6) # outpost
|
2911
|
+
if storeBREP:
|
2912
|
+
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(outpost), Topology.Type(outpost), Topology.TypeAsString(outpost)])
|
2913
|
+
d3 = mergeDictionaries2([d1, d2])
|
2914
|
+
_ = vop.SetDictionary(d3)
|
2915
|
+
else:
|
2916
|
+
_ = vop.SetDictionary(d1)
|
2917
|
+
vertices.append(vop)
|
2892
2918
|
if any([toExteriorTopologies, toExteriorApertures, toContents]):
|
2893
2919
|
faces = Topology.Faces(topology)
|
2894
2920
|
exteriorTopologies = []
|
@@ -2905,6 +2931,8 @@ class Graph:
|
|
2905
2931
|
else:
|
2906
2932
|
vst = exteriorTopology.CenterOfMass()
|
2907
2933
|
d1 = exteriorTopology.GetDictionary()
|
2934
|
+
d1 = topology.GetDictionary()
|
2935
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 3) # exterior topology
|
2908
2936
|
if storeBREP:
|
2909
2937
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exteriorTopology), Topology.Type(exteriorTopology), Topology.TypeAsString(exteriorTopology)])
|
2910
2938
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -2928,6 +2956,7 @@ class Graph:
|
|
2928
2956
|
vst2 = content.CenterOfMass()
|
2929
2957
|
vst2 = Vertex.ByCoordinates(Vertex.X(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst2, mantissa=mantissa)+(tolerance*100))
|
2930
2958
|
d1 = content.GetDictionary()
|
2959
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
2931
2960
|
if storeBREP:
|
2932
2961
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
2933
2962
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -2940,13 +2969,13 @@ class Graph:
|
|
2940
2969
|
_ = tempe.SetDictionary(tempd)
|
2941
2970
|
edges.append(tempe)
|
2942
2971
|
if toExteriorApertures:
|
2943
|
-
for
|
2944
|
-
exTop = exteriorAperture.Topology()
|
2972
|
+
for exTop in exteriorApertures:
|
2945
2973
|
if useInternalVertex == True:
|
2946
2974
|
vst = Topology.InternalVertex(exTop, tolerance)
|
2947
2975
|
else:
|
2948
2976
|
vst = exTop.CenterOfMass()
|
2949
2977
|
d1 = exTop.GetDictionary()
|
2978
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 4) # exterior aperture
|
2950
2979
|
vst = Vertex.ByCoordinates(Vertex.X(vst, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst, mantissa=mantissa)+(tolerance*100))
|
2951
2980
|
if storeBREP:
|
2952
2981
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exTop), Topology.Type(exTop), Topology.TypeAsString(exTop)])
|
@@ -2971,6 +3000,7 @@ class Graph:
|
|
2971
3000
|
vst = content.CenterOfMass()
|
2972
3001
|
vst = Vertex.ByCoordinates(Vertex.X(vst, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst, mantissa=mantissa)+(tolerance*100))
|
2973
3002
|
d1 = content.GetDictionary()
|
3003
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
2974
3004
|
if storeBREP:
|
2975
3005
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
2976
3006
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -2985,9 +3015,7 @@ class Graph:
|
|
2985
3015
|
return [vertices, edges]
|
2986
3016
|
|
2987
3017
|
def processShell(item):
|
2988
|
-
from topologicpy.Face import Face
|
2989
3018
|
topology, others, outpostsKey, idKey, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, toOutposts, useInternalVertex, storeBREP, tolerance = item
|
2990
|
-
graph = None
|
2991
3019
|
edges = []
|
2992
3020
|
vertices = []
|
2993
3021
|
facemat = []
|
@@ -3044,15 +3072,11 @@ class Graph:
|
|
3044
3072
|
if len(sharedt) > 0:
|
3045
3073
|
apertureExists = False
|
3046
3074
|
for x in sharedt:
|
3047
|
-
apList =
|
3048
|
-
_ = x.Apertures(apList)
|
3075
|
+
apList = Topology.Apertures(x)
|
3049
3076
|
if len(apList) > 0:
|
3050
3077
|
apertureExists = True
|
3051
3078
|
break
|
3052
3079
|
if apertureExists:
|
3053
|
-
apTopList = []
|
3054
|
-
for ap in apList:
|
3055
|
-
apTopList.append(ap.Topology())
|
3056
3080
|
if useInternalVertex == True:
|
3057
3081
|
v1 = Topology.InternalVertex(topFaces[i], tolerance=tolerance)
|
3058
3082
|
v2 = Topology.InternalVertex(topFaces[j], tolerance=tolerance)
|
@@ -3060,7 +3084,7 @@ class Graph:
|
|
3060
3084
|
v1 = topFaces[i].CenterOfMass()
|
3061
3085
|
v2 = topFaces[j].CenterOfMass()
|
3062
3086
|
e = Edge.ByStartVertexEndVertex(v1, v2, tolerance=tolerance)
|
3063
|
-
mDict = mergeDictionaries(
|
3087
|
+
mDict = mergeDictionaries(apList)
|
3064
3088
|
if mDict:
|
3065
3089
|
e.SetDictionary(mDict)
|
3066
3090
|
edges.append(e)
|
@@ -3074,7 +3098,6 @@ class Graph:
|
|
3074
3098
|
else:
|
3075
3099
|
vFace = aFace.CenterOfMass()
|
3076
3100
|
_ = vFace.SetDictionary(aFace.GetDictionary())
|
3077
|
-
vertices.append(vFace)
|
3078
3101
|
fEdges = []
|
3079
3102
|
_ = aFace.Edges(None, fEdges)
|
3080
3103
|
sharedTopologies = []
|
@@ -3086,14 +3109,12 @@ class Graph:
|
|
3086
3109
|
_ = anEdge.Faces(topology, faces)
|
3087
3110
|
if len(faces) > 1:
|
3088
3111
|
sharedTopologies.append(anEdge)
|
3089
|
-
apertures =
|
3090
|
-
_ = anEdge.Apertures(apertures)
|
3112
|
+
apertures = Topology.Apertures(anEdge)
|
3091
3113
|
for anAperture in apertures:
|
3092
3114
|
sharedApertures.append(anAperture)
|
3093
3115
|
else:
|
3094
3116
|
exteriorTopologies.append(anEdge)
|
3095
|
-
apertures =
|
3096
|
-
_ = anEdge.Apertures(apertures)
|
3117
|
+
apertures = Topology.Apertures(anEdge)
|
3097
3118
|
for anAperture in apertures:
|
3098
3119
|
exteriorApertures.append(anAperture)
|
3099
3120
|
if viaSharedTopologies:
|
@@ -3103,6 +3124,7 @@ class Graph:
|
|
3103
3124
|
else:
|
3104
3125
|
vst = sharedTopology.CenterOfMass()
|
3105
3126
|
d1 = sharedTopology.GetDictionary()
|
3127
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 1) # shared topology
|
3106
3128
|
if storeBREP:
|
3107
3129
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(sharedTopology), Topology.Type(sharedTopology), Topology.TypeAsString(sharedTopology)])
|
3108
3130
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3126,6 +3148,7 @@ class Graph:
|
|
3126
3148
|
vst2 = content.CenterOfMass()
|
3127
3149
|
vst2 = Vertex.ByCoordinates(Vertex.X(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst2, mantissa=mantissa)+(tolerance*100))
|
3128
3150
|
d1 = content.GetDictionary()
|
3151
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
3129
3152
|
if storeBREP:
|
3130
3153
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
3131
3154
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3138,13 +3161,13 @@ class Graph:
|
|
3138
3161
|
_ = tempe.SetDictionary(tempd)
|
3139
3162
|
edges.append(tempe)
|
3140
3163
|
if viaSharedApertures:
|
3141
|
-
for
|
3142
|
-
sharedAp = Aperture.Topology(sharedAperture)
|
3164
|
+
for sharedAp in sharedApertures:
|
3143
3165
|
if useInternalVertex == True:
|
3144
3166
|
vst = Topology.InternalVertex(sharedAp, tolerance)
|
3145
3167
|
else:
|
3146
3168
|
vst = sharedAp.CenterOfMass()
|
3147
3169
|
d1 = sharedAp.GetDictionary()
|
3170
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 2) # shared aperture
|
3148
3171
|
vst = Vertex.ByCoordinates(Vertex.X(vst, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst, mantissa=mantissa)+(tolerance*100))
|
3149
3172
|
if storeBREP:
|
3150
3173
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(sharedAp), Topology.Type(sharedAp), Topology.TypeAsString(sharedAp)])
|
@@ -3164,6 +3187,7 @@ class Graph:
|
|
3164
3187
|
else:
|
3165
3188
|
vst = exteriorTopology.CenterOfMass()
|
3166
3189
|
d1 = exteriorTopology.GetDictionary()
|
3190
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 3) # exterior topology
|
3167
3191
|
if storeBREP:
|
3168
3192
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exteriorTopology), Topology.Type(exteriorTopology), Topology.TypeAsString(exteriorTopology)])
|
3169
3193
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3187,6 +3211,7 @@ class Graph:
|
|
3187
3211
|
vst2 = content.CenterOfMass()
|
3188
3212
|
vst2 = Vertex.ByCoordinates(Vertex.X(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst2, mantissa=mantissa)+(tolerance*100))
|
3189
3213
|
d1 = content.GetDictionary()
|
3214
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
3190
3215
|
if storeBREP:
|
3191
3216
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
3192
3217
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3199,13 +3224,13 @@ class Graph:
|
|
3199
3224
|
_ = tempe.SetDictionary(tempd)
|
3200
3225
|
edges.append(tempe)
|
3201
3226
|
if toExteriorApertures:
|
3202
|
-
for
|
3203
|
-
exTop = exteriorAperture.Topology()
|
3227
|
+
for exTop in exteriorApertures:
|
3204
3228
|
if useInternalVertex == True:
|
3205
3229
|
vst = Topology.InternalVertex(exTop, tolerance)
|
3206
3230
|
else:
|
3207
3231
|
vst = exTop.CenterOfMass()
|
3208
3232
|
d1 = exTop.GetDictionary()
|
3233
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 4) # exterior aperture
|
3209
3234
|
vst = Vertex.ByCoordinates(Vertex.X(vst, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst, mantissa=mantissa)+(tolerance*100))
|
3210
3235
|
if storeBREP:
|
3211
3236
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exTop), Topology.Type(exTop), Topology.TypeAsString(exTop)])
|
@@ -3230,6 +3255,7 @@ class Graph:
|
|
3230
3255
|
vst = content.CenterOfMass()
|
3231
3256
|
vst = Vertex.ByCoordinates(Vertex.X(vst, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst, mantissa=mantissa)+(tolerance*100))
|
3232
3257
|
d1 = content.GetDictionary()
|
3258
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
3233
3259
|
if storeBREP:
|
3234
3260
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
3235
3261
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3248,6 +3274,7 @@ class Graph:
|
|
3248
3274
|
else:
|
3249
3275
|
vFace = aFace.CenterOfMass()
|
3250
3276
|
d1 = aFace.GetDictionary()
|
3277
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 0) # main topology
|
3251
3278
|
if storeBREP:
|
3252
3279
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(aFace), Topology.Type(aFace), Topology.TypeAsString(aFace)])
|
3253
3280
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3278,6 +3305,7 @@ class Graph:
|
|
3278
3305
|
vop = Topology.CenterOfMass(outpost)
|
3279
3306
|
vcc = Topology.CenterOfMass(topology)
|
3280
3307
|
d1 = Topology.Dictionary(vcc)
|
3308
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 0) # main topology
|
3281
3309
|
if storeBREP:
|
3282
3310
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(topology), Topology.Type(topology), Topology.TypeAsString(topology)])
|
3283
3311
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3285,6 +3313,15 @@ class Graph:
|
|
3285
3313
|
else:
|
3286
3314
|
_ = vcc.SetDictionary(d1)
|
3287
3315
|
vertices.append(vcc)
|
3316
|
+
d1 = Topology.Dictionary(vop)
|
3317
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 6) # outpost
|
3318
|
+
if storeBREP:
|
3319
|
+
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(topology), Topology.Type(topology), Topology.TypeAsString(topology)])
|
3320
|
+
d3 = mergeDictionaries2([d1, d2])
|
3321
|
+
_ = vop.SetDictionary(d3)
|
3322
|
+
else:
|
3323
|
+
_ = vop.SetDictionary(d1)
|
3324
|
+
vertices.append(vcc)
|
3288
3325
|
tempe = Edge.ByStartVertexEndVertex(vcc, vop, tolerance=tolerance)
|
3289
3326
|
tempd = Dictionary.ByKeysValues(["relationship"],["To Outposts"])
|
3290
3327
|
_ = tempe.SetDictionary(tempd)
|
@@ -3292,9 +3329,7 @@ class Graph:
|
|
3292
3329
|
return [vertices, edges]
|
3293
3330
|
|
3294
3331
|
def processFace(item):
|
3295
|
-
from topologicpy.Face import Face
|
3296
3332
|
topology, others, outpostsKey, idKey, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, toOutposts, useInternalVertex, storeBREP, tolerance = item
|
3297
|
-
graph = None
|
3298
3333
|
vertices = []
|
3299
3334
|
edges = []
|
3300
3335
|
|
@@ -3303,6 +3338,7 @@ class Graph:
|
|
3303
3338
|
else:
|
3304
3339
|
vFace = topology.CenterOfMass()
|
3305
3340
|
d1 = topology.GetDictionary()
|
3341
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 0) # main topology
|
3306
3342
|
if storeBREP:
|
3307
3343
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(topology), Topology.Type(topology), Topology.TypeAsString(topology)])
|
3308
3344
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3342,8 +3378,7 @@ class Graph:
|
|
3342
3378
|
|
3343
3379
|
for anEdge in fEdges:
|
3344
3380
|
exteriorTopologies.append(anEdge)
|
3345
|
-
apertures =
|
3346
|
-
_ = anEdge.Apertures(apertures)
|
3381
|
+
apertures = Topology.Apertures(anEdge)
|
3347
3382
|
for anAperture in apertures:
|
3348
3383
|
exteriorApertures.append(anAperture)
|
3349
3384
|
if toExteriorTopologies:
|
@@ -3353,6 +3388,7 @@ class Graph:
|
|
3353
3388
|
else:
|
3354
3389
|
vst = exteriorTopology.CenterOfMass()
|
3355
3390
|
d1 = exteriorTopology.GetDictionary()
|
3391
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 3) # exterior topology
|
3356
3392
|
if storeBREP:
|
3357
3393
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exteriorTopology), Topology.Type(exteriorTopology), Topology.TypeAsString(exteriorTopology)])
|
3358
3394
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3376,6 +3412,7 @@ class Graph:
|
|
3376
3412
|
vst2 = content.CenterOfMass()
|
3377
3413
|
vst2 = Vertex.ByCoordinates(Vertex.X(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst2, mantissa=mantissa)+(tolerance*100))
|
3378
3414
|
d1 = content.GetDictionary()
|
3415
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
3379
3416
|
if storeBREP:
|
3380
3417
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
3381
3418
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3388,13 +3425,13 @@ class Graph:
|
|
3388
3425
|
_ = tempe.SetDictionary(tempd)
|
3389
3426
|
edges.append(tempe)
|
3390
3427
|
if toExteriorApertures:
|
3391
|
-
for
|
3392
|
-
exTop = exteriorAperture.Topology()
|
3428
|
+
for exTop in exteriorApertures:
|
3393
3429
|
if useInternalVertex == True:
|
3394
3430
|
vst = Topology.InternalVertex(exTop, tolerance)
|
3395
3431
|
else:
|
3396
3432
|
vst = exTop.CenterOfMass()
|
3397
3433
|
d1 = exTop.GetDictionary()
|
3434
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 4) # exterior aperture
|
3398
3435
|
vst = Vertex.ByCoordinates(Vertex.X(vst, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst, mantissa=mantissa)+(tolerance*100))
|
3399
3436
|
if storeBREP:
|
3400
3437
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exTop), Topology.Type(exTop), Topology.TypeAsString(exTop)])
|
@@ -3419,6 +3456,7 @@ class Graph:
|
|
3419
3456
|
vst = content.CenterOfMass()
|
3420
3457
|
vst = Vertex.ByCoordinates(Vertex.X(vst, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst, mantissa=mantissa)+(tolerance*100))
|
3421
3458
|
d1 = content.GetDictionary()
|
3459
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
3422
3460
|
if storeBREP:
|
3423
3461
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
3424
3462
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3434,7 +3472,6 @@ class Graph:
|
|
3434
3472
|
|
3435
3473
|
def processWire(item):
|
3436
3474
|
topology, others, outpostsKey, idKey, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, toOutposts, useInternalVertex, storeBREP, tolerance = item
|
3437
|
-
graph = None
|
3438
3475
|
edges = []
|
3439
3476
|
vertices = []
|
3440
3477
|
edgemat = []
|
@@ -3493,8 +3530,7 @@ class Graph:
|
|
3493
3530
|
if len(sharedt) > 0:
|
3494
3531
|
apertureExists = False
|
3495
3532
|
for x in sharedt:
|
3496
|
-
apList =
|
3497
|
-
_ = x.Apertures(apList)
|
3533
|
+
apList = Topology.Apertures(x)
|
3498
3534
|
if len(apList) > 0:
|
3499
3535
|
apertureExists = True
|
3500
3536
|
break
|
@@ -3508,10 +3544,7 @@ class Graph:
|
|
3508
3544
|
except:
|
3509
3545
|
v2 = topEdges[j].CenterOfMass()
|
3510
3546
|
e = Edge.ByStartVertexEndVertex(v1, v2, tolerance=tolerance)
|
3511
|
-
|
3512
|
-
for ap in apList:
|
3513
|
-
apTopologies.append(ap.Topology())
|
3514
|
-
mDict = mergeDictionaries(apTopologies)
|
3547
|
+
mDict = mergeDictionaries(apList)
|
3515
3548
|
if mDict:
|
3516
3549
|
e.SetDictionary(mDict)
|
3517
3550
|
edges.append(e)
|
@@ -3524,14 +3557,15 @@ class Graph:
|
|
3524
3557
|
vEdge = Edge.VertexByParameter(anEdge, 0.5)
|
3525
3558
|
except:
|
3526
3559
|
vEdge = anEdge.CenterOfMass()
|
3527
|
-
d1 = anEdge.GetDictionary()
|
3528
|
-
|
3529
|
-
|
3530
|
-
|
3531
|
-
|
3532
|
-
|
3533
|
-
|
3534
|
-
|
3560
|
+
# d1 = anEdge.GetDictionary()
|
3561
|
+
# d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 0) # main topology
|
3562
|
+
# if storeBREP:
|
3563
|
+
# d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(anEdge), Topology.Type(anEdge), Topology.TypeAsString(anEdge)])
|
3564
|
+
# d3 = mergeDictionaries2([d1, d2])
|
3565
|
+
# _ = vEdge.SetDictionary(d3)
|
3566
|
+
# else:
|
3567
|
+
# _ = vEdge.SetDictionary(d1)
|
3568
|
+
# vertices.append(vEdge)
|
3535
3569
|
eVertices = []
|
3536
3570
|
_ = anEdge.Vertices(None, eVertices)
|
3537
3571
|
sharedTopologies = []
|
@@ -3545,20 +3579,19 @@ class Graph:
|
|
3545
3579
|
_ = aVertex.Edges(topology, tempEdges)
|
3546
3580
|
if len(tempEdges) > 1:
|
3547
3581
|
sharedTopologies.append(aVertex)
|
3548
|
-
apertures =
|
3549
|
-
_ = aVertex.Apertures(apertures)
|
3582
|
+
apertures = Topology.Apertures(aVertex)
|
3550
3583
|
for anAperture in apertures:
|
3551
3584
|
sharedApertures.append(anAperture)
|
3552
3585
|
else:
|
3553
3586
|
exteriorTopologies.append(aVertex)
|
3554
|
-
apertures =
|
3555
|
-
_ = aVertex.Apertures(apertures)
|
3587
|
+
apertures = Topology.Apertures(aVertex)
|
3556
3588
|
for anAperture in apertures:
|
3557
3589
|
exteriorApertures.append(anAperture)
|
3558
3590
|
if viaSharedTopologies:
|
3559
3591
|
for sharedTopology in sharedTopologies:
|
3560
3592
|
vst = sharedTopology.CenterOfMass()
|
3561
3593
|
d1 = sharedTopology.GetDictionary()
|
3594
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 1) # shared topology
|
3562
3595
|
if storeBREP:
|
3563
3596
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(sharedTopology), Topology.Type(sharedTopology), Topology.TypeAsString(sharedTopology)])
|
3564
3597
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3582,6 +3615,7 @@ class Graph:
|
|
3582
3615
|
vst2 = content.CenterOfMass()
|
3583
3616
|
vst2 = Vertex.ByCoordinates(Vertex.X(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst2, mantissa=mantissa)+(tolerance*100))
|
3584
3617
|
d1 = content.GetDictionary()
|
3618
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
3585
3619
|
if storeBREP:
|
3586
3620
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
3587
3621
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3594,13 +3628,13 @@ class Graph:
|
|
3594
3628
|
_ = tempe.SetDictionary(tempd)
|
3595
3629
|
edges.append(tempe)
|
3596
3630
|
if viaSharedApertures:
|
3597
|
-
for
|
3598
|
-
sharedAp = sharedAperture.Topology()
|
3631
|
+
for sharedAp in sharedApertures:
|
3599
3632
|
if useInternalVertex == True:
|
3600
3633
|
vst = Topology.InternalVertex(sharedAp, tolerance)
|
3601
3634
|
else:
|
3602
3635
|
vst = sharedAp.CenterOfMass()
|
3603
3636
|
d1 = sharedAp.GetDictionary()
|
3637
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 2) # shared aperture
|
3604
3638
|
vst = Vertex.ByCoordinates(Vertex.X(vst, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst, mantissa=mantissa)+(tolerance*100))
|
3605
3639
|
if storeBREP:
|
3606
3640
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(sharedAp), Topology.Type(sharedAp), Topology.TypeAsString(sharedAp)])
|
@@ -3633,6 +3667,7 @@ class Graph:
|
|
3633
3667
|
vst2 = content.CenterOfMass()
|
3634
3668
|
vst2 = Vertex.ByCoordinates(Vertex.X(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst2, mantissa=mantissa)+(tolerance*100))
|
3635
3669
|
d1 = content.GetDictionary()
|
3670
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
3636
3671
|
if storeBREP:
|
3637
3672
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
3638
3673
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3645,13 +3680,13 @@ class Graph:
|
|
3645
3680
|
_ = tempe.SetDictionary(tempd)
|
3646
3681
|
edges.append(tempe)
|
3647
3682
|
if toExteriorApertures:
|
3648
|
-
for
|
3649
|
-
exTop = exteriorAperture.Topology()
|
3683
|
+
for exTop in exteriorApertures:
|
3650
3684
|
if useInternalVertex == True:
|
3651
3685
|
vst = Topology.InternalVertex(exTop, tolerance)
|
3652
3686
|
else:
|
3653
3687
|
vst = exTop.CenterOfMass()
|
3654
3688
|
d1 = exTop.GetDictionary()
|
3689
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 4) # exterior aperture
|
3655
3690
|
vst = Vertex.ByCoordinates(Vertex.X(vst, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst, mantissa=mantissa)+(tolerance*100))
|
3656
3691
|
if storeBREP:
|
3657
3692
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exTop), Topology.Type(exTop), Topology.TypeAsString(exTop)])
|
@@ -3676,6 +3711,7 @@ class Graph:
|
|
3676
3711
|
vst = content.CenterOfMass()
|
3677
3712
|
vst = Vertex.ByCoordinates(Vertex.X(vst, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst, mantissa=mantissa)+(tolerance*100))
|
3678
3713
|
d1 = content.GetDictionary()
|
3714
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
3679
3715
|
if storeBREP:
|
3680
3716
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
3681
3717
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3693,6 +3729,7 @@ class Graph:
|
|
3693
3729
|
except:
|
3694
3730
|
vEdge = anEdge.CenterOfMass()
|
3695
3731
|
d1 = anEdge.GetDictionary()
|
3732
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 0) # main topologuy
|
3696
3733
|
if storeBREP:
|
3697
3734
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(anEdge), Topology.Type(anEdge), Topology.TypeAsString(anEdge)])
|
3698
3735
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3724,6 +3761,7 @@ class Graph:
|
|
3724
3761
|
vop = Topology.CenterOfMass(outpost)
|
3725
3762
|
vcc = Topology.CenterOfMass(topology)
|
3726
3763
|
d1 = Topology.Dictionary(vcc)
|
3764
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 0) # main topology
|
3727
3765
|
if storeBREP:
|
3728
3766
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(topology), Topology.Type(topology), Topology.TypeAsString(topology)])
|
3729
3767
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3731,6 +3769,15 @@ class Graph:
|
|
3731
3769
|
else:
|
3732
3770
|
_ = vcc.SetDictionary(d1)
|
3733
3771
|
vertices.append(vcc)
|
3772
|
+
d1 = Topology.Dictionary(vop)
|
3773
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 6) # outpost
|
3774
|
+
if storeBREP:
|
3775
|
+
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(topology), Topology.Type(topology), Topology.TypeAsString(topology)])
|
3776
|
+
d3 = mergeDictionaries2([d1, d2])
|
3777
|
+
_ = vop.SetDictionary(d3)
|
3778
|
+
else:
|
3779
|
+
_ = vop.SetDictionary(d1)
|
3780
|
+
vertices.append(vop)
|
3734
3781
|
tempe = Edge.ByStartVertexEndVertex(vcc, vop, tolerance=tolerance)
|
3735
3782
|
tempd = Dictionary.ByKeysValues(["relationship"],["To Outposts"])
|
3736
3783
|
_ = tempe.SetDictionary(tempd)
|
@@ -3740,7 +3787,6 @@ class Graph:
|
|
3740
3787
|
|
3741
3788
|
def processEdge(item):
|
3742
3789
|
topology, others, outpostsKey, idKey, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, toOutposts, useInternalVertex, storeBREP, tolerance = item
|
3743
|
-
graph = None
|
3744
3790
|
vertices = []
|
3745
3791
|
edges = []
|
3746
3792
|
|
@@ -3753,6 +3799,7 @@ class Graph:
|
|
3753
3799
|
vEdge = topology.CenterOfMass()
|
3754
3800
|
|
3755
3801
|
d1 = vEdge.GetDictionary()
|
3802
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 0) # main topology
|
3756
3803
|
if storeBREP:
|
3757
3804
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(topology), Topology.Type(topology), Topology.TypeAsString(topology)])
|
3758
3805
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3794,8 +3841,7 @@ class Graph:
|
|
3794
3841
|
exteriorApertures = []
|
3795
3842
|
for aVertex in eVertices:
|
3796
3843
|
exteriorTopologies.append(aVertex)
|
3797
|
-
apertures =
|
3798
|
-
_ = aVertex.Apertures(apertures)
|
3844
|
+
apertures = Topology.Apertures(aVertex)
|
3799
3845
|
for anAperture in apertures:
|
3800
3846
|
exteriorApertures.append(anAperture)
|
3801
3847
|
if toExteriorTopologies:
|
@@ -3805,6 +3851,7 @@ class Graph:
|
|
3805
3851
|
else:
|
3806
3852
|
vst = exteriorTopology.CenterOfMass()
|
3807
3853
|
d1 = exteriorTopology.GetDictionary()
|
3854
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 3) # exterior topology
|
3808
3855
|
if storeBREP:
|
3809
3856
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exteriorTopology), Topology.Type(exteriorTopology), Topology.TypeAsString(exteriorTopology)])
|
3810
3857
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3828,6 +3875,7 @@ class Graph:
|
|
3828
3875
|
vst2 = content.CenterOfMass()
|
3829
3876
|
vst2 = Vertex.ByCoordinates(Vertex.X(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst2, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst2, mantissa=mantissa)+(tolerance*100))
|
3830
3877
|
d1 = content.GetDictionary()
|
3878
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
3831
3879
|
if storeBREP:
|
3832
3880
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
3833
3881
|
d3 = mergeDictionaries2([d1, d2])
|
@@ -3840,13 +3888,13 @@ class Graph:
|
|
3840
3888
|
_ = tempe.SetDictionary(tempd)
|
3841
3889
|
edges.append(tempe)
|
3842
3890
|
if toExteriorApertures:
|
3843
|
-
for
|
3844
|
-
exTop = exteriorAperture.Topology()
|
3891
|
+
for exTop in exteriorApertures:
|
3845
3892
|
if useInternalVertex == True:
|
3846
3893
|
vst = Topology.InternalVertex(exTop, tolerance)
|
3847
3894
|
else:
|
3848
3895
|
vst = exTop.CenterOfMass()
|
3849
3896
|
d1 = exTop.GetDictionary()
|
3897
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 4) # exterior aperture
|
3850
3898
|
vst = Vertex.ByCoordinates(Vertex.X(vst, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst, mantissa=mantissa)+(tolerance*100))
|
3851
3899
|
if storeBREP:
|
3852
3900
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exTop), Topology.Type(exTop), Topology.TypeAsString(exTop)])
|
@@ -3879,6 +3927,7 @@ class Graph:
|
|
3879
3927
|
else:
|
3880
3928
|
vst = content.CenterOfMass()
|
3881
3929
|
d1 = content.GetDictionary()
|
3930
|
+
d1 = Dictionary.SetValueAtKey(d1, nodeTypeKey, 5) # content
|
3882
3931
|
vst = Vertex.ByCoordinates(Vertex.X(vst, mantissa=mantissa)+(tolerance*100), Vertex.Y(vst, mantissa=mantissa)+(tolerance*100), Vertex.Z(vst, mantissa=mantissa)+(tolerance*100))
|
3883
3932
|
if storeBREP:
|
3884
3933
|
d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
|
@@ -3923,7 +3972,6 @@ class Graph:
|
|
3923
3972
|
if not Topology.IsInstance(topology, "Topology"):
|
3924
3973
|
print("Graph.ByTopology - Error: The input topology is not a valid topology. Returning None.")
|
3925
3974
|
return None
|
3926
|
-
graph = None
|
3927
3975
|
item = [topology, None, None, None, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, None, useInternalVertex, storeBREP, tolerance]
|
3928
3976
|
vertices = []
|
3929
3977
|
edges = []
|