Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

.DS_Store
model/21_01.ifc
model/21_01_01.ifc
model/21_02_01.ifc
Expand Down
25 changes: 14 additions & 11 deletions HTMLBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import ifcopenshell
import os.path
import time
from pathlib import Path

def modelLoader(name):

'''
load the IFC file
'''

model_url = "model/"+name+".ifc"
dir_path = Path(__file__).parent
model_url = Path.joinpath(dir_path, 'model', name).with_suffix('.ifc')
start_time = time.time()

if (os.path.exists(model_url)):
Expand All @@ -23,7 +24,8 @@ def modelLoader(name):
print("\tConvert : {:.4f}s".format(float(time.time() - start_time)))

else:
print("\nERROR: please check your model folder : " +model_url+" does not exist")
print("\nERROR: please check your model folder : " +str(model_url)+" does not exist")


def writeHTML(model,name):

Expand All @@ -32,13 +34,14 @@ def writeHTML(model,name):
'''

# parent directory - put in setting file?
parent_dir = "output/"
model_dir = Path.joinpath(Path(__file__).parent, 'output', name)

# create an HTML file to write to
if (os.path.exists("output/"+name))==False:
path = os.path.join(parent_dir, name)
os.mkdir(path)
if not os.path.exists(model_dir):
# path = os.path.join(parent_dir, name)
os.mkdir(model_dir)

f_loc="output/"+name+"/index.html"
f_loc=Path.joinpath(model_dir, 'index.html')
f = open(f_loc, "w")
cont=""

Expand Down Expand Up @@ -69,7 +72,7 @@ def writeHTML(model,name):
f.close()

# ---- TELL EVERYONE ABOUT IT
print("\tSave : "+f_loc)
print("\tSave : "+str(f_loc))

def writeCustomHTML(model):

Expand All @@ -86,7 +89,7 @@ def writeCustomHTML(model):

# ---- ADD PROJECT CUSTOM ENTITY
project = model.by_type('IfcProject')[0]
custom+=3*"\t"+"<project- name=\"{d}\">\n".format(d=project.LongName)8
custom+=3*"\t"+"<project- name=\"{d}\">\n".format(d=project.LongName)
# it looks like it would make sense to use the DOM here and append stuff to it...

# ---- ADD SITE CUSTOM ENTITY
Expand Down
Binary file removed __pycache__/HTMLBuild.cpython-39.pyc
Binary file not shown.
6 changes: 3 additions & 3 deletions output/duplex/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<project- name="Duplex Apartment">
<site- lat="(41, 52, 27, 840000)" long="(-87, -38, -21, -839999)" elev="-0.0">
<building->
<floor- class="floor_upper" name='Roof' level='3' elev="6.00000000000039" >Roof<span class="floor_stats">6.0</span> </floor->
<floor- class="floor_upper" name='Level 2' level='2' elev="3.100000000000378" >Level 2<span class="floor_stats">3.1</span> </floor->
<floor- class="floor_upper" name='Roof' level='2' elev="6.00000000000039" >Roof<span class="floor_stats">6.0</span> </floor->
<floor- class="floor_upper" name='Level 2' level='1' elev="3.100000000000378" >Level 2<span class="floor_stats">3.1</span> </floor->
<floor- class="floor_ground" name='Level 1' level='0' elev="0.0" >Level 1<span class="floor_stats">0.0</span> </floor->
<ground-></ground->
<floor- class="floor_lower" name='T/FDN' level='0' elev="-1.25" >T/FDN<span class="floor_stats">-1.25</span> </floor->
<floor- class="floor_lower" name='T/FDN' level='-1' elev="-1.25" >T/FDN<span class="floor_stats">-1.25</span> </floor->
</building->
</site->
</project->
Expand Down