Did more searching, and found one spot that said the source couldn't be changed (at least not in the way I was meaning). I guess to do what I really want to do, I'd have to dive deep into this, and I just don't have the time since my development work is a "side" project at work.
I DO however have time to use TT's SKUI, so that's what I'm going with, since I have already used it for a couple dialogs already in this project.
Latest posts made by placidfury
-
RE: HTMLDialog - Change source on the fly? Possible?
-
HTMLDialog - Change source on the fly? Possible?
I'm just now digging into HTMLdialog usage, as my plugin has kind of outgrown the limited input boxes.
I tried building a test function, which would build my HTML into a string then assign as the source of the dialog. And it works, for the initial page build and show, but after the user picks something from a dropdown and clicks a button to apply the choice, I want the page to re-load with the selected item in the dropdown changing - but after the button is clicked, the dialog seems to re-load with the initial HTML code, or if I try to rebuild the string and reassign the source, I get a blank window.
Can the source of the dialog be re-assigned while the dialog is open?
I've tried to find good examples of how to do this, but all the examples I find seem to be so simple as to not address this, or so over my head they're not much help...Thanks!
Test code below, hope this makes sense... and not too ugly:
module Htmlexample def self.show_dialog model = Sketchup.active_model attrdict = model.attribute_dictionary('BCEWP') usage = 'BldgMod' html = '' html = ' <!DOCTYPE html> <html> <head> <title>Cutlass Dialog</title> <link rel="stylesheet" href="' + Sketchup.find_support_file('Plugins') + '/dialtest/layout.css" type="text/css" media="screen" charset="utf-8" /> </head> <script> function sendDataToSketchUp() { var user_module = document.getElementById("id1"); sketchup.getUserInput(user_module.value) } </script> <body> <div class="content"> <form> <select id="id1" name="modules">' $lastmod = MDAT(0, 'LastUsedBldgMod') attrdict.each { | key, value | if key.to_s.include? "Last" else if key.to_s.include? usage if value.to_s == $lastmod html = html + '<option value="' + value.to_s + '" selected>' + value.to_s + '</option>' else html = html + '<option value="' + value.to_s + '">' + value.to_s + '</option>' end end end } html = html + '</select> <button onclick="sendDataToSketchUp()">Confirm</button> </form> </div> </body> </html>' options = { dialog_title; 'Choose Module', preferences_key; 'cutlass.dynodial', scrollable; false, resizable; true, width; 300, height; 110, min_width; 250, min_height; 70, style; UI;;HtmlDialog;;STYLE_DIALOG } dialog = UI;;HtmlDialog.new(options) dialog.set_html(html) if dialog.visible? dialog.bring_to_front else dialog.add_action_callback("getUserInput"){|action_context, user_module| puts("JavaScript said user_module is #{user_module}.") $lastmod = user_module.to_s MDAT(1, 'LastUsedBldgMod', $lastmod) } dialog.show end #if end end #module
-
RE: Ruby Component Insertion and Attributes - Not Updating
Just now saw this - I have been unable to get a batch redraw of DC's to not take significant time. It seems the more DC's you redraw in the same operation, the longer each successive one takes to redraw.
Eventually, I found a way around this by simply scrapping my usage of DC's and switching to groups. Operations on groups are essentially instantaneous.
I'd use DC's if it's one or few objects at a time, or something I want the user to be able to interact with via the DC interface, but most of my plugin's objects are not that - I'm manipulating them with my code. Since I'm doing Engineered Wood Products layouts on very large multifamily buildings, I end up with thousands of objects to manipulate, and DC's simply didn't work well enough, as they were too slow. And the fact that even changing one property - even one that doesn't affect geometry - forces you to have to redraw them each, that time involved was a deal-breaker. -
RE: SVG Toolbar Icons - Gradients Missing
GIMP doesn't do vector graphics, no? It can import, but converts to raster. I tried a couple apps that work with SVG, to no avail - they all output different code in the SVG, and each one did different (incorrect) things when I tried to use them on my toolbar in SketchUp.
-
RE: SVG Toolbar Icons - Gradients Missing
For what it's worth, I think the problem with Inkscape is that it makes the gradient in two parts, and has the gradient units listed as "userSpaceOnUse", and I think SketchUp doesn't know what to do with that. SketchUp likes the X/Y portion to be formatted in percentages, not on-the-fly which the userSpaceOnUse implies.
-
RE: SVG Toolbar Icons - Gradients Missing
Yeah, not sure what else to try. I guess I either stick with images or manually edit the SVG code so SketchUp will read it properly, for each icon. Which I have no desire to do, as I have 59 buttons as of now, so... yeah.
-
RE: SVG Toolbar Icons - Gradients Missing
Confirmed - when I edited the SVG code to look like this:
<linearGradient x1="50%" y1="100%" x2="50%" y2="0%" id="linearGradient-1"> <stop stop-color="#ff00ff" offset="0%"></stop> <stop stop-color="#ffd2ff" offset="100%"></stop> </linearGradient>
then the gradient DID indeed show up.
So, anyone know of an app that will put the SVG code in a format SketchUp likes?
-
RE: SVG Toolbar Icons - Gradients Missing
Attached is the stock create camera SVG for comparison.
And yes, I tried using their SVG's and they work fine.
Added the smoove icon.
-
RE: SVG Toolbar Icons - Gradients Missing
I opened the advance camera tools and sandbox tools SVG's by opening in Inkscape, and I can't for the life of me spot anything special about the gradient fills in, for instance, the smoove tool icon, or the add camera icon. The only thing I obviously see (in Inkscape, anyway) is that the gradient names are negative numbers in the stock SVG's. Looking at the code of the SVG, there are substantial style differences between what Inkscape generated and what the stock files have - how to fix this, I don't know. I'm not an expert on the SVG file format.