topologicpy 0.6.1__py3-none-any.whl → 0.6.2__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/Aperture.py CHANGED
@@ -34,7 +34,8 @@ class Aperture(topologic.Aperture):
34
34
  The topology of the input aperture.
35
35
 
36
36
  """
37
- if not isinstance(aperture, topologic.Aperture):
37
+ from topologicpy.Topology import Topology
38
+ if not Topology.IsInstance(aperture, "aperture"):
38
39
  print("Aperture.Topology - Error: The input aperture parameter is not a valid topologic aperture. Returning None.")
39
40
  return None
40
41
  return topologic.Aperture.Topology(aperture)
@@ -57,7 +58,8 @@ class Aperture(topologic.Aperture):
57
58
  The created aperture.
58
59
 
59
60
  """
60
- if not isinstance(topology, topologic.Topology):
61
+ from topologicpy.Topology import Topology
62
+ if not Topology.IsInstance(topology, "topology"):
61
63
  print("Aperture.ByTopologyContext - Error: The input topology parameter is not a valid topologic topology. Returning None.")
62
64
  return None
63
65
  if not isinstance(context, topologic.Context):
topologicpy/Sun.py CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  import os
18
18
  import warnings
19
-
19
+ import topologic_core as topologic
20
20
  try:
21
21
  import ephem
22
22
  except:
@@ -587,6 +587,13 @@ class Sun():
587
587
  The sun path represented as a wire.
588
588
  """
589
589
  from topologicpy.Wire import Wire
590
+ from topologicpy.Dictionary import Dictionary
591
+ if origin == None:
592
+ origin = Vertex.Origin()
593
+ if startTime == None:
594
+ startTime = Sun.Sunrise(latitude=latitude, longitude=longitude, date=date)
595
+ if endTime == None:
596
+ endTime = Sun.Sunset(latitude=latitude, longitude=longitude, date=date)
590
597
  vertices = Sun.VerticesByDate(latitude=latitude, longitude=longitude, date=date,
591
598
  startTime=startTime, endTime=endTime, interval=interval,
592
599
  origin=origin, radius=radius, north=north)
@@ -600,6 +607,9 @@ class Sun():
600
607
  v = Wire.VertexByParameter(wire, u)
601
608
  vertices.append(v)
602
609
  wire = Wire.ByVertices(vertices, close=False)
610
+ d = Dictionary.ByKeysValues(["latitude", "longitude", "date", "startTime", "endTime", "interval", "type"],
611
+ [latitude, longitude, str(date), str(startTime), str(endTime), interval, "date"])
612
+ wire = Topology.SetDictionary(wire, d)
603
613
  return wire
604
614
 
605
615
  @staticmethod
@@ -667,9 +677,9 @@ class Sun():
667
677
  hour : datetime
668
678
  The input hour.
669
679
  startDay : integer , optional
670
- The desired start day to compute the sun location. The default is 1.
680
+ The desired start day of the year to compute the sun location. The default is 1.
671
681
  endDay : integer , optional
672
- The desired end day to compute the sun location. The default is 365.
682
+ The desired end day of the year to compute the sun location. The default is 365.
673
683
  interval : int , optional
674
684
  The interval in days to compute the sun location. The default is 5.
675
685
  origin : topologic.Vertex , optional
@@ -689,7 +699,8 @@ class Sun():
689
699
  """
690
700
 
691
701
  from topologicpy.Wire import Wire
692
-
702
+ from topologicpy.Dictionary import Dictionary
703
+
693
704
  vertices = Sun.VerticesByHour(latitude=latitude, longitude=longitude, hour=hour,
694
705
  startDay=startDay, endDay=endDay, interval=interval,
695
706
  origin=origin, radius=radius, north=north)
@@ -703,10 +714,13 @@ class Sun():
703
714
  v = Wire.VertexByParameter(wire, u)
704
715
  vertices.append(v)
705
716
  wire = Wire.ByVertices(vertices, close=True)
717
+ d = Dictionary.ByKeysValues(["latitude", "longitude", "hour", "startDay", "endDay", "interval", "type"],
718
+ [latitude, longitude, hour, startDay, endDay, interval, "hour"])
719
+ wire = Topology.SetDictionary(wire, d)
706
720
  return wire
707
721
 
708
722
  @staticmethod
