⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • PdScript-interpreter for GUI Scripting in SketchUp-Ruby

    14
    0 Szavazatok
    14 Hozzászólások
    6k Megtekintések
    H
    Hello, I made a small page for the sketchup plugin on my website. I updated the above link for the download. Hans-Peter
  • NewLISP-interpreter in SketchUp-Ruby

    16
    0 Szavazatok
    16 Hozzászólások
    4k Megtekintések
    H
    Hello, I made a small page for the sketchup plugins on my website. I updated the above link for the download. Hans-Peter
  • [code] MetaObserver

    2
    0 Szavazatok
    2 Hozzászólások
    820 Megtekintések
    Dan RathbunD
    Why is this called "Meta" ?? The definition http://dictionary.reference.com/browse/meta means "self-referential".
  • Detect User Access to Clipboard

    9
    0 Szavazatok
    9 Hozzászólások
    1k Megtekintések
    D
    Hi, I have an Applescript that opens RC then /copy/pastes/runs, it could easily include additional instructions. eg. open/join an existing ruby first. I had one that also closed RC again, but I don't need that. I can launch from inside SU or from separate menu-bar item that will open SU if it's closed. Obviously mines a mac-hack, can you do that on a PC? My experiments showed RC as the only reliable way in unless you paste/write to file and have 'system' request Sketchup to load it. Permissions can be tricky. A WebDialog would avoid opening RC, but would need to be open itself first. john
  • SurDebug Error

    3
    0 Szavazatok
    3 Hozzászólások
    522 Megtekintések
    A
    Change to a English version of Sketchup. The code try to open Console with following shorcut : Alt W+R and it only works with english version
  • Mysterious Bug [followme related]

    30
    0 Szavazatok
    30 Hozzászólások
    1k Megtekintések
    Dan RathbunD
    No problem... Just a note that the disposal of the tools filename array needs to be inside the conditional true blocks. (Otherwise we might get an error with the & method if tools gets set to nil, prematurely.) # run when file loads # prevdir = Dir.getwd Dir.chdir Sketchup.find_support_file("Tools") tools = Dir["*.rb"] Dir.chdir(prevdir) prevdir = nil if ( tools & $LOADED_FEATURES == tools ) && Sketchup.active_model && Sketchup.active_model.active_entities && Sketchup.active_model.tools.active_tool_id != 0 UI.start_timer(2.0, false){ LineA.create_line } tools = nil else timer_LineA = UI.start_timer(2.0, true){ if ( tools & $LOADED_FEATURES == tools ) && Sketchup.active_model && Sketchup.active_model.active_entities && Sketchup.active_model.tools.active_tool_id != 0 UI.stop_timer(timer_LineA) tools = nil LineA.create_line end #if } end
  • "refresh" Group BoundingBox

    8
    0 Szavazatok
    8 Hozzászólások
    679 Megtekintések
    thomthomT
    Note that you also have ComponentDefinition.image? as Image elements also have definitions. Important to note when iterating the definitions collection.
  • How can I create a 1 meter square plane in Ruby?

    2
    0 Szavazatok
    2 Hozzászólások
    165 Megtekintések
    danielbowringD
    Sketchup uses inches, but provides methods so you can use any measure you like -> http://code.google.com/apis/sketchup/docs/ourdoc/numeric.html val = 1.m # 1 meter pt1 = [0,0,0] pt2 = [val,0,0] pt3 = [val,val,0] pt4 = [0,val,0] my_face = entities.add_face [pt1, pt2, pt3, pt4]
  • MR2 broke plugin during C extension require

    51
    0 Szavazatok
    51 Hozzászólások
    2k Megtekintések
    thomthomT
    @draftomatic said: That's a good point... What would you recommend? Should I try to eliminate those that clash from what I'm including with my plugin? I'd recommend that you check carefully what files you bundle. Since it's a shared environment you want to avoid potential clashes. Remove any file you don't need. Check the ones you add if they modify existing methods. And beware that Set.rb will cause incompatible modifications to the Set class.
  • Win32API or DL library usage?

    7
    0 Szavazatok
    7 Hozzászólások
    1k Megtekintések
    Dan RathbunD
    Ruby (v1.8.6-p287) Windows One-Click Installer (offsite) Helper script: Ruby LOAD PATHs script (Win32) : ver 3.0.1 Topic: Win32API vs DL lib Files: Win32API and Win32OLE so files
  • Sketchup View origin

    12
    0 Szavazatok
    12 Hozzászólások
    2k Megtekintések
    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 Szavazatok
    6 Hozzászólások
    233 Megtekintések
    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 Szavazatok
    11 Hozzászólások
    458 Megtekintések
    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 Szavazatok
    6 Hozzászólások
    617 Megtekintések
    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 Szavazatok
    13 Hozzászólások
    752 Megtekintések
    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 Szavazatok
    9 Hozzászólások
    386 Megtekintések
    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 Szavazatok
    5 Hozzászólások
    231 Megtekintések
    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 Szavazatok
    12 Hozzászólások
    353 Megtekintések
    D
    Yes, readability. If it was operating on large quantities of data, I would definitely use your suggested method.
  • Web dialog problem

    11
    0 Szavazatok
    11 Hozzászólások
    849 Megtekintések
    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 Szavazatok
    7 Hozzászólások
    234 Megtekintések
    TIGT
    Sorry about the typo ! I've corrected the original post [== a brain-fart - I must must type 'module' several times a day !]

Advertisement