ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • Getting Ruby to work on Mac

    13
    0 Votes
    13 Posts
    572 Views
    D
    @dan rathbun said: If I was a Mac only user, I'd be raisin' hell... getting a petition going, or similar to get the Mac Sketchup Ruby updated (at least equal to that of the PC.) It would be nicer if both platforms were updated to the latest patch in the 1.8.7 trunk. I am in the process of raising hell to Google... @dan rathbun said: It would be beneficial if you could figure out a way, to install an additional frameworkized v1.8.7 Ruby beneath (alongside) the Sketchup obsolete Ruby, and then have a "switching" utility that allowed the user to change the symbolic links, to load the newer Ruby. Sigh... these convoluted workarounds are getting old. I think it will be resort to using shell commands instead of the Ruby libraries I need. Mac comes with curl and gzip, and I believe this will eliminate my need for stringio as well. Thank you for your input Dan. I will pass this on to Google.
  • ModelTranslation[X,Y,Z]

    4
    0 Votes
    4 Posts
    388 Views
    P
    I seem to have determined the units of the ModelTranslation values - inches. My problem now is to reset the z-axis of the model to make it easier to calculate elevations. For instance, I want to show the impact of a flood which reached a certain height. That height is given in AHD (Australian Height Datum) relative values. I presume that the location data elevations are also AHD-relative. I can represent a flood by drawing a rectangle centred on 0,0,0 and pulling the surface up to the height of the flood. The idea works well, apart from some apparent inaccuracies in the terrain data. However, it is far easier to simply pull the "water" to a given height in metres, than to convert the height to inches, subtract the Z translation in inches, then reconvert the difference to metres to calculate a level relative to 0,0,0 to pull to. Flood level
  • (solved)locked files

    7
    0 Votes
    7 Posts
    1k Views
    jolranJ
    OOPs There was a typo in my code. Now the comps are loading(hopefully). Forget the last post. Edit: Problem solved by saving components(like Dan said) in user/my documents/anyfolder. Then I can copy and paste from there.
  • Mac Toolbars Editable?

    15
    0 Votes
    15 Posts
    3k Views
    H
    @driven said: jim, thom you can edit the nibs on NSPanels, and I guess you could change the content if you know all the tool codes... [attachment=0:1e21rm0n]<!-- ia0 -->tool palettes .jpg<!-- ia0 -->[/attachment:1e21rm0n] john hi i want this can you show me how?
  • How to force IE 8 or 9?

    4
    0 Votes
    4 Posts
    196 Views
    thomthomT
    Yea, all kinds of stranges rules comes to play when an embedded webcontrol is used. ...and it's damn hard to find anything documented.
  • [C\C++] SketchUp window handle

    12
    0 Votes
    12 Posts
    841 Views
    thomthomT
    Here's a way that doesn't iterate every windows there is. It enumerates the windows of the calling thread. Cuts down the searching and ensure that you don't get the wrong window. win32_sketchup_window.rb
  • Colors and values

    10
    0 Votes
    10 Posts
    403 Views
    thomthomT
    @chris fullmer said: Thom gave a great example with some if loops I think that let you blend the entire rainbow smoothly from red to pink to purple to blue to cyan to green to yellow then orange and back to red. I'd have to search a ways back to think where that was posted though. I couldn't find the example I posted earlier either, so here it is again: <span class="syntaxdefault"><br /></span><span class="syntaxcomment"># Soft Selection Colour Map<br /># Colours to translate to. First is max, last is bottom.<br /></span><span class="syntaxkeyword">@</span><span class="syntaxdefault">clr </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[]<br />@</span><span class="syntaxdefault">clr </span><span class="syntaxkeyword"><<</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Color</span><span class="syntaxkeyword">.new(</span><span class="syntaxdefault">255</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">  0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">  0</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxcomment"># 100%<br /></span><span class="syntaxkeyword">@</span><span class="syntaxdefault">clr </span><span class="syntaxkeyword"><<</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Color</span><span class="syntaxkeyword">.new(</span><span class="syntaxdefault">255</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">255</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">  0</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxcomment">#  75%<br /></span><span class="syntaxkeyword">@</span><span class="syntaxdefault">clr </span><span class="syntaxkeyword"><<</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Color</span><span class="syntaxkeyword">.new(</span><span class="syntaxdefault">  0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">255</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">  0</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxcomment">#  50%<br /></span><span class="syntaxkeyword">@</span><span class="syntaxdefault">clr </span><span class="syntaxkeyword"><<</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Color</span><span class="syntaxkeyword">.new(</span><span class="syntaxdefault">  0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">255</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">255</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxcomment">#  25%<br /></span><span class="syntaxkeyword">@</span><span class="syntaxdefault">clr </span><span class="syntaxkeyword"><<</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Color</span><span class="syntaxkeyword">.new(</span><span class="syntaxdefault">  0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">  0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">255</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxcomment">#   0%<br /></span><span class="syntaxdefault">def self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">clr</span><span class="syntaxkeyword">;</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">clr</span><span class="syntaxkeyword">;</span><span class="syntaxdefault"> end </span><span class="syntaxcomment"># Accessor<br /># (?) Should this be done by CExt?<br /></span><span class="syntaxdefault">def self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">value_to_color</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">value </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> max </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 100</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> min </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> clr </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">clr</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment"># Cap value to range.<br /></span><span class="syntaxdefault">  value </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[</span><span class="syntaxdefault">min</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> value</span><span class="syntaxkeyword">].</span><span class="syntaxdefault">max<br />  value </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[</span><span class="syntaxdefault">max</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> value</span><span class="syntaxkeyword">].</span><span class="syntaxdefault">min<br />  </span><span class="syntaxcomment"># Calculate what colours to blend between and the blending ratio.<br /></span><span class="syntaxdefault">  n </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">value</span><span class="syntaxkeyword">-</span><span class="syntaxdefault">min</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">/</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">max</span><span class="syntaxkeyword">-</span><span class="syntaxdefault">min</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">/</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">clr</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">length</span><span class="syntaxkeyword">-</span><span class="syntaxdefault">1.0</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  index1 </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> n</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_i<br />  index2 </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[</span><span class="syntaxdefault">index1</span><span class="syntaxkeyword">+</span><span class="syntaxdefault">1</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> clr</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">length</span><span class="syntaxkeyword">-</span><span class="syntaxdefault">1</span><span class="syntaxkeyword">].</span><span class="syntaxdefault">min<br />  ratio </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> n </span><span class="syntaxkeyword">-</span><span class="syntaxdefault"> index1<br />  return clr</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">index2</span><span class="syntaxkeyword">].</span><span class="syntaxdefault">blend</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">clr</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">index1</span><span class="syntaxkeyword">],</span><span class="syntaxdefault"> ratio</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">end<br /></span> That's the method I use in Vertex Tools to colour the soft selection: [image: KA9c_clr.png]
  • Javascript problem

    8
    0 Votes
    8 Posts
    339 Views
    T
    Thanks for you responses! And yes you are right, I need to organize my scripts better, you've been of great advice!
  • Ruby Code Generator

    5
    0 Votes
    5 Posts
    572 Views
    Dan RathbunD
    And I see you just joined SCF, so I'll assume your new to Ruby... see: Ruby Newbie's Guide to Getting Started Get the CHM Ruby Reference, as instructed in the Guide... Get the full Ruby installer: Ruby (v1.8.6-p287) Windows One-Click Installer Get the !loadpaths.rb script (so you can access standard Ruby lib files): [Code] Ruby LOAD PATHs script (Win32) (Dan Rathbun / Jim Foltz)
  • JQuery 1.7 Released

    4
    0 Votes
    4 Posts
    208 Views
    jolranJ
    Yes, I understand. I've seen your praising for it. That made me want to try to learn it in addition to standard JS. Can say.. Haven't been using Jquery for long(or JS for that matter), but only the selectors themself is worth the use of it.
  • C Extension project - Async HTTP transfer - CURL?

    10
    0 Votes
    10 Posts
    2k Views
    T
    @adamb said: Ruby has "green threads" which is simply the Ruby interpreter locally slicing & dicing its own execution thread. But since the Ruby intepreter itself is being scheduled from the runloop of SketchUp, its of little use for asyncronous work. In other words, if I have a progress bar inside a C extension, it will suffer same 'halt' as whole SU user interface, when Ruby is doing heavy lifting, right? Does it mean that I have to start an independent thread with the progress bar to have it updated in same conditions?
  • Temporary drawing elements vs. invisible objects

    2
    0 Votes
    2 Posts
    211 Views
    thomthomT
    Creating entities in SketchUp is slow! Very slow and it gets slower the more entities you have in the context. It also triggers all kinds of observers etc. If possible, avoid any kind of calculations without temp geometry. ( Some times you have to, like when you want to trigger SU's merge feature to make sure things heal up properly. Or if you need to get the current user axis - then you need to create two dummy groups.) And yes, using the built in methods of SU for calculations is much faster than trying to do it in Ruby. Make use of the Geom module for all it's worth. For Vertex Tools I even ported the method that calculated soft selection to a C extension because in Ruby it was slow as a sleeping snail. Any calculation, even simple 2 + 2 operations eat time in Ruby - which you notice quickly when you do it in a look. But the biggest bottleneck is adding entities in SU, and that's not much you can work around other than trying to use the bulk methods whenever possible.
  • Mac ruby editor

    5
    0 Votes
    5 Posts
    460 Views
    gillesG
    there is one that is a SU plugin http://forums.sketchucation.com/viewtopic.php?t=25800#p222075
  • Unified Info for Noobies? Wiki?

    5
    0 Votes
    5 Posts
    241 Views
    thomthomT
    That sounds good. Though, might be good to start simple, just so that it doesn't get so complex it'll never finish. (I've been there soooo many times... )
  • Parameter passing across two files

    3
    0 Votes
    3 Posts
    126 Views
    C
    Great! Thank you Dan.
  • Installers for plugins.

    11
    0 Votes
    11 Posts
    1k Views
    D
    A lightweight solution for plugin installers is to use self-extracting zips: http://www.izarc.org/tutorials.html#sfx izarc gives you a few basic options as well. You'll have to make separate installers for 32/64bit Windows (since 64-bit systems use C:\Program Files (x86)).
  • Copyright icons.

    6
    0 Votes
    6 Posts
    178 Views
    jolranJ
    Asking is probably wise. I'll see what I'll do later on. It's also not that hard creating new icons Thanks for the advice, both of you!
  • It's that time again - mind is goo

    5
    0 Votes
    5 Posts
    255 Views
    TIGT
    (2 * 3).m
  • Webpage pin

    4
    0 Votes
    4 Posts
    158 Views
    A
    1001 Thanks Chris ! it's exactly what I was looking for. You can't imagine how many time I search.
  • [plugin] Ruby Raytracer

    17
    0 Votes
    17 Posts
    4k Views
    N
    @unknownuser said: Thanks for the sample code and the explanation. I wasn't aware that a Raytracer can be written in such a small piece of code!! Quite tiny indeed... there are others too, like http://tog.acm.org/resources/GraphicsGems/gemsiv/minray/

Advertisement