[Plugin] bim-tools 0.13.4(june 22, 2015)
-
@brewsky said:
I would really appreciate it if you could also try the new 0.10a version on your MAC.
where, exactly [i.e. a direct link] do I get 0.10a, I've been to your site a few times and keep getting the other??
probably just being dim...
Also, I want to explain the basic difference between
.show
an.show_modal
on mac.with
.show
when you click off the dialog it disappears behind the active window. The only way to retrieve it is to have code that brings it back after an action ends [only works if your still in the same tool] or move the window out of the way to click it back to 'front'.with
.show_modal
the window stays in front [while in 'SU' context], so you can see it while you do other things in the tool or even if you change tools. The 'downside is it requires a click to 'bring to focus' and a second click to 'do', unless you 'Cmd Click' which bypasses the focus requirement.If a tool 'highjacks' SU and blocks changing tools etc. [as this does currently, but I hope will be fixed], it is possible to to use !visable? then .show after each action, but show_modal is easier.
The main point I'd like to make is there is no problem having platform conditional methods in a cross platform script.
SU does it all the time, after all mac SU is Cocoa, a different version of Ruby, and different browser engine, so using specific mac code is the right way to do mac things... maybe, my code wasn't wrapped properly to hide the system calls from PC's but that shouldn't be to hard [says the ruby nuubee]
post a link and I'll try and do some more testing later
john -
@driven said:
where, exactly [i.e. a direct link] do I get 0.10a
I'm sorry! I could have known it would get lost in the thread... I posted it somewhere halfway the discussion because it's only a bit of an unstable preview. This is the link to the post:
[url]http://forums.sketchucation.com/viewtopic.php?
f=323&t=34007&sid=a1cea85c17015237152249205e1c68d2&start=45#p387104[/url]@driven said:
The main point I'd like to make is there is no problem having platform conditional methods in a cross platform script.
I think I had the wrong idea about the SketchUp API, it's documented as a single cross-platform API, but in reality the same method seems to have a different result calling it on PC or MAC. If the result differs, it might be better to also name them differently?
I guess, when this is the case for more API calls, then conditional methods is indeed the way to go, especially
for this show / show_modal case(I got an empty window using modal on PC)@driven said:
maybe, my code wasn't wrapped properly to hide the system calls from PC's but that shouldn't be to hard [says the ruby nuubee]
I really appreciate your help fixing the code for Mac. The reason I picked TT's custom web dialog class is because I can easily copy that to the other version of my plugin.
I want it to work as good as possible for Mac and PC. Wouldn't it be best to further optimise TT's class together so everyone can use it for their projects? Like add the /tmp folder and maybe the rewind option you used? -
You cannot get away from platform specific quirks (oddities, etc.) As John said, Mac uses the obsolete Ruby v1.8.5-p0, and Safari for webdialogs. PC uses Ruby v1.8.6-p287, and MSIE WebBrowser.
The first step is to be sure these global boolean constants are defined:
MAC = ( Object;;RUBY_PLATFORM =~ /(darwin)/i ? true ; false ) OSX = MAC unless defined?(OSX) WIN = ( not MAC ) unless defined?(WIN) PC = WIN unless defined?(PC)
Using boolean constants is MUCH faster that using string platform name constants !!
On the Mac, "modal" translates to "always on top", but does NOT cause App blocking, like it does on PC.
Then in your code:MAC ? dlg.show_modal() ; dlg.show()
or
if WIN show() else show_modal() end
Also.. Ruby is a dynamic language. It can be defined and configured at runtime. Some coders prefer to have Mac definitions and PC definitions in separate files. (A SINGLE module or class definition, can span MULTIPLE files. They do NOT need to be in ONE file.)
module BIMTOOLS require('bimtools/lib/mac_methods.rb') if MAC require('bimtools/lib/win_methods.rb') if WIN # ... more code here that relys upon methods loaded # into THIS module by one of the two files above. end
... BUT some prefer to DYNAMICALLY define platform specific methods in the same file (they think it may be easier to maintain.) Ex:
module BIMTOOLS # define a "info" module function here; # if MAC def self.info() # # ... code specific the Mac/OSX platform # end elsif WIN def self.info() # # ... code specific the Windows platform # end else # perhaps raise an exception here ? end # ... more code here that relys upon # methods defined per platform above. end
The advantage to dynamically defining methods that are platform specific.. is runtime speed. They will not be slowed down by any further platform conditional evaluations, because they are evaluated only at loadtime. (And a Mac will not magically morph into a PC, in mid-session.)
-
Also in the [ Code Snippets ] sticky thread, I am endevouring to collect links on Platform Specific Quirks and Issues.
-
Some notes on
WebDialog
and the differences between platforms: http://forums.sketchucation.com/viewtopic.php?f=180&t=23445 -
I tried the export to IFC in v 0.9.2 and export worked fine and looked right with the FZK Viewer but when trying to import into Revit 2012 I got these errors: http://dl.dropbox.com/u/7990360/Bimtest01_Error%20Report.html
-
@pixero said:
I tried the export to IFC in v 0.9.2 and export worked fine and looked right with the FZK Viewer but when trying to import into Revit 2012 I got these errors: http://dl.dropbox.com/u/7990360/Bimtest01_Error%20Report.html
Thanks for trying and reporting back! I have had success importing the IFC's into ArchiCAD and Arkey(dutch CAD software we use at work) but I also got an error importing into bimserver.org. I haven't got around to further look into it. Can you also send me the IFC file? The errors revit reports only point to a row number, it does not explain on what kind of element it fails.
For the entire IFC export I still don know what's the best way to go, at the moment I see 3 possibilities:
- build the IFC translator myself(that's what I have done until now, but a huge amount of work to ever get full export AND import.
- use the TNO IFCengine dll( should work very well, I believe they have a MAC version as well, is free to use, but is not open source )
- use/contribute to [url]ifcopenshell.org[/url](I would like that best on the long term, but it is a work in progress itself)
I think for the moment I will add some more functionality(and fixes ) to my existing exporter, as long as there are only walls and windows and the like, I think that is quickest.
Anyone some more tips on this matter?
-
@dan rathbun said:
You cannot get away from platform specific quirks (oddities, etc.)
@dan rathbun said:
The advantage to dynamically defining methods that are platform specific.. is runtime speed. They will not be slowed down by any further platform conditional evaluations, because they are evaluated only at loadtime. (And a Mac will not magically morph into a PC, in mid-session.)
It seems like a good idea to me to start a side-project to catch and streamline all these platform specific quirks.
Like you say, create a general module that dynamically serves you the right methods based on the current platform. Set up a bit like Thomthom's webdialogpatch-class.module CROSSPLATFORM class CpWebDialog < WebDialog def show() if MAC show_modal() elsif WIN # this is not correct because it points to itself # but I hope you get what I mean... show() end end end end # call something like dialog = CROSSPLATFORM;;CpWebDialog.new # call show the same way on MAC and PC dialog.show
So all everyone has to do in your plugin-code is point to the "CROSSPLATFORM" module for these kinds of "quirky" API-calls.
It can imagine it's way too much overhead to include all these for every small plugin, but maybe make it "pluggable" by just adding a separate .rb for all used functions to a "crossplatform"-subfolder and dynamically require all ruby files present in this folder...
But still beeing a bit of a newbie, I probably miss a thing or two
-
Hi,
identifying the differences is the biggest hurdle. Most rubies need little or no 'fettling'.
I've got this working to the extent of mimicking your 'youTube' clip, plus the minimise button which took forever to get hold of.... It was only after I noticed it's missing from your demo....
Two big issues for me. why are you using 1999 XHTML? it's 2012...
#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.
Safari was having troubles with this so I changed it to
%(#008040)[<!DOCTYPE html>
<head>
<meta charset=utf-8' />
<title>BIM-Tools - webdialog</title>
<link href='" + @pathname + "/bt_dialog.css' rel='stylesheet' type='text/css' />
</head>
<body>]
, which works for what you have so far...
Personally I think it should all be html 5 first, then add conditionals for older IE when it that all works.the other was you have two different image paths, niether was relative to the 'temp' html to I move it
@tm=(rand(9999).to_s.strip) @tmpPath=(@pathname + '/btDialog_' + @tm + '.html')
into the ui folder (which is as fast as '/tmp' to create, but harder to delete...), then I put a second copy of image folder in there as well. So I've got the background image, minus the js...
john
-
@driven said:
Two big issues for me. why are you using 1999 XHTML? it's 2012...
Two words: Internet Explorer
Only the very latest, IE9, support some HTML5. To support IE8 and IE7 will still some people use (heck, some even use IE6!!!) one need to use the good ol' fashioned HTML4 or XHTML1.0.
@driven said:
Personally I think it should all be html 5 first, then add conditionals for older IE when it that all works.
No point then, if the content is the same - if you're not using any of the HTML5 features.
Mind you, I'm very tempted in dropping support for IE older than version 9 in my future plugins. Damn-it people, the upgrade is free! <rant/>
-
IE 9 does not run on Windows XP, which is still the world's most-used OS; although Win 7 is catching up.
-
on mac SU uses,
<html> <head> <title>Generate Report</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="../js/dcbridge.js" type="text/javascript" language="JavaScript"></script>
for it's very dynamic 'Dynamic Components', and even 'Web Textures' has no historic XHTML
<html dir="ltr"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Pragma" content="no-cache"> <title>Get Texture</title> <script type="text/javascript" src="/3dwarehouse/resources/3140728709-main_base_module.js"></script> <link href="/3dwarehouse/resources/1561881125-sketchup-textures.css" rel="stylesheet" type="text/css"> <script src="http://www.google.com/jsapi?key=ABQIAAAA5El50zA4PeDTEMlv-sXFfRSsTL4WIgxhMZ0ZK_kHjwHeQuOD4xTdBhxbkZWuzyYTVeclkwYHpb17ZQ&hl=en" type="text/javascript"></script><script type="text/javascript" async="" src="http://www.google-analytics.com/ga.js"></script><script type="text/javascript" src="http://maps.google.com/maps?file=googleapi&key=ABQIAAAA5El50zA4PeDTEMlv-sXFfRSsTL4WIgxhMZ0ZK_kHjwHeQuOD4xTdBhxbkZWuzyYTVeclkwYHpb17ZQ&v=2.182&callback=google.loader.callbacks.maps&async=2&hl=en"></script><style type="text/css">@media print{.gmnoprint{display;none}}@media screen{.gmnoscreen{display;none}}</style><script type="text/javascript" charset="UTF-8" src="http://maps.gstatic.com/cat_js/intl/en_ALL/mapfiles/340c/maps2.api/%7Bmod_cb_api,mod_drag,mod_ctrapi,mod_scrwh,mod_zoom,mod_api_gc%7D.js"></script><script type="text/javascript" charset="UTF-8" src="http://maps.gstatic.com/intl/en_ALL/mapfiles/340c/maps2.api/mod_qdt.js"></script><style type="text/css" media="screen">#panoflash1 {visibility;hidden}</style><script type="text/javascript" charset="UTF-8" src="http://maps.gstatic.com/intl/en_ALL/mapfiles/340c/maps2.api/mod_dspmr.js"></script></head>
is it different on PC's...
john -
@driven said:
%(#008040)[<!DOCTYPE html>
<head>
<meta charset=utf-8' />
<title>BIM-Tools - webdialog</title>
<link href='" + @pathname + "/bt_dialog.css' rel='stylesheet' type='text/css' />
</head>
<body>]This is invalid. You have a doctype decleration, but no HTML tag.
HTML5 starts with:
<span class="syntaxdefault"><br /></span><span class="syntaxkeyword"><!</span><span class="syntaxdefault">DOCTYPE HTML</span><span class="syntaxkeyword">><br /><</span><span class="syntaxdefault">html</span><span class="syntaxkeyword">><br /><</span><span class="syntaxdefault">head</span><span class="syntaxkeyword">>...</</span><span class="syntaxdefault">head</span><span class="syntaxkeyword">><br /><</span><span class="syntaxdefault">body</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault"> </span>
@driven said:
on mac SU uses,
<span class="syntaxhtml"><span class="syntaxdefault"> </span><span class="syntaxkeyword"><</span><span class="syntaxdefault">html</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword"><</span><span class="syntaxdefault">head</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword"><</span><span class="syntaxdefault">title</span><span class="syntaxkeyword">></span><span class="syntaxdefault">Generate Report</span><span class="syntaxkeyword"></</span><span class="syntaxdefault">title</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword"><</span><span class="syntaxdefault">meta http</span><span class="syntaxkeyword">-</span><span class="syntaxdefault">equiv</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"Content-Type"</span><span class="syntaxdefault"> content</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"text/html; charset=utf-8"</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">/><br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword"><</span><span class="syntaxdefault">script src</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"../js/dcbridge.js"<br /></span><span class="syntaxdefault"> type</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"text/javascript"</span><span class="syntaxdefault"> language</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"JavaScript"</span><span class="syntaxkeyword">></span><span class="syntaxdefault"></script></span></span>
for it's very dynamic 'Dynamic Components', and even 'Web Textures' has no historic XHTML
That is even more historic than XHTML - it doesn't have a doctype deceleration, so its HTML3, 2 etc. It's HTML rendered in Quicks Mode.
-
@thomthom said:
This is invalid. You have a doctype decleration, but no HTML tag.
well spotted, I threw the baby out with the bath-water...
Safari, just adds it back in when it renders, so it runs fine with it missing... oops@unknownuser said:
That is even more historic than XHTML - it doesn't have a doctype deceleration, so its HTML3, 2 etc. It's HTML rendered in Quicks Mode.
The SU code is pulled directly from the rendered page in SU, so any PC specific code may be missing.
Most of Apple's html is missing the Doctype as well but renders as HTML5.
The problem on Safari is if the doctype is XHTML but the content='text/html;charset=utf-8' then any XHTML specific js will fail.
BTW. you got me rechecking html 5 meta tags and I just tested <meta http-equiv='refresh' content='30' /> and it works inside SU, so I'll try and see if the temp file can be avoided by using it instead.
john -
seemingly valid on mac
<!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>
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.
I need to try this with some of my other scripts... john
-
-
@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!
Advertisement