709
- def Diagram(latitude, longitude, minuteInterval=10, dayInterval=5,
723
+ def Diagram(latitude, longitude, minuteInterval=30, dayInterval=15,
710
724
  origin=None, radius=0.5, uSides=180, vSides=180, north=0,
711
725
  compass = False, shell=False):
712
726
  """
@@ -718,12 +732,10 @@ class Sun():
718
732
  The input latitude. See https://en.wikipedia.org/wiki/Latitude.
719
733
  longitude : float
720
734
  The input longitude. See https://en.wikipedia.org/wiki/Longitude.
721
- hour : datetime
722
- The input hour.
723
735
  minuteInterval : int , optional
724
- The interval in minutes to compute the sun location. The default is 10.
736
+ The interval in minutes to compute the sun location for the date path. The default is 30.
725
737
  dayInterval : int , optional
726
- The interval in days to compute the sun location. The default is 5.
738
+ The interval in days for the hourly path to compute the sun location. The default is 15.
727
739
  origin : topologic.Vertex , optional
728
740
  The desired origin of the world. If set to None, the origin will be set to (0,0,0). The default is None.
729
741
  radius : float , optional
@@ -735,98 +747,111 @@ class Sun():
735
747
  north : float, optional
736
748
  The desired compass angle of the north direction. The default is 0 which points in the positive Y-axis direction.
737
749
  compass : bool , optional
738
- If set to True, a compass is included. Othwerwise, it is is not.
750
+ If set to True, a compass (shell) is included. Othwerwise, it is is not.
739
751
  shell : bool , optional
740
- If set to True, a shell of the total surface of the sun paths is incldued. Otherwise, it is not.
752
+ If set to True, the total surface (shell) of the sun paths is incldued. Otherwise, it is not.
741
753
 
742
754
  Returns
743
755
  -------
744
- topologic.Cluster
745
- The sun diagram.
756
+ dict
757
+ A dictionary of the sun diagram shapes. The keys in this dictionary are:
758
+ - 'date_paths': These are the sun paths (wire) for the winter solstice, equinox, and summer solstice
759
+ - 'hourly_paths': These are the figure-8 (wire) for the sun location on the same hour on each selected day of the year.
760
+ - 'shell': This is the total surface (shell) of the sun paths. This is included only if the shell option is set to True.
761
+ - 'compass': This is the compass (shell) on the ground. It is made of 36 sides and 10 rings. This is included only
762
+ if the compass option is set to True.
763
+ - 'center' : This is a cross-shape (wire) at the center of the diagram. This is included only if the compass option is set to True.
764
+ - 'ground' : This is a circle (face) on the ground. It is made of 36 sides. This is included only if
765
+ the compass option is set to False.
746
766
  """
747
767
 
748
768
  from datetime import datetime
749
769
  from datetime import timedelta
770
+ from topologicpy.Vertex import Vertex
750
771
  from topologicpy.Edge import Edge
751
772
  from topologicpy.Wire import Wire
752
773
  from topologicpy.Shell import Shell
753
774
  from topologicpy.Cell import Cell
754
775
  from topologicpy.Cluster import Cluster
755
776
  from topologicpy.Topology import Topology
777
+ from topologicpy.Dictionary import Dictionary
778
+
779
+ if origin == None:
780
+ origin = Vertex.Origin()
756
781
 
782
+ cutter = Cell.Prism(origin=origin, width=radius*4, length=radius*4, height=radius*2)
783
+ cutter = Topology.Rotate(cutter, origin=origin, angle=-north)
784
+ cutter = Topology.Translate(cutter, 0,0,-radius)
757
785
  now = datetime.now()
758
786
  year = now.year
759
- objects = []
760
- monthly_paths = []
787
+ diagram = {}
761
788
  winter_solstice = Sun.WinterSolstice(latitude=latitude, year=year)
762
789
  summer_solstice = Sun.SummerSolstice(latitude=latitude, year=year)
763
- equinox = Sun.SpringEquinox(latitude=latitude, year=year)
790
+ equinox = Sun.AutumnEquinox(latitude=latitude, year=year)
764
791
  dates = [winter_solstice, equinox, summer_solstice]
792
+ date_paths = []
765
793
  for date in dates:
766
- startTime = Sun.Sunrise(latitude=latitude, longitude=longitude, date=date) - timedelta(hours=1)
767
- endTime = Sun.Sunset(latitude=latitude, longitude=longitude, date=date) + timedelta(hours=1)
794
+ startTime = Sun.Sunrise(latitude=latitude, longitude=longitude, date=date) - timedelta(hours=2)
795
+ endTime = Sun.Sunset(latitude=latitude, longitude=longitude, date=date) + timedelta(hours=2)
768
796
  path = Sun.PathByDate(latitude=latitude, longitude=longitude, date=date,
769
797
  startTime=startTime, endTime=endTime, interval=minuteInterval,
770
798
  origin=origin, radius=radius, sides=uSides, north=north)
771
- monthly_paths.append(path)
772
-
773
-
799
+ # Capture the path's dictionary to re-apply later
800
+ d = Topology.Dictionary(path)
801
+ # Clip the path to above ground level
802
+ path = Topology.Difference(path, cutter)
803
+ path = Topology.SetDictionary(path, d)
804
+ date_paths.append(path)
805
+ diagram['date_paths'] = date_paths
806
+ # Hourly paths
774
807
  hourly_paths = []
775
808
  for hour in range (0, 24, 1):
776
- hourly_path = Sun.PathByHour(latitude, longitude, hour, startDay=1, endDay=365, interval=dayInterval,
809
+ hourly_path = Sun.PathByHour(latitude, longitude, hour, startDay=0, endDay=365, interval=dayInterval,
777
810
  origin=origin, radius=radius, sides=vSides*2, north=north)
778
- hourly_paths.append(hourly_path)
779
- cutter = Cell.Prism(origin=origin, width=radius*4, length=radius*4, height=radius*4)
780
- cutter = Topology.Rotate(cutter, origin=origin, angle=-north)
781
- cutter = Topology.Translate(cutter, 0,0,-radius*2)
811
+ d = Topology.Dictionary(hourly_path)
812
+ hourly_path = Topology.Difference(hourly_path, cutter)
813
+ if Topology.IsInstance(hourly_path, "topology"):
814
+ hourly_path = Topology.SetDictionary(hourly_path, d)
815
+ hourly_paths.append(hourly_path)
816
+ diagram['hourly_paths'] = hourly_paths
782
817
  if shell:
783
- shell_paths = [monthly_paths[0]]
784
- for j in range(2,5,1):
785
- if j == 3:
786
- shell_paths.append(monthly_paths[1])
818
+ shell_paths = []
819
+ dates = [summer_solstice]
820
+ delta = (winter_solstice - summer_solstice)/12
821
+ for i in range(1,12):
822
+ a_date = summer_solstice + delta*i
823
+ if abs(a_date - equinox) < timedelta(hours=24*5):
824
+ dates.append(equinox)
787
825
  else:
788
- date = (datetime(datetime.now().year, j, 21))
789
- startTime = Sun.Sunrise(latitude=latitude, longitude=longitude, date=date) - timedelta(hours=1)
790
- endTime = Sun.Sunset(latitude=latitude, longitude=longitude, date=date) + timedelta(hours=1)
791
- shell_path = Sun.PathByDate(latitude=latitude, longitude=longitude, date=date,
826
+ dates.append(a_date)
827
+ dates.append(winter_solstice)
828
+ for date in dates:
829
+ startTime = Sun.Sunrise(latitude=latitude, longitude=longitude, date=date) - timedelta(hours=2)
830
+ endTime = Sun.Sunset(latitude=latitude, longitude=longitude, date=date) + timedelta(hours=2)
831
+ shell_path = Sun.PathByDate(latitude=latitude, longitude=longitude, date=date,
792
832
  startTime=startTime, endTime=endTime, interval=minuteInterval,
793
- origin=origin, radius=radius, sides=uSides, north=north)
794
- shell_paths.append(shell_path)
795
- shell_paths.append(monthly_paths[-1])
796
- print(len(shell_paths))
797
- a_shell = Shell.ByWires(shell_paths, triangulate=True, silent=False)
798
- a_shell = Topology.Difference(a_shell, cutter)
799
- objects.append(a_shell)
800
- if len(monthly_paths) > 1:
801
- monthly_paths = Cluster.ByTopologies(monthly_paths)
802
- else:
803
- monthly_paths = monthly_paths[0]
804
- monthly_paths = Topology.Difference(monthly_paths, cutter)
805
- if len(hourly_paths) > 1:
806
- hourly_paths = Cluster.ByTopologies(hourly_paths)
833
+ origin=origin, radius=radius, sides=uSides, north=north)
834
+ # Clip the path to above ground level
835
+ shell_path = Topology.Difference(shell_path, cutter)
836
+ path_vertices = []
837
+ for i in range(uSides+1):
838
+ u = float(i)/float(uSides)
839
+ v = Wire.VertexByParameter(shell_path, u)
840
+ path_vertices.append(v)
841
+ shell_path = Wire.ByVertices(path_vertices, close=False)
842
+ shell_paths.append(shell_path)
843
+ a_shell = Shell.ByWires(shell_paths, triangulate=True, silent=True)
844
+ d = Dictionary.ByKeysValues(["latitude", "longitude", "type"], [latitude, longitude, "shell"])
845
+ a_shell = Topology.SetDictionary(a_shell, d)
846
+ diagram['shell']= a_shell
807
847
  else:
808
- hourly_paths = hourly_paths[0]
809
- hourly_paths = Topology.Difference(hourly_paths, cutter)
810
- objects += [monthly_paths, hourly_paths]
811
- circle = Wire.Circle(origin=origin, radius=radius, sides=36)
812
- circle = Topology.Rotate(circle, origin=origin, angle=-north)
813
- objects.append(circle)
848
+ diagram['shell'] = None
849
+
814
850
  if compass:
815
- radius_unit = radius/(float(9))
816
- for i in range(1,9):
817
- circle = Wire.Circle(origin=origin, radius=radius_unit*i, sides=36)
818
- circle = Topology.Rotate(circle, origin=origin, angle=-north)
819
- objects.append(circle)
820
-
821
- edges = []
822
- for i in range(0, 36, 1):
823
- v1 = Topology.Translate(origin, 0, radius/float(9), 0)
824
- v2 = Topology.Translate(origin, 0, radius, 0)
825
- edge = Edge.ByVertices(v1, v2)
826
- edge = Topology.Rotate(edge, origin=origin, angle=10*i)
827
- edge = Topology.Rotate(edge, origin=origin, angle=-north)
828
- edges.append(edge)
829
- objects += edges
851
+ compass = Shell.Pie(origin=origin, radiusA=radius, radiusB=radius*0.1, sides=36, rings=10)
852
+ d = Dictionary.ByKeysValues(["latitude", "longitude", "type"], [latitude, longitude, "compass"])
853
+ compass = Topology.SetDictionary(compass, d)
854
+ diagram['compass'] = compass
830
855
  edges = []
831
856
  for i in range(0, 4, 1):
832
857
  v2 = Topology.Translate(origin, 0, radius/float(9), 0)
@@ -834,6 +859,15 @@ class Sun():
834
859
  edge = Topology.Rotate(edge, origin=origin, angle=90*i)
835
860
  edge = Topology.Rotate(edge, origin=origin, angle=-north)
836
861
  edges.append(edge)
837
- objects += edges
838
- diag = Cluster.ByTopologies(objects)
839
- return diag
862
+ center = Topology.SelfMerge(Cluster.ByTopologies(edges))
863
+ d = Dictionary.ByKeysValues(["latitude", "longitude", "type"], [latitude, longitude, "center"])
864
+ center = Topology.SetDictionary(center, d)
865
+ diagram['center'] = center
866
+ else:
867
+ ground = Wire.Circle(origin=origin, radius=radius, sides=36)
868
+ d = Dictionary.ByKeysValues(["latitude", "longitude", "type"], [latitude, longitude, "ground"])
869
+ ground = Topology.SetDictionary(ground, d)
870
+ diagram['compass'] = None
871
+ diagram['center'] = None
872
+ diagram['ground']= ground
873
+ return diagram
topologicpy/Topology.py CHANGED
@@ -4440,6 +4440,7 @@ class Topology():
4440
4440
  "Graph"
4441
4441
  "Aperture"
4442
4442
  "Dictionary"
4443
+ "Context"
4443
4444
 
4444
4445
  Returns
4445
4446
  -------
@@ -4471,6 +4472,8 @@ class Topology():
4471
4472
  return isinstance(topology, topologic.Aperture)
4472
4473
  elif "dictionary" in type.lower():
4473
4474
  return isinstance(topology, topologic.Dictionary)
4475
+ elif "context" in type.lower():
4476
+ return isinstance(topology, topologic.Context)
4474
4477
  else:
4475
4478
  print("Topology.IsInstance - Error: The type input string is not a known topology type. Returning None.")
4476
4479
  return None
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.6.1'
1
+ __version__ = '0.6.2'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.6.1
3
+ Version: 0.6.2
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
  License: GNU AFFERO GENERAL PUBLIC LICENSE
@@ -1,4 +1,4 @@
1
- topologicpy/Aperture.py,sha256=xEKYZHKGmis2XKA1GKCDUGyXnpnrDMOXzQFzKsBZU10,2765
1
+ topologicpy/Aperture.py,sha256=Mp3ntv28UrBjeAxcaOpOWxM7fTrtFGTGl1314BRgBHU,2867
2
2
  topologicpy/Cell.py,sha256=2KSE-BnciiJKgA6mftsEmeLC-OjzriOmdzlEuoIWsh0,96552
3
3
  topologicpy/CellComplex.py,sha256=5tqj4kZKzESdqPHNrmfYV7i3g5trcXpiC9HpeqYwTn8,46270
4
4
  topologicpy/Cluster.py,sha256=un3waRSZf9tSkLSqItvCD6FypzNcKWcw38pocTlNKoI,54594
@@ -19,15 +19,15 @@ topologicpy/Plotly.py,sha256=DZbkrmjOr2c7uFHoWk6Uj2r54jCN_VDxzVMUcZagU18,94980
19
19
  topologicpy/Polyskel.py,sha256=MYHKFOQBlUNqoUhAdOcKRIHpSk0dWWVrZgXK34NkvFM,15936
20
20
  topologicpy/Shell.py,sha256=rnlnMRxY-KxJPpzr4oXy9m1I1QRQj1qhY8UXBgH8Pu8,74563
21
21
  topologicpy/Speckle.py,sha256=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
22
- topologicpy/Sun.py,sha256=tww8uxLYr_QxwUgqTGfvY_3zUoJUz7y4MDMwKzom2rI,33899
23
- topologicpy/Topology.py,sha256=sAKa6tpjg2zA_hg9j5I2WRfYvVE7YXs_We0YytVAJZk,304811
22
+ topologicpy/Sun.py,sha256=jUokWlwlRaPFa3wC2-flIpE9gBae0YYSP73N_41VsNQ,36723
23
+ topologicpy/Topology.py,sha256=dE0LbZwPGQyzZYYZqN1W2FwszPEDTXIIXpkOFgRD2kw,304932
24
24
  topologicpy/Vector.py,sha256=apFuFOmi0WC3QWJ6O5LfLUyVvGOYWTTCTm26g3dKQrQ,29589
25
25
  topologicpy/Vertex.py,sha256=fHp2BarCGWiuJeMarDuLfSKGEqSFOulh7bd22siVl5A,64925
26
26
  topologicpy/Wire.py,sha256=sBYVsIj9QxEXOvNtjDqFaO2N2r1ZlairTn_HSW9rOiQ,128857
27
27
  topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
28
- topologicpy/version.py,sha256=gd3s3RotD0_KL90Tua-YkOr60Jm2C2_wvlEhAT08068,22
29
- topologicpy-0.6.1.dist-info/LICENSE,sha256=TfPDBt3ar0uv_f9cqCDMZ5rIzW3CY8anRRd4PkL6ejs,34522
30
- topologicpy-0.6.1.dist-info/METADATA,sha256=b1ojQGraQDFsgtIYwilIm927AnE0ODRn2EgamQ_nOKs,46950
31
- topologicpy-0.6.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
32
- topologicpy-0.6.1.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
33
- topologicpy-0.6.1.dist-info/RECORD,,
28
+ topologicpy/version.py,sha256=gMDttCkJF3h8Jr3eq_8NuJj26-9xyjg-YjR2bSNcGxM,22
29
+ topologicpy-0.6.2.dist-info/LICENSE,sha256=TfPDBt3ar0uv_f9cqCDMZ5rIzW3CY8anRRd4PkL6ejs,34522
30
+ topologicpy-0.6.2.dist-info/METADATA,sha256=OqDWsF7OV8X8rORRAY9ieKqPVhtHTImgj-MyXbyIy7M,46950
31
+ topologicpy-0.6.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
32
+ topologicpy-0.6.2.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
33
+ topologicpy-0.6.2.dist-info/RECORD,,