topologicpy 0.7.3__py3-none-any.whl → 0.7.4__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/Topology.py +167 -3
- topologicpy/version.py +1 -1
- {topologicpy-0.7.3.dist-info → topologicpy-0.7.4.dist-info}/METADATA +1 -1
- {topologicpy-0.7.3.dist-info → topologicpy-0.7.4.dist-info}/RECORD +7 -7
- {topologicpy-0.7.3.dist-info → topologicpy-0.7.4.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.3.dist-info → topologicpy-0.7.4.dist-info}/WHEEL +0 -0
- {topologicpy-0.7.3.dist-info → topologicpy-0.7.4.dist-info}/top_level.txt +0 -0
topologicpy/Topology.py
CHANGED
@@ -1503,7 +1503,7 @@ class Topology():
|
|
1503
1503
|
@staticmethod
|
1504
1504
|
def ByBREPPath(path):
|
1505
1505
|
"""
|
1506
|
-
|
1506
|
+
Imports a topology from a BREP file path.
|
1507
1507
|
|
1508
1508
|
Parameters
|
1509
1509
|
----------
|
@@ -1525,7 +1525,172 @@ class Topology():
|
|
1525
1525
|
print("Topology.ByBREPPath - Error: the BREP file is not a valid file. Returning None.")
|
1526
1526
|
return None
|
1527
1527
|
return Topology.ByBREPFile(file)
|
1528
|
-
|
1528
|
+
|
1529
|
+
@staticmethod
|
1530
|
+
def ByDXFFile(file):
|
1531
|
+
"""
|
1532
|
+
Imports a list of topologies from a DXF file.
|
1533
|
+
This is an experimental method with limited capabilities.
|
1534
|
+
|
1535
|
+
Parameters
|
1536
|
+
----------
|
1537
|
+
file : a DXF file object
|
1538
|
+
The DXF file object.
|
1539
|
+
|
1540
|
+
Returns
|
1541
|
+
-------
|
1542
|
+
list
|
1543
|
+
The list of imported topologies.
|
1544
|
+
|
1545
|
+
"""
|
1546
|
+
from topologicpy.Vertex import Vertex
|
1547
|
+
from topologicpy.Edge import Edge
|
1548
|
+
from topologicpy.Wire import Wire
|
1549
|
+
from topologicpy.Shell import Shell
|
1550
|
+
from topologicpy.Cell import Cell
|
1551
|
+
from topologicpy.CellComplex import CellComplex
|
1552
|
+
from topologicpy.Topology import Topology
|
1553
|
+
|
1554
|
+
try:
|
1555
|
+
import ezdxf
|
1556
|
+
except:
|
1557
|
+
print("Topology.ByDXFFile - Information: Installing required ezdxf library.")
|
1558
|
+
try:
|
1559
|
+
os.system("pip install ezdxf")
|
1560
|
+
except:
|
1561
|
+
os.system("pip install ezdxf --user")
|
1562
|
+
try:
|
1563
|
+
import ezdxf
|
1564
|
+
print("Topology.ByDXFFile - Information: ezdxf library installed successfully.")
|
1565
|
+
except:
|
1566
|
+
warnings.warn("Topology.ByDXFFile - Error: Could not import ezdxf library. Please install it manually. Returning None.")
|
1567
|
+
return None
|
1568
|
+
|
1569
|
+
if not file:
|
1570
|
+
print("Topology.ByDXFFile - Error: the input file parameter is not a valid file. Returning None.")
|
1571
|
+
return None
|
1572
|
+
|
1573
|
+
def convert_entity(entity):
|
1574
|
+
entity_type = entity.dxftype()
|
1575
|
+
converted_entity = None
|
1576
|
+
|
1577
|
+
if entity_type == 'POINT':
|
1578
|
+
x, y, z = entity.dxf.location.x, entity.dxf.location.y, entity.dxf.location.z
|
1579
|
+
converted_entity = Vertex.ByCoordinates(x, y, z)
|
1580
|
+
|
1581
|
+
elif entity_type == 'LINE':
|
1582
|
+
start = Vertex.ByCoordinates(entity.dxf.start.x, entity.dxf.start.y, entity.dxf.start.z)
|
1583
|
+
end = Vertex.ByCoordinates(entity.dxf.end.x, entity.dxf.end.y, entity.dxf.end.z)
|
1584
|
+
converted_entity = Edge.ByVertices(start, end)
|
1585
|
+
|
1586
|
+
elif entity_type == 'CIRCLE':
|
1587
|
+
origin = Vertex.ByCoordinates(entity.dxf.center.x, entity.dxf.center.y, entity.dxf.center.z)
|
1588
|
+
radius = entity.dxf.radius
|
1589
|
+
converted_entity = Wire.Circle(origin, radius)
|
1590
|
+
|
1591
|
+
elif entity_type in ['POLYLINE', 'LWPOLYLINE']:
|
1592
|
+
vertices = [Vertex.ByCoordinates(p[0], p[1], p[2]) for p in entity.points()]
|
1593
|
+
converted_entity = Wire.ByVertices(vertices)
|
1594
|
+
|
1595
|
+
elif entity_type == 'ARC':
|
1596
|
+
vertices = [Vertex.ByCoordinates(p.x, p.y, p.z) for p in entity.vertices()]
|
1597
|
+
converted_entity = Wire.ByVertices(vertices)
|
1598
|
+
|
1599
|
+
elif entity_type == 'MESH':
|
1600
|
+
vertices = [list(v) for v in entity.vertices]
|
1601
|
+
faces = [list(face) for face in entity.faces]
|
1602
|
+
converted_entity = Topology.SelfMerge(Topology.ByGeometry(vertices=vertices, faces=faces))
|
1603
|
+
# Try Cell
|
1604
|
+
temp = Cell.ByFaces(Topology.Faces(converted_entity), silent=True)
|
1605
|
+
if not Topology.IsInstance(temp, "Cell"):
|
1606
|
+
temp = CellComplex.ByFaces(Topology.Faces(converted_entity))
|
1607
|
+
if not Topology.IsInstance(temp, "CellComplex"):
|
1608
|
+
temp = Shell.ByFaces(Topology.Faces(converted_entity))
|
1609
|
+
if not Topology.IsInstance(temp, "Shell"):
|
1610
|
+
temp = converted_entity
|
1611
|
+
converted_entity = temp
|
1612
|
+
return converted_entity
|
1613
|
+
|
1614
|
+
def convert_insert(entity, file):
|
1615
|
+
block_name = entity.dxf.name
|
1616
|
+
block = file.blocks.get(block_name)
|
1617
|
+
converted_entities = []
|
1618
|
+
|
1619
|
+
for block_entity in block:
|
1620
|
+
converted_entity = convert_entity(block_entity)
|
1621
|
+
if converted_entity is not None:
|
1622
|
+
converted_entities.append(converted_entity)
|
1623
|
+
|
1624
|
+
x, y, z = [entity.dxf.insert.x, entity.dxf.insert.y, entity.dxf.insert.z]
|
1625
|
+
return [Topology.Translate(obj, x, y, z) for obj in converted_entities]
|
1626
|
+
|
1627
|
+
def convert_dxf_to_custom_types(file):
|
1628
|
+
# Read the DXF file
|
1629
|
+
msp = file.modelspace()
|
1630
|
+
|
1631
|
+
# Store the converted entities
|
1632
|
+
converted_entities = []
|
1633
|
+
|
1634
|
+
# Process each entity in the model space
|
1635
|
+
for entity in msp:
|
1636
|
+
entity_type = entity.dxftype()
|
1637
|
+
if entity_type in ['TEXT', 'MTEXT']:
|
1638
|
+
continue # Ignore TEXT and MTEXT
|
1639
|
+
|
1640
|
+
if entity_type == 'INSERT':
|
1641
|
+
converted_entities.extend(convert_insert(entity, file))
|
1642
|
+
else:
|
1643
|
+
converted_entity = convert_entity(entity)
|
1644
|
+
if converted_entity is not None:
|
1645
|
+
converted_entities.append(converted_entity)
|
1646
|
+
|
1647
|
+
return converted_entities
|
1648
|
+
converted_entities = convert_dxf_to_custom_types(file)
|
1649
|
+
return converted_entities
|
1650
|
+
|
1651
|
+
@staticmethod
|
1652
|
+
def ByDXFPath(path):
|
1653
|
+
"""
|
1654
|
+
Imports a list of topologies from a DXF file path.
|
1655
|
+
This is an experimental method with limited capabilities.
|
1656
|
+
|
1657
|
+
Parameters
|
1658
|
+
----------
|
1659
|
+
path : str
|
1660
|
+
The path to the DXF file.
|
1661
|
+
|
1662
|
+
Returns
|
1663
|
+
-------
|
1664
|
+
list
|
1665
|
+
The list of imported topologies.
|
1666
|
+
|
1667
|
+
"""
|
1668
|
+
try:
|
1669
|
+
import ezdxf
|
1670
|
+
except:
|
1671
|
+
print("Topology.ExportToDXF - Information: Installing required ezdxf library.")
|
1672
|
+
try:
|
1673
|
+
os.system("pip install ezdxf")
|
1674
|
+
except:
|
1675
|
+
os.system("pip install ezdxf --user")
|
1676
|
+
try:
|
1677
|
+
import ezdxf
|
1678
|
+
print("Topology.ByDXFPath - Information: ezdxf library installed successfully.")
|
1679
|
+
except:
|
1680
|
+
warnings.warn("Topology.ByDXFPath - Error: Could not import ezdxf library. Please install it manually. Returning None.")
|
1681
|
+
return None
|
1682
|
+
if not path:
|
1683
|
+
print("Topology.ByDXFPath - Error: the input path parameter is not a valid path. Returning None.")
|
1684
|
+
return None
|
1685
|
+
try:
|
1686
|
+
file = ezdxf.readfile(path)
|
1687
|
+
except:
|
1688
|
+
file = None
|
1689
|
+
if not file:
|
1690
|
+
print("Topology.ByDXFPath - Error: the input file parameter is not a valid file. Returning None.")
|
1691
|
+
return None
|
1692
|
+
return Topology.ByDXFFile(file)
|
1693
|
+
|
1529
1694
|
@staticmethod
|
1530
1695
|
def ByIFCFile(file, transferDictionaries=False, includeTypes=[], excludeTypes=[]):
|
1531
1696
|
"""
|
@@ -1648,7 +1813,6 @@ class Topology():
|
|
1648
1813
|
try:
|
1649
1814
|
file = ifcopenshell.open(path)
|
1650
1815
|
except:
|
1651
|
-
print("Topology.ByIFCPath - Error: the input file parameter is not a valid file. Returning None.")
|
1652
1816
|
file = None
|
1653
1817
|
if not file:
|
1654
1818
|
print("Topology.ByIFCPath - Error: the input file parameter is not a valid file. Returning None.")
|
topologicpy/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.7.
|
1
|
+
__version__ = '0.7.4'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: topologicpy
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.4
|
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
|
@@ -20,14 +20,14 @@ topologicpy/Polyskel.py,sha256=MYHKFOQBlUNqoUhAdOcKRIHpSk0dWWVrZgXK34NkvFM,15936
|
|
20
20
|
topologicpy/Shell.py,sha256=6hidTQ6MW5q_es-WbTeI_yt7Sd7BMxWU_qfoherVZhE,74343
|
21
21
|
topologicpy/Speckle.py,sha256=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
|
22
22
|
topologicpy/Sun.py,sha256=3tYb8kssU882lE1gEWg2mxDvCCY_LAVElkyUT6wa-ZU,36935
|
23
|
-
topologicpy/Topology.py,sha256=
|
23
|
+
topologicpy/Topology.py,sha256=qyk9y3pdsvU_hCLESBsWwN6zM_P5BBirEdhvuxnjkHM,305348
|
24
24
|
topologicpy/Vector.py,sha256=FHbrCb9GVLOUV_kqcplh4D88CVxlID6qX_wEQOw4rD0,29565
|
25
25
|
topologicpy/Vertex.py,sha256=YgbbCcqABvb97z2-yEytpp5T3yoZPlQplR_vMQkQ9OA,65180
|
26
26
|
topologicpy/Wire.py,sha256=MUEboxo11kMgwnZySSkwiyzBG2wv0wPiinf2cW4UVv8,138424
|
27
27
|
topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
|
28
|
-
topologicpy/version.py,sha256=
|
29
|
-
topologicpy-0.7.
|
30
|
-
topologicpy-0.7.
|
31
|
-
topologicpy-0.7.
|
32
|
-
topologicpy-0.7.
|
33
|
-
topologicpy-0.7.
|
28
|
+
topologicpy/version.py,sha256=lBlBxbnftiADKPpC3XRA3jUPjRsVclCd3P95aQ33p_g,22
|
29
|
+
topologicpy-0.7.4.dist-info/LICENSE,sha256=TfPDBt3ar0uv_f9cqCDMZ5rIzW3CY8anRRd4PkL6ejs,34522
|
30
|
+
topologicpy-0.7.4.dist-info/METADATA,sha256=ELxHFRNJM71bITDzS-ZmOxF5xDaS3PuoxphPYTZ7HOQ,46950
|
31
|
+
topologicpy-0.7.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
32
|
+
topologicpy-0.7.4.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
|
33
|
+
topologicpy-0.7.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|