Skip to content

Commit

Permalink
added htmlBuild.js
Browse files Browse the repository at this point in the history
  • Loading branch information
timmcginley committed May 17, 2022
1 parent 7b5bee7 commit 9e47b21
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ output/22_06_01/index.html
output/22_07_01/index.html
output/22_08_01/index.html
output/22_09_01/index.html
__pycache__/HTMLBuild.cpython-39.pyc
11 changes: 7 additions & 4 deletions HTMLBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,22 @@ def writeHTML(model,name):
cont+=2*"\t"+"<link rel='stylesheet' href='../css/html-build.css'></link>\n"

# ---- ADD HTMLBUILD JS - COULD ADD OTHERS HERE :)
# cont+=2*"\t"+"<script src='../js/html-build.js'></script>\n"
cont+=2*"\t"+"<script src='../js/html-build.js'></script>\n"

# ---- JQUERY - IT WOULD BE CRAZY NOT TO
cont+=2*"\t"+"<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.js'></script>\n"

# ---- CLOSE HEAD
cont+=1*"\t"+"</head>\n"

# ---- ADD BODY
cont+=1*"\t"+"<body>\n"
cont+=1*"\t"+"<body onload=\"main()\">\n"

# ---- ADD CUSTOM HTML FOR THE BUILDING HERE
cont+=writeCustomHTML(model)

# ---- CLOSE BODY AND HTML ENTITIES
cont+=1*"\t"+"</body>\n"
cont+=1*"\t"+"</body>\n"
cont+=0*"\t"+"</html>\n"

# ---- WRITE IT OUT
Expand All @@ -87,7 +90,7 @@ def writeCustomHTML(model):
project = model.by_type('IfcProject')[0]
custom+=2*"\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
site = model.by_type('IfcSite')[0]
site_elev = site.RefElevation
Expand Down
8 changes: 8 additions & 0 deletions batch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Hi :) if just starting out - probably should start with the duplex.py this main.py references models that aren't shared on this repo

import HTMLBuild as hb

i=1
while i < 10:
hb.modelLoader("22_{}_01".format(str(i).rjust(2, '0')))
i+=1
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

import HTMLBuild as hb

hb.modelLoader("22_02_01")
hb.modelLoader("22_05_01")
4 changes: 3 additions & 1 deletion output/duplex/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<html>
<head>
<link rel='stylesheet' href='../css/html-build.css'></link>
<script src='../js/html-build.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.js'></script>
</head>
<body>
<body onload="main()">
<project- name="Duplex Apartment">
<site- lat="(41, 52, 27, 840000)" long="(-87, -38, -21, -839999)" elev="-0.0">
<building->
Expand Down
18 changes: 17 additions & 1 deletion output/js/html-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
// we need to start (over)loading stuff into the DOM.
// we need to split the screen into section and plan and KPIs and info - where should this go?


function main() {
const floors = document.getElementsByTagName("floor-");
let num_floors = floors.length;
console.log(num_floors);
$('project-').prepend('number of floors is '+num_floors);
$('project-').prepend('\nsite elevation is '+$('site-').attr('elev'));
}


/*
var container = document.getElementById('pcontainer');
container.insertBefore(document.createElement("p"), container.firstChild);
*/

// <project-> - title etc.... | <site-> - also menu? site specific data?
// ---------------------------------------------------------------------
// <building-> - name of the building? this then needs to split in two...
Expand All @@ -11,6 +27,6 @@
// #section | #plan
// this shows the floors | this shows a floor in plan |
// in section | #plan |
// <floor...-> ------------------------------------------
// <floor...-> -----------------------------------------
// | <properties-> |
// ---------------------------------------------------------------------

0 comments on commit 9e47b21

Please sign in to comment.