🏢 PlaceMaker | 25% off for February including new Google Earth data imports! Learn more
  • <LocalJumpError: return from proc-closure> in WebDialog

    5
    0 Votes
    5 Posts
    1k Views
    J
    Maybe, but I don't understand it myself. Rather than returning from the proc, the proc itself evaluates, and that is what is returned.
  • Invalid Web Dialog

    10
    0 Votes
    10 Posts
    2k Views
    J
    Or just recreate the dialog every time... def create_dialog @dlg = UI;;WebDialog.new( ... ) @dlg.show { } end
  • Scope of class.initialize

    7
    0 Votes
    7 Posts
    877 Views
    J
    @cjthompson said: The reason I was asking was in regards to this post: http://forums.sketchucation.com/viewtopic.php?f=180&t=22567 Is it possible that the bounding box's initialize was interfering with the web dialog's? I don't think so because I have seen invalid dialogs aldo, and I'm fairly certain I have not redefined initialize at the top-level. I see invalid dialogs through variables that reference a dialog that has been closed. I've added some example code here.
  • 7.1 API Release Notes

    10
    0 Votes
    10 Posts
    1k Views
    T
    @jim said: Hey! thanks remus. I have made this sticky - for a few weeks, at least. Nothing major - but being able to screen-shot a WebDialog from Ruby is interesting. I misinterpreted the word Screen shot, I'm hoping for pictures to be added to the code examples for the entire ruby api, where ever possible. It would help get more potential ruby scriptwriters on board.
  • Synchronously or asynchronously

    6
    0 Votes
    6 Posts
    510 Views
    thomthomT
    I had a look at it. But I get an Access Denied message when I try to call back to Ruby. Turns out IE's XMLHttpRequest only works with files on the net - not local files and other stuff. http://www.webdeveloper.com/forum/showpost.php?s=d7e6a32ad41106e35a2d51afbce8f374&p=749574&postcount=10
  • Note to Google: Better Browser == Better WebDialogs

    22
    0 Votes
    22 Posts
    906 Views
    thomthomT
    I think the most important criteria: which ones will let the .execute_script be synchronous?
  • Hide/show a WebDialog

    7
    0 Votes
    7 Posts
    345 Views
    thomthomT
    On OSX - the window is actually just hidden. The embedded WebBrowser object is created as you add the HTML to the WebDialog object - as oppose on PX, where it's rebuilt on evvery .show....
  • Plugin Search

    3
    0 Votes
    3 Posts
    258 Views
    Dave RD
    Thanks Jeff, that's it and that was very quick.
  • Finding the cursor position?

    10
    0 Votes
    10 Posts
    3k Views
    thomthomT
    Not at once, but stack them up. I think. I've not used the feature. Maybe the tools have to implement the suspend and resume methods...
  • IDEA - Omni Push Pull Tool

    12
    0 Votes
    12 Posts
    755 Views
    halroachH
    @kwistenbiebel said: Wuaaah...wouldn't that create a temporal anomaly in the subspace field ? It depends on how much dilithium crystals we put into it...
  • Hide Toolbars On Load

    16
    0 Votes
    16 Posts
    2k Views
    Dan RathbunD
    @simonstaton said: ...now is there one of these [methods] that I can make that will hide the getting started toolbar on load? ...[snip]... ANSWER: Yes there is ! The following code hides the "GettingStarted" toolbar at any time, whether it's docked or floating. status = UI.set_toolbar_visible("GettingStarted", false)
  • Looking for a plugin to automate material colors

    5
    0 Votes
    5 Posts
    219 Views
    G
    @chris fullmer said: The button is called color all the same or something like that. Here's a screen grab that shows it. Hope it helps, let me know if it does not do quite what you were hoping for. [attachment=0:3e6t77oc]<!-- ia0 -->all_same.png<!-- ia0 -->[/attachment:3e6t77oc] Chris Ahh, ok, now I see what you're talking about! I followed your instructions and the model did indeed turn all white, but it's lacking its textures, unfortunately. Let me show you an example of what I'm looking to do: I model with color data and presentation purposes: [image: sketchup%20texture%20with%20color.jpg] For certain rendering effects and photoshop post-processing, it's VERY handy to keep the textures, but have them have no saturation and full brightness: [image: sketchup%20texture%20no%20color.jpg] There may be no easy way to do this other than old-fashioned elbow grease. It just gets very redundant, very quick to manually adjust each material
  • DHTML dialog boxes

    5
    0 Votes
    5 Posts
    249 Views
    thomthomT
    @gruff said: Okay... So are there any books that can walk me through creating a simple hello world web dialog for SketchUp ruby. I don't think you'll find any which directly relates to Sketchup. But any book that talks about web applications will work.
  • Built-in JSON in Internet Explorer 8 IE8

    8
    0 Votes
    8 Posts
    1k Views
    thomthomT
    Doing some more testing. I added this meta tag to a Strict document: <meta http-equiv="X-UA-Compatible" content="IE=8"/> The user-agent string still reported IE7, but the new CSS feature outline worked. If I remove the meta tag the outline property doesn't render. And just to make sure, I used document.documentMode to get the render mode, with the meta tag it reports IE8, without IE7. So this is another nail in the coffin for the user-agent string <- mostly pointless and highly unreliable. I attached the test code I used. Extract it to your plugins menu and type this into the Console to open up a webdialog: dlg = UI;;WebDialog.new("Test") dlg.set_url Sketchup.find_support_file "test.html", "Plugins/" dlg.show It will first report IE7 mode. But remove the comments around the META tag and see how the blue outline now renders and the JS reports IE8 mode. You can also see the different behaviour from regular IE windows. test.zip
  • Attention script writers - GSU selection nodes....

    4
    0 Votes
    4 Posts
    673 Views
    thomthomT
    Some might not be able to - as they use custom inference.
  • To_1 conversion method

    6
    0 Votes
    6 Posts
    204 Views
    J
    Good catch!
  • Mathematics related problem

    23
    0 Votes
    23 Posts
    2k Views
    M
    ahh notepad++ old friend.. i used to do my c++ programming on it and then take it to university to test it! haha i think i am gonna take the night off and start over with this tomorrow might crack something.. good night world!
  • How to read the windows registry?

    18
    0 Votes
    18 Posts
    14k Views
    Al HartA
    This ruby uses Win32API to read the registry, and works on Vista. But it may not work if you are not an Administrator (who knows). It is looking for the entry: HKEY_LOCAL_MACHINE\SOFTWARE\Render Plus Systems\IRender_nxt_location So you will have to change it to the registry key you are looking for. class Your_class def self;;get_reg_functions @@RegCloseKey = Win32API.new('advapi32', 'RegCloseKey', 'L', 'L') if @RegCloseKey == nil @@RegOpenKeyEx = Win32API.new('advapi32', 'RegOpenKeyEx', 'LPLLP', 'L') if @RegOpenKeyEx == nil @@RegQueryValueEx = Win32API.new('advapi32', 'RegQueryValueEx', 'LPLPPP', 'L') if @RegQueryValueEx == nil #@@RegCreateKeyEx = Win32API.new('advapi32'', 'RegCreateKeyEx', 'LPLLLLPPP' 'L') end#def def self;;get_registry_entry(key, sdefault = "") #trace("key; %s",key) get_reg_functions key.tr!('/','\\') sret = sdefault # strip of section spos = key.Find('\\') if (spos < 1) do_error("Cannot parse registry key %s - Key must contain a backslash\n",key) return(sdefault) end#if firstpiece = key.Left(spos) mainkey = key.Mid(spos+1) if (firstpiece == "HKEY_LOCAL_MACHINE") root = HKEY_LOCAL_MACHINE elsif (firstpiece == "HKEY_CURRENT_USER") root = HKEY_CURRENT_USER else printf("Registry key must start with HKEY; %s",key) return(sdefault) end#if # strip off final key spos = mainkey.ReverseFind('\\') if (spos < 1) printf("Cannot parse registry key %s - Key must contain a backslash\n",key) return(sdefault) end#if lastpiece = mainkey.Mid(spos+1) mainkey = mainkey.Left(spos) phkey = [0].pack('L') # a 4 byte string of 0's go get handle ret = @@RegOpenKeyEx.call(root, mainkey, 0, KEY_READ, phkey) printf("ret; %s mainkey; %s\n",ret,mainkey) if (ret != 0) printf("key not found; %s\n",key); return(sdefault) end#if hkey = phkey.unpack('L').first # convert stron pointer to integer # create a buffer for the result buf = 0.chr * 1024 size = [buf.length].pack('L') # store size of buffer ret = @@RegQueryValueEx.call(hkey, lastpiece, 0, 0, buf, size) if (ret != 0) printf("location not found; %s\n",key); return(sdefault) end#if # if ret == ERROR_MORE_DATA, then we should call again with a larger buffer @@RegCloseKey.call(hkey) sret = buf.nstrip # stop at 0 byte printf("sret; %s length; %d key; %s\n",sret,sret.length,key) return sret end#def # this returns the location without a slash def self;;find_application_folder(smodule) #skey = sprintf("HKEY_LOCAL_MACHINE\\SOFTWARE\\Render Plus Systems\\%s_location", smodule) skey = sprintf("HKEY_LOCAL_MACHINE/SOFTWARE/Render Plus Systems/%s_location", smodule) sloc = get_registry_entry(skey) printf("sloc; %s from skey; %s\n",sloc,skey) if (sloc && FileTest.exists?(sloc)) sloc.tr!('/','\\') #printf("RETURNING 1 sloc; %s\n",sloc) return(sloc) if sloc != nil end#if printf("Registry entry not found; %s\n", skey) return nil end#def end#class Your_class Your_class;;find_application_folder("IRender_nxt") read_registry.rb
  • Trace() - display message with traceback to caller

    3
    0 Votes
    3 Posts
    4k Views
    Al HartA
    @thomthom said: :thumb: Good stuff. Though, I have a thought: Why not define the trace method in a Trace class, and then include the class to the methods you want. That way you don't have multiple copies all over the place? Good idea, I could include it in a module of functions. But I would still have to distribute the trace module with each application. And there might be a problem with versions. When a user had installed more than one RPS application, say a new version of A and and old version of B, then A might wind up inheriting from the B version of the module, if the B version was loaded into SketchUp after the A version. At one point we considered having a common set - called RPS_common. But still the problems of installing and uninstalling became difficult.
  • Making components...

    3
    0 Votes
    3 Posts
    207 Views
    TIGT
    Alternatively just make a group and add entities to it... then turn it into a component when you are done... ### you'll need to define stuff like entities, pt1/2 etc earlier on - it's skipped here for brevity group=entities.add_group() group.entities.add_line(pt1,pt2) ### add as much as you want... instance=group.to_component definition=instance.definition definition.name="My Definition's Name" instance.name="My Instance's Name" tr=Geom;;Transformation.new(ptxyz) ### ptxyz = new insertion point, as it'll be located at the ORIGIN by default instance.transform!(tr) ###to move or even rotate/scale it as needed ### etc ### to now add further stuff to definition use### definition.entities.add_...

Advertisement