🏢 PlaceMaker | 25% off for February including new Google Earth data imports! Learn more
  • Own Dynamic Component supported function

    6
    0 Votes
    6 Posts
    294 Views
    T
    The @source_entity was the key. No echo! And get_attribute should only read values and not mess the dictionary.
  • Deflate compression - zlib?

    5
    0 Votes
    5 Posts
    420 Views
    TIGT
    @thomthom said: @dahovey said: The ultimate thing I need to do is generate a PNG image file, being able to 'paint' each pixel. Already studied PNG documentation for what I need. That's simple enough. The compression seems to be the tough thing. Ditto - I was looking at it to read PNG data - easy up til the compression bit... A cross-platform Java .jar can read and write PNG file [or most other image formatf] pixel by pixel - that's how my ImageTrimmer and related tools work... My 'thumbnail' tools take the larger image and the JAR saves a PNG with the reduced size... ImageTrimmer reads the image's PNG pixels and if they are transparent it makes them white if they abut an 'edge' they become black, any other pixels become white - the bufferedimage is written to a new PNG; for the purposes of this tool a DAT file is also written containing 0/1 for white/black pixels this is read directly into SUp to make edges that are them 'simplified'... It's easy to see a converse operation where the RB writes a DAT file of pixel values and the JAR reads that and makes a PNG using those... I know it's clunky but until Ruby gets some decent image manipulation tools built in it works... If you'd like ideas on this please PM me...
  • Mercurial GUI for OSX?

    2
    0 Votes
    2 Posts
    225 Views
    tbdT
    used Murky when I worked with Hg. and another one MacHg
  • Rounding

    6
    0 Votes
    6 Posts
    2k Views
    TIGT
    If you want to round it as output [as astring] then you can use var_string = sprintf("%.1f", var) for 1 dp etc
  • Set.insert vs array << x unless array.include?(x)

    19
    0 Votes
    19 Posts
    11k Views
    honoluludesktopH
    I probably don't know what I am doing, but I ran the following test, and obtained the attached results. I typically use array.push variable, and don't understand the situations when the other examples might be used. Btw, when I applied the other forms to my app, it failed in ways that leave me to believe that those forms are data sensitive. Can anyone explaine to a Ruby beginner what's up? t=Time.now a=[] 100000.times do r=rand(10000) a<<r end a.uniq! puts Time.now-t 0.125 t=Time.now a=[] 100000.times do r=rand(10000) a.push r end a.uniq! puts Time.now-t 0.141 t=Time.now a=[] 100000.times do r=rand(10000) a.push r end puts Time.now-t 0.094 t=Time.now a=[] 100000.times do r=rand(10000) a<<r end puts Time.now-t 0.093
  • What means "class" here?

    11
    0 Votes
    11 Posts
    371 Views
    D
    Don't forget instance_of? when only looking for a specific class without regard to inheritance. As in <span class="syntaxdefault"><br />ss </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">selection<br />ss</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each do </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault">  if e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">instance_of</span><span class="syntaxkeyword">?</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">ComponentInstance<br />    </span><span class="syntaxcomment">#other stuff<br /></span><span class="syntaxdefault">  end<br />end</span>
  • Extract !?

    3
    0 Votes
    3 Posts
    183 Views
    L
    Thanks, the link you provided is straightforward.
  • [code] Menu Validation (MF_DISABLED bugged on PC?)

    12
    0 Votes
    12 Posts
    3k Views
    thomthomT
    Possibly. Maybe it was in another language where you had to gray and disable. ...Visual Basic...? Can't think of anything else where I've dealt with menus...
  • Getting view near and far planes through ruby?

    6
    0 Votes
    6 Posts
    330 Views
    AdamBA
    If you want worldspace near and far plane distances, just project the Model bounding box onto the lookat vector lookat = Sketchup.active_model.active_view.camera.target - Sketchup.active_model.active_view.camera.eye then project each corner of the model bounding box on this line. So: for i in 0...8 #enumerate all the corners x = i & 1 != 0 ? Sketchup.active_model.bounds.min[0] : Sketchup.active_model.bounds.max[0] y = i & 2 != 0 ? Sketchup.active_model.bounds.min[1] : Sketchup.active_model.bounds.max[1] z = i & 4 != 0 ? Sketchup.active_model.bounds.min[2] : Sketchup.active_model.bounds.max[2] build a corner point to test c = Geom::Point3d.new(x,y,z) how far a long the line of sight it is d = lookat.dot(c - Sketchup.active_model.active_view.camera.eye) track minimum and maximum value of d end
  • [SOLVED]accessing scene transitions

    8
    0 Votes
    8 Posts
    574 Views
    AdamBA
    Is it a known bug that Sketchup.active_model.options["SlideshowOptions"]["LoopSlideshow"] appears to be totally ignored by SketchUp? I've checked back to SU6 and it is read/writable but the animation still loops if its set to false
  • Adding local Mercurial project to BitBucket?

    3
    0 Votes
    3 Posts
    276 Views
    thomthomT
    well, that was easy... cheers!
  • Face: concave vs convex

    10
    0 Votes
    10 Posts
    2k Views
    jason_marantoJ
    You can also find TIG's update of the Delaunay ruby here -- though I don't think the changes have anything to do with the math: http://forums.sketchucation.com/viewtopic.php?f=323&t=34232 Best, Jason.
  • Ruby performance on a Mac... am I just late to the party?

    26
    0 Votes
    26 Posts
    3k Views
    T
    See my first post - I already reported.
  • Newbie: Drawing state diagrams with Ruby - would this work?

    16
    0 Votes
    16 Posts
    3k Views
    Dan RathbunD
    @pout said: Why don't you just send the data through JSON to a htmlpage and use that combined with existing chart creator? Like this one: http://www.anychart.com/products/anychart/overview/ Should be pretty simple. Are you in the correct topic, Pout? AnyChart does not produce diagrams, it produces charts. And yes it's a minimum of 500 dollars "simple". Jim had some success using GraphViz, which actually has two examples of state diagrams: finite state machine* LR(0) state graph
  • Optimize Challenge #1 - Find Curves (connected edges)

    3
    0 Votes
    3 Posts
    227 Views
    thomthomT
    Faster solution, using hashes for quick lookups: ` === Find Curves === Sorting: 0.306s (11%) Filter: 0.05s Method: TT_Find_Curves Found 4253 curves in 2.62s` Revision 2
  • Ruby Code Snippets

    26
    0 Votes
    26 Posts
    1k Views
    L
    Perhaps what makes problem is the word "snippet".
  • Keep WebDialog in front on XP/Vista?

    10
    0 Votes
    10 Posts
    306 Views
    J
    Wowsers, thanks for all the responses. Question answered!
  • Add_group( entity ) weirdness

    9
    0 Votes
    9 Posts
    370 Views
    K
    @unknownuser said: hmm im somewhat confuses here-why did the face appear to have been shifted to the origin of g1 - instead of preserving it's original position? I think that there is a problem somehow with the transformation of the objects. Following my instructions in the other post: http://forums.sketchucation.com/viewtopic.php?f=180&t=31443&p=276973&hilit=kwalkerman#p276860 the end result is that in the outliner, a group is added to Sketchup.active_model.entities. The transformation of the group is equal to the transformation of the original face in it's original group. Then, when you open the original group for editing, the face appears in its original location. So, there are two major problems: when passing entities into entities.add_group, entities MUST equal model.active_entities the entities passed in retain their original transformation, relative to the previous entities collection, with some strange behavior. -- Karen
  • Undocumented class: Sketchup::Console

    3
    0 Votes
    3 Posts
    656 Views
    thomthomT
    It was just a pseudo code of how the puts behave in SU.
  • Detect units using ruby

    3
    0 Votes
    3 Posts
    233 Views
    M
    @thomthom said: Look at model.options http://code.google.com/apis/sketchup/docs/ourdoc/model.html#options OptionsProvider http://code.google.com/apis/sketchup/docs/ourdoc/optionsprovider.html OptionsManager http://code.google.com/apis/sketchup/docs/ourdoc/optionsmanager.html Remember to use the keys to access the options as indexes vary from version to version. To print out all available options for a given version, use this on-liner: <span class="syntaxdefault"><br />Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">options</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">keys</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each </span><span class="syntaxkeyword">{|</span><span class="syntaxdefault">key</span><span class="syntaxkeyword">|</span><span class="syntaxdefault"> p key</span><span class="syntaxkeyword">;</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">options</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">key</span><span class="syntaxkeyword">].</span><span class="syntaxdefault">each </span><span class="syntaxkeyword">{|</span><span class="syntaxdefault">k</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">v</span><span class="syntaxkeyword">|</span><span class="syntaxdefault"> puts </span><span class="syntaxstring">"> #{k} - #{v}"</span><span class="syntaxkeyword">}</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault"> </span> THANK YOU VERY MUCH. it worked

Advertisement