Closed theo-armour closed 5 years ago
Hi @theo-armour,
This works like a charm. I think in case of large files visualizing JSON and Rad data will slow down the browser. Maybe we can have a show raw rad, show raw JSON button that opens the file in a different tab.
If I separate materials in JSON schema is that going to help with Handle Material item on your list? Then you can look up material/modifier for each surface by name.
@theo-armour,
Note
Needed to add an extra replace CRLF with " " on line 100 of rad-to-three.js so as to work with all files.
const parseRadRe = /^\s*([^0-9].*(\s*[\d.-]+.*)*)/gm; // how does this work?
const rawObjects = radText.match( parseRadRe ).filter( word => word.trim().length > 0 && > !word.trim().startsWith( '#' ) );
const rawObjects2 = rawObjects.map( item => item.replace(/\r\n|\n/g, " " ) );
Can you share the file that wasn't working with me? There is a line in rad_object_to_json
that does the same: https://github.com/mostaphaRoudsari/rad-to-json/blob/d28ea72b08d27f10d5631156cf87b3fc46a5584c/rad2json.js#L53-L54
@mostaphaRoudsari
Can you share the file that wasn't working with me? There is a line in rad_object_to_json that does the same...
The lines you quote are in my R2/R3 as well. I had to add the extra replace call.
If you comment out my extra replace, you will see a JSON file that looks like this:
Note the appearance of the '\n' and the the not groups of three arrays
Almost any file will have these errors - including the default file that appears when you first load the script. I think the issue has to do with all manner of combinations of tabs and spaces between data.
I think in case of large files visualizing JSON and Rad data will slow down the browser. Maybe we can have a show raw rad, show raw JSON button that opens the file in a different tab.
I will do this in the next release or so. This will help with large files. There are a bunch of other things to be done involving merging many polygons into single Three.js meshes that will speed things up.
If I separate materials in JSON schema is that going to help with Handle Material item on your list?
Let's talk about this in the R3 update issue - which I am about to write
@theo-armour, Thanks.
I think the issue has to do with all manner of combinations of tabs and spaces between data
That is what \s supposed to do: It should match any whitespace and next line. I will check again.
Let's talk about this in the R3 update issue - which I am about to write
Sounds good!
@theo-armour,
I double checked and \s works totally fine when I test on a local server but I can see the error that happens on the webpage. Not sure why but I added your fix for now. Thanks!
@ladybug-tools/spiders
Concept
Translate Radiance RAD file types into Three.js views - all building on Mostapha's efforts
See also: Radiance RAD to JSON Read Me
Fingers crossed this will be the start of a new, simpler Rad Viewer
Full Screen: Radiance RAD to Three.js R1
Read Me
Note
Needed to add an extra replace CRLF with " " on line 100 of rad-to-three.js so as to work with all files.
To do / wish list