Skip to content

Commit 52aff60

Browse files
committed
WIP: working basic imports on script-sync
1 parent a39080b commit 52aff60

File tree

9 files changed

+831
-936
lines changed

9 files changed

+831
-936
lines changed

deps/eigen

Submodule eigen updated from 2620cb9 to 5226566
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
#! python3
22
# requirements: diffCheck
3-
"""
4-
This read breps from Rhino, converts them to DFBeams and DFAssemblies, and exports them to XML.
53

6-
:param i_breps: list of breps
7-
:param i_export_dir: directory to export the xml
8-
:param i_dump: press to dump the xml
9-
"""
104
import System
115
import typing
126

@@ -16,20 +10,24 @@
1610
from ghpythonlib.componentbase import executingcomponent as component
1711

1812
from diffCheck.df_geometries import DFVertex, DFFace, DFBeam, DFAssembly
13+
import diffCheck.df_transformations
14+
import diffCheck.df_joint_detector
15+
import diffCheck.df_util
1916

2017

2118
class DFXMLExporter(component):
2219
def RunScript(self,
2320
i_dump : bool,
24-
i_name : str,
21+
i_assembly_name : str,
2522
i_export_dir : str,
2623
i_breps : typing.List[Rhino.Geometry.Brep]
2724
):
2825
"""
29-
Main function to test the package
30-
:param i_dump: whether to dump the xml
31-
:param i_export_dir: directory to export the xml
32-
:param i_breps: list of breps
26+
This read breps from Rhino, converts them to DFBeams and DFAssemblies, and exports them to XML.
27+
28+
:param i_dump: whether to dump the xml
29+
:param i_export_dir: directory to export the xml
30+
:param i_breps: list of breps
3331
"""
3432
# beams
3533
beams : typing.List[DFBeam] = []
@@ -38,14 +36,16 @@ def RunScript(self,
3836
beams.append(beam)
3937

4038
# assembly
41-
assembly1 = DFAssembly(beams, i_name)
42-
print(assembly1.beams)
43-
print(assembly1)
39+
assembly1 = DFAssembly(beams, i_assembly_name)
4440

4541
# dump the xml
4642
xml : str = assembly1.to_xml()
4743
if i_dump:
4844
assembly1.dump(xml, i_export_dir)
4945
o_xml = xml
5046

51-
return o_xml
47+
# show the joint/side faces
48+
o_joints = [jf.to_brep() for jf in assembly1.all_joint_faces]
49+
o_sides = [sf.to_brep() for sf in assembly1.all_side_faces]
50+
51+
return o_xml, o_joints, o_sides

src/gh/components/DF_xml_exporter/metadata.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,22 @@
7070
"optional": false,
7171
"sourceCount": 0,
7272
"graft": false
73+
},
74+
{
75+
"name": "o_joints",
76+
"nickname": "o_joints",
77+
"description": "The breps of the faces belonging to joints.",
78+
"optional": false,
79+
"sourceCount": 0,
80+
"graft": false
81+
},
82+
{
83+
"name": "o_sides",
84+
"nickname": "o_sides",
85+
"description": "The breps of the faces belonging to sides.",
86+
"optional": false,
87+
"sourceCount": 0,
88+
"graft": false
7389
}
7490
]
7591
}

src/gh/diffCheck/diffCheck/df_geometries.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import xml.etree.ElementTree as ET
1111
from xml.dom.minidom import parseString
1212

13-
from df_joint_detector import JointDetector
13+
import diffCheck.df_joint_detector
1414

1515

1616
@dataclass
@@ -187,7 +187,7 @@ def from_brep(cls, brep):
187187
Create a DFBeam from a RhinoBrep object.
188188
It also removes duplicates and creates a list of unique faces.
189189
"""
190-
faces = JointDetector(brep).run()
190+
faces = diffCheck.df_joint_detector.JointDetector(brep).run()
191191
faces = list(set(faces))
192192
beam = cls("Beam", faces)
193193
return beam

src/gh/diffCheck/diffCheck/df_joint_detector.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
import df_util
99
import df_transformations
10-
from df_geometries import DFVertex, DFFace
11-
10+
from df_geometries import DFFace
1211

1312
@dataclass
1413
class JointDetector():

src/gh/diffCheck/diffCheck/diffCheck_app.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/gh/diffCheck/diffCheck/test.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/gh/diffCheck/diffCheck_app.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#! python3
2+
3+
import Rhino
4+
import Rhino.Geometry as rg
5+
6+
import os
7+
import typing
8+
9+
import diffCheck
10+
11+
# import diffCheck.df_joint_detector # diffCheck.
12+
import diffCheck.df_geometries # diffCheck.
13+
# # from diffCheck.df_geometries import DFVertex, DFFace, DFBeam, DFAssembly # diffCheck.
14+
# # import diffCheck.df_transformations # diffCheck.
15+
# # import diffCheck.df_util # diffCheck.
16+
17+
18+
if __name__ == "__main__":
19+
joint_detector = diffCheck.df_joint_detector.JointDetector(brep=i_breps[0]).run()
20+
print(type(joint_detector))
21+
# print(joint_detector.run())
22+
beam = diffCheck.df_geometries.DFBeam.from_brep(i_breps[0])
23+
"""
24+
Main function to test the package
25+
:param i_breps: list of breps
26+
:param i_export_dir: directory to export the xml
27+
:param i_dump: whether to dump the xml
28+
"""
29+
# beams
30+
beams : typing.List[diffCheck.df_geometries.DFBeam] = []
31+
for brep in i_breps:
32+
beam = diffCheck.df_geometries.DFBeam.from_brep(brep)
33+
beams.append(beam)
34+
35+
# assembly
36+
assembly1 = diffCheck.df_geometries.DFAssembly(beams, i_assembly_name)
37+
38+
# dump the xml
39+
xml : str = assembly1.to_xml()
40+
if i_dump:
41+
assembly1.dump_xml(xml, i_export_dir)
42+
o_xml = xml
43+
44+
# show the joint/side faces
45+
o_joints = [jf.to_brep() for jf in assembly1.all_joint_faces]
46+
o_sides = [sf.to_brep() for sf in assembly1.all_side_faces]

src/gh/tester.ghx

Lines changed: 750 additions & 865 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)