[Plugin] bim-tools 0.13.4(june 22, 2015)
-
@thomthom said:
In Safari?
To be more precise...
Apple WebKit + WebCore frameworks as used in Safari, Widgets and SU WebDialogs will render html 5 with or without the doctype specified.
Apple have only recently added '<!DOCTYPE html>' to the headers on their own sites [after complaints about compliance], but a lot of it's demo and pre-installed html files still have no doctype specified.If specified correctly other doctypes appear to function as intended. If the doctype is incorrect apple renders what it can as html.
I haven't fully got my head around all of this, but, it appears, that if a link, url, uri, src or href relies on having correct XHTML i.e. (application/xhtml+xml, application/xml, or text/xml), then (text/html) will produce a blank link or even a blank page.
Also XHTML as (text/html) blocks some css completely.
In the past with a few webDialogs that had failed either completely or partially, changing or omitting the doctype allowed them to work.
Although I don't fully understand it all, it's to do with there being two different DOM's that dhtml can address depending on the doctype.
Enlighten me... john
-
I find it very odd if WebKit render documents sans any doctype as HTML5. It would break old sites.
-
@thomthom said:
I find it very odd if WebKit render documents sans any doctype as HTML5. It would break old sites.
what I'm say is the opposite WebKit render documents as HTML5sans any doctype. if it has no html 5 content it won't add it...
-
@driven said:
I've got this working to the extent of mimicking your 'youTube' clip,
Great!
@driven said:
plus the minimise button which took forever to get hold of.... It was only after I noticed it's missing from your demo....
O how stupid of me, i didn't even notice... I made the video on linux(wine). The button is not working in the current version, i stripped out all the javascript. I was planning to recreate the full html on each action using
set_html
, to keep the webdialog simple. Maybe it's automatically fixed when it works on safari(I don't know if wine uses a version of IE, or the default linux browser).@driven said:
why are you using 1999 XHTML? it's 2012...
Didn't give that much thought(didn't even realize there would be differences between MAC and PC, when I started out).
I tried to keep it as common as possible. Having a DTD seemed very important, how else could a browser pick the correct way of rendering? But when i read a bit more about HTML5 it seems they left the DTD out ?! And xml-style(like <br />) is valid if you want to, but does not seem to be the preferred way...When I read a bit more about HTML5, this seems the cleanest:
<!DOCTYPE html> <html> ... </html>
I changed this in my code, no problems on IE9, I will also give it a try on IE8...
But declaring the additional<meta charset=utf-8'>
seems a good idea. And maybe a language identifier???
Would be great if google used a built-in chrome for SketchUp for PC, it beeing webkit-based would simplify things.
And then I could use the http://bimsurfer.org/ webGL IFC viewer from inside SketchUp to check the model in IFC format!@driven said:
the other was you have two different image paths
I will try your other trick for the temp files...
Thanks!
-
@driven said:
seemingly valid on mac
<meta http-equiv='refresh' content='30' />
Would this not mean that the webdialog is only refreshed every 30 seconds?
I'm planning to refresh the webdialog on every selection change in sketchup, I guess it will not work in that case, right?@driven said:
with this you only need the one temp file
@tmpPath=(@pathname + '/btDialog.html') > @tmpFile=(File.open(@tmpPath, 'w+'))
with relative links for js, images and css, much cleaner.
Is the
@pathname
in this case "/tmp" or the normal path to the SketchUp plugins folder?
Otherwise I don't really understand the "relative links". -
These is all the changes except a copy of the image file is also added to ui folder, there's a couple of puts that aren't needed...
I tried a 1second refresh, but you can't change anything that quick... also tried 3 + 3000
The 30 second refresh, allows enough time to make changes and submit, but time may be irrelevant (as long as it's enough), having this appears to allow resetting in general, which doesn't happen by default in WD's, does the ruby observer rewrite the html on selection changes? I have to re click the house to get the next elements info? The webdialog doesn't auto update that...# bt_dialog.rb # # Copyright (C) 2011 Jan Brouwer <jan@brewsky.nl> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. class Bt_dialog def initialize(project) @project = project bt_lib = @project.library # Create WebDialog instance @dialog = UI;;WebDialog.new("BIM-Tools menu", false, "bim", 243, 150, 150, 150, true) @dialog.min_width = 243 @dialog.min_height = 25 @dialog.max_width = 243 @dialog.max_height = 1200 @dialog.set_position(150,150) @pathname = File.expand_path( File.dirname(__FILE__) ) mainpath = @pathname.split('ui')[0] @imagepath = mainpath + "images" + File;;SEPARATOR @bt_lib = bt_lib @javascript = "" # create BIM-Tools selection object require 'bim-tools/lib/clsBtSelection.rb' @selection = ClsBtSelection.new(@project, self) @h_sections = Hash.new # define sections require 'bim-tools/ui/clsEntityInfo.rb' entityInfo = ClsEntityInfo.new(self) @h_sections["EntityInfo"] = entityInfo #@h_sections["ProjectData"] = ClsProjectData.new # PC Load paths will have a ';' after the drive letter. @is_mac = ($LOAD_PATH[0][1..1] != ";") puts 'mac' #@tm=(rand(9999).to_s.strip) @tmpPath=(@pathname + '/btDialog.html') @tmpFile=(File.open(@tmpPath, 'w+')) @tmpFile.rewind @tmpFile.puts html @tmpFile.rewind @dialog.show_modal @dialog.set_file(@tmpPath) if File.exists?(@tmpFile) @tmpFile.close puts 'closed' end # Attach the observer. Sketchup.active_model.selection.add_observer(MySelectionObserver.new(@project, self, entityInfo)) end def refresh @dialog.set_file( html ) end def html content = "" @h_sections.each_value do |section| content = content + section.html end return html_top + content + html_bottom end def html_top #Note that XHTML 1.0 previously defined that documents adhering to the compatibility guidelines were allowed to be served as text/html, but HTML 5 now defines that such documents are HTML, not XHTML. return " <!DOCTYPE html> <html> <head> <meta charset='UTF-8' /> <meta http-equiv='refresh' content='30' /> <title>BIM-Tools - webdialog</title> <link href='" + @pathname + "/bt_dialog.css' rel='stylesheet' type='text/css' /> </head> <body> " end def html_bottom return " </body> </html> " end def webdialog return @dialog end def close if @dialog.visible? @dialog.close end end def selection return @selection end def imagepath return @imagepath end def project return @project end # This is an example of an observer that watches the selection for changes. class MySelectionObserver < Sketchup;;SelectionObserver def initialize(project, bt_dialog, entityInfo) @project = project @bt_dialog = bt_dialog @entityInfo = entityInfo end def onSelectionBulkChange(selection) # open menu entity_info als de selectie wijzigt #js_command = "entity_info(1)" #@dialog.execute_script(js_command) #js_command = 'entity_info_width("' + width.to_s + '")' #@dialog.execute_script(js_command) @entityInfo.update(selection) #@bt_dialog.webdialog.set_html( @bt_dialog.html ) end def onSelectionCleared(selection) @entityInfo.update(selection) #@bt_dialog.webdialog.set_html( @bt_dialog.html ) end end end
-
Demo version, still contains bugs
Updated version:- Removed image path from css
- added webdialogpatch.rb(still contains the temp path)
- changed html type
John, I was just uploading this new version when i saw your post, I will compare it with the version you just posted and post another one. Thanks!
-
I'll give this a spin, I don't see an issue with having concurrent test variations at this stage, for me it's more a test of WD's on mac, different flavors gives me somethings to test against. john
-
@driven said:
does the ruby observer rewrite the html on selection changes? I have to re click the house to get the next elements info?
(here on PC) every time a new set_html, for:
- if no building element selected: show message and further empty window
- if you select a (different) building element the dialog updates to show the selected elements info
- if multiple building elements are selected it shows the values that are the same for all selected elements
There is no dynamic javascript/AJAX content.
-
So, it's basiclly working, churning out .htmls into --TMP-- folder.
just read your cross post, because it disappears behind the window I need to re-click the house to see the dialog, and this updates the selection,
It is also updating when I change selection in view, I just couldn't see it... so I moved the drawing and I can...
it does need .show_modal to make any sense... john
-
@driven said:
So, it's basiclly working
Cool!
@driven said:
churning out .htmls into --TMP-- folder.
Ooops, didn't think of this temp folder spamming. Maybe best to just delete the old tmp-html when a new one is loaded? I don't think the timer will work for my dialog because of the many content changes.
@driven said:
it does need .show_modal to make any sense... john
Yes, I forgot to add the show for pc, and show_modal for Mac, I'm currently fixing that...
-
@brewsky said:
Ooops, didn't think of this temp folder spamming. Maybe best to just delete the old tmp-html when a new one is loaded? I don't think the timer will work for my dialog because of the many content changes.
Can the 'old' tmp file can be deleted immediately after it's loaded?
I'm going to do more test with the timer as it may be useful for other stuff, if not this...
-
Just found that line 19 in clsBimTools.rb shows the console everytime I start SU. Had to edit it away.
-
@pixero said:
Just found that line 19 in clsBimTools.rb shows the console everytime I start SU. Had to edit it away.
Ah thanks for mentioning! That's an old line I have used for easy debugging. I stripped it out...
-
Today "officially" posted the new version I have been working on.
See the first post...Still need to fix bugs(infinite loops/too much overhead etc.)
Also have to improve on the webdialog temp files.
And IFC support...But I'm getting there!
Cheers,
Jan -
Good job!refuel!
-
@brewsky said:
Today "officially" posted the new version I have been working on.
See the first post...Still need to fix bugs(infinite loops/too much overhead etc.)
Also have to improve on the webdialog temp files.
And IFC support...But I'm getting there!
Cheers,
JanOpen the tool always show this, do not know how to use
No BIM-Tools entities selected -
@guanjin said:
Open the tool always show this, do not know how to use
No BIM-Tools entities selectedI need to make a little tutorial to explain how it works, I will try to that after the weekend.
You first need to select some faces and press the second button in the toolbar, the faces will be "converted" to BIM-objects.
The message "No BIM-Tools entities selected" will be replaced by object-properties when you select a BIM-object.I hope this gets you started
Thanks for trying anyway!
-
Thank you, I do not see video
-
@guanjin said:
Thank you,China
οΌI do not see video
Advertisement