🏱 PlaceMaker | 25% off for February including new Google Earth data imports! Learn more
  • Sketchup View origin

    12
    0 Votes
    12 Posts
    2k Views
    A
    @dan rathbun said: EVERYTHING you see on the screen, in Microsoft Windows, IS a window. A button, an edit box, a static text label, a checkbox, ... ALL of them are a window, but their style does not have a resizable frame or a caption bar, like a application window or a dialog (which are also a window.) You have to get the handle for the Sketchup Application window (the parent window,) then use that in view_window_handle = FindWindowEx.call(parent_window_handle,0,"AfxFrameOrView80u",0) Thank you really much!!!, That should help!!!!
  • Mac Unique 'per model' ID: question

    6
    0 Votes
    6 Posts
    187 Views
    D
    @dan rathbun said: object_id is a Ruby integer, that is only unique within a single session. It will be reused in the next session. (The possibility exists that you may get that integer assigned to another model, in another session. With this 'Untitled[0..-1] Sketchup' is always reports 'Unsaved_260629430_su.txt' until one of them is has been written to, then the number sequence randomizes. If I 'Save' an 'Unsaved_260629430_su.txt' the full script will (eventually) update and re-name it's file. I also have a cleanup sequence for closed unsaved models. I'll try and wrap it all, and see how it goes. john
  • Mac truncates tool names question.

    11
    0 Votes
    11 Posts
    245 Views
    Dan RathbunD
    @dan rathbun said: For custom Ruby tools, active_tool_name is always "RubyTool", and active_tool_id is always the same integer, something around or slightly more than 50,000. (Yesterday it was giving me 50006 for any custom tool I activated.) Actually just tested this again... (because something seemed weird, as I was sure in the past that I had gotten different tool ids for custom tools.) And what is happening is that unique tool ids DO get assigned (it seems,) if the tool is associated with a UI::Command object. Then in this case the tool_id is actually the command id. How this happens, I have not yet figured out.
  • Multithreading - Queue?!

    6
    0 Votes
    6 Posts
    569 Views
    N
    @thomthom said: Do you have a snippet of multi-threaded SketchUp Ruby code? I'd be very interested! hehe, okay, here it is.... @unknownuser said: facesCount = FACE.length # wieviel FlĂ€chen habe ich? $facesPerThread = facesCount.divmod($opt.cpuCores.to_i) # Wieviel FlĂ€chen bekommt jede CPU? thread = Array.new $j = 0 $opt.cpuCores.to_i.times do |i| $k = ($j-1) + $facesPerThread[0] # Der Rest der FlĂ€chen wird noch auf die einzelnen CPUs aufgeteilt if $facesPerThread[1] > 0 $k += 1 $facesPerThread[1] -= 1 end #UI.messagebox $k thread[i] = Thread.new do for l in $j..$k do #UI.messagebox FACE[l] out = FACE[l].isInCylinder break if out end out end # Startpunkt fĂŒr den nĂ€chsten Thread $j = $k + 1 end thread.each do |tmp| tmp.join end I tested it with some simple models and I saved some single seconds.... not too much, but faster then without any threads.... I'm very interested to hear what do you think about it...
  • Statusbar text in model

    13
    0 Votes
    13 Posts
    539 Views
    Dan RathbunD
    @tig said: The registry entry isn't updated until Sketchup closes, so you can't check that while inside a SKP, BUT you can get it at startup. Sorry, forgot to note that. (Added a note to my previous post.) @tig said: Incidentally, if you try 'read_default' for 'Visible' it fails to get it as I suspect it's the wrong sort of key [i.e. not REG_Z] ? Yep... Sketchup.read_default() still cannot read DWORD values (and also seems not to be able to read even string values in some of the OEM keys, which I never noticed happen in v7.) I use Win32API calls to read entries (of all types) in the OEM keys. (Requires the Win32API.so file.)
  • Frontside and backside colour

    9
    0 Votes
    9 Posts
    317 Views
    C
    Thanks a lot for your help. Now this code is very helpful for me! ChrisKa
  • Group the selected entities and give them a name[Solved]

    5
    0 Votes
    5 Posts
    186 Views
    TIGT
    Nothing! Just to make reading it easier ? Note that gp=some_entities.add_group(some_stuff) is ONLY successful if all of the some_stuff entities are in the some_entities context AND it's the active_entities: otherwise you'll Bugsplat! So it's fine when you are adding a selection to a group in the same entities - as to select them they must all be in the same [active] entities context and you make the new group in that context too. Just be wary of grouping groups and adding things that are in one context into another context - to do that IS possible but involves either complex 'cloning' of geometry OR getting the definition of groups/instances and repeating their instances [temporarily] in the new context before erasing the original one[s]...
  • Min. z value of some points

    12
    0 Votes
    12 Posts
    182 Views
    D
    Yes, readability. If it was operating on large quantities of data, I would definitely use your suggested method.
  • Web dialog problem

    11
    0 Votes
    11 Posts
    593 Views
    Dan RathbunD
    @driven said: @dan rathbun said: The error is a simple typo It may well have the typo, but when I ran his 'working bits' in the clean wd, it also has JS issues... Could be that he's using a double-quoted heredoc instead of a single-quote heredoc wrapper ??
  • Ruby Scripting Question - Defining Functions

    7
    0 Votes
    7 Posts
    169 Views
    TIGT
    Sorry about the typo ! I've corrected the original post [== a brain-fart - I must must type 'module' several times a day !]
  • Can Plugins Create Key Bindings?

    6
    0 Votes
    6 Posts
    314 Views
    Dan RathbunD
    Pls move to Developers forum.
  • PLUGINS wish list

    14
    0 Votes
    14 Posts
    323 Views
    M
    Hello, Ce plugin peut sans doute ĂȘtre exploitĂ© autrement, mais cela est au delĂ  de mes compĂ©tences... En tout cas, si tu as besoin du code pour avancer, fais le moi savoir.
  • Possible to change component size to a fixed value?

    4
    0 Votes
    4 Posts
    431 Views
    thomthomT
    You could edit the tranaformation matrix directly...
  • Accessing System Preferences from Ruby

    2
    0 Votes
    2 Posts
    264 Views
    TIGT
    This PC only code returns the keys and values for any valid Registry entry. See the notes at the end for usage require 'sketchup.rb' module TIG ### for PC use only ! def self.getregentries(key="") key.tr!("/","\\") cfile=File.join(ENV["TEMP"], "regentries.cmd") tfile=File.join(ENV["TEMP"], "regentries.tmp") f=File.open(cfile, "w") f.puts("reg query \""+key+"\" /f \"*\" /s > \""+tfile+"\"") f.close UI.openURL("file;///"+cfile) sleep(0.1) until File.exist?(tfile) sleep(0.1) lines=IO.readlines(tfile) hents={} lines.each{|line| line.chomp! next if line.empty? or line=~/#{key}/ or line=~/^End/ ent=line.split(" ") hents[ent[1]]=ent[3] } File.delete(tfile)if File.exist?(tfile) File.delete(cfile)if File.exist?(cfile) return hents end end ### Example;- ### ents=TIG.getregentries "HKEY_CURRENT_USER\\Software\\Google\\SketchUp8\\File Locations" ### Find the ents entry 'by name' thus; ### ents["Components"] >>> 'C;\Program Files\Google\Google SketchUp 8\Components\' ### Returns 'nil' if there is no key. ### Read the notes at the end on how to get a key/value. Copy/paste code into a file called say TIG-getregentries.rb in the Plugins folder, to use type the example in the Ruby Console OR inside a script...
  • [SOLVED] Booleans operations available to free SU?

    9
    0 Votes
    9 Posts
    583 Views
    jolranJ
    Was gonna post a snippet this morning but you guys did the work for me So I see John, you got an error "is a Pro only feature." That pretty much sums it up. Like Tig also suspected. Dan said. @unknownuser said: Makes sense.. otherwise we'd be able to write Pro feature custom tools for Free Yeah, thats why I posted the question. Being a PRO user I momentarily took this method for granted when I did not receive an error message in my code. Thanks everyone involved for clearing this up. Maybe Google should put PRO label for methods like this after the 8+ in the API.
  • Why Freemium Doesn't Work

    4
    0 Votes
    4 Posts
    191 Views
    chrisglasierC
    I see this free business as a way to create new business activities for yourself. An off-the-wall example - if you wanted to get into publishing (a very long time ago) you would have needed to invent the alphabet or suchlike. Obviously, you could not charge for this at the beginning because no one had any idea what to do with it nor later because it had already been freely copied and integrated. But it had served your initial purpose establishing your name and fame in the new highly competitive and expanding market you created. Like Ford or Kodak perhaps. Moreover always one step ahead you were able to invent new-alphabet based ventures that people were only too happy to pay for. Isn't this what Google are doing with free search and advertising. Could this be the basis for free Sketchup - models as the means of communication. The new hieroglyphs? This pay-for premium services is all well and good but rather weak-kneed - a bit of a side show really. PS great 'where's the coffee story'!
  • Need to add keyboard shortcuts to Scenes

    35
    0 Votes
    35 Posts
    6k Views
    K
    @thomthom said: And my impression is that they already have this software package - they just needed the keyboard shortcut controller for the scenes... This is correct.
  • Win32ole issues

    12
    0 Votes
    12 Posts
    811 Views
    daikuD
    No Bugsplats at all.
  • Global vertex position fails, when I pull a face

    9
    0 Votes
    9 Posts
    162 Views
    thomthomT
    Note that the method doesn't transform the point itself - but returns a copy.
  • "SketchUp Ruby Cookbook"

    3
    0 Votes
    3 Posts
    615 Views
    Dan RathbunD
    We have one here at SCF: [Code Snippets] ... although it doesn't have the word "cookbook" in the title.

Advertisement