⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • Identifying a group

    6
    0 Votes
    6 Posts
    309 Views
    Dan RathbunD
    @artmusicstudio said: now, i think of finding a way to iterate depending of the Z height. is there a way to say directly in the iteration routine, start with lowest elements and go up to the highest? You make an array COPY of the collection, and the sort the array using the sort() method that is mixed in from the Enumerable module. Use the entity bounds() method to get a Geom::BoundingBox, and it's min() method to get a Geom::Point3d, and use it's z() method to get Length objects for the compare expression. def z_sort(coll) coll.to_a.sort {|a,b| a.bounds.min.z <=> b.bounds.min.z } end The trick is that the Comparable module must be mixed into the final object's class, on both sides of the compare <=> operator. This will always be true for Numeric and String subclasses. At the console: Length.ancestors %(darkgreen)[>> [Length, Float, JSON::Ext::Generator::GeneratorMethods::Float, Numeric, Comparable, Object, JSON::Ext::Generator::GeneratorMethods::Object, Kernel, BasicObject]] Notice that Comparable is already mixed in ?
  • Average color pasted instead of texture. Why?

    4
    0 Votes
    4 Posts
    337 Views
    M
    Thanks Dan, That is exactly what I needed!
  • Notepad++ Collaboration

    18
    0 Votes
    18 Posts
    3k Views
    ashscottA
    Right, Have been playing with Teamviewer lately and you could basically collaborate on SU through that - the letdown is simply refresh rate from connection speeds - hence my comment about 1Gbps. A non-technical answer
  • Ui - messagebox definition

    3
    0 Votes
    3 Posts
    467 Views
    artmusicstudioA
    hi jim, thank you so much. it works. again a step closer to my ruby. stan
  • Changing the height of an edge (line)

    3
    0 Votes
    3 Posts
    257 Views
    artmusicstudioA
    hi tig, thanx for your explanation. too high for me at the moment ( after several trials), but i keep on learning. i solved the problem by calculation of the bottom side at 0 directly during the creation of the elements. but one day i will also understand the vertices transormation... regards stan
  • Webdialog to ruby encoding issue on OSX

    22
    0 Votes
    22 Posts
    1k Views
    D
    @tt_su said: So this only happen on OSX, not on Windows? hi TT did you get a chance to run this on your mac? and did it confirm what I state, on your setup? john
  • Newbie question: extrude following a straight line in space

    8
    0 Votes
    8 Posts
    461 Views
    M
    Ah! ok, then I understand it. Thanks again!
  • Project Tango

    3
    0 Votes
    3 Posts
    268 Views
    olisheaO
    maybe google are concurrently working on a 3D app too?
  • Method to Explode Groups by name beginning...

    3
    0 Votes
    3 Posts
    216 Views
    S
    Looks like you focused only on group class, and corrected the wall name syntax, and I am very grateful as it now works! Thanks Tig
  • What version of Ruby should I start learning?

    20
    0 Votes
    20 Posts
    1k Views
    N
    Thanks a lot!
  • Open External Links With Default Browser

    4
    0 Votes
    4 Posts
    349 Views
    A
    Here is the code snippets, just so if anyone is interested later This goes to JavaScript: <span class="syntaxdefault"><br /></span><span class="syntaxcomment">// Determines whether string contains another string.<br /></span><span class="syntaxdefault">String</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">prototype</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">contains </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> function</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">it</span><span class="syntaxkeyword">){<br /></span><span class="syntaxdefault">    return this</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">indexOf</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">it</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">!=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">-</span><span class="syntaxdefault">1</span><span class="syntaxkeyword">;<br />};<br /><br /></span><span class="syntaxcomment">// Calls a Ruby callback.<br /></span><span class="syntaxdefault">function callback</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">name</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> data</span><span class="syntaxkeyword">){<br /></span><span class="syntaxdefault">    if </span><span class="syntaxkeyword">(!</span><span class="syntaxdefault">data</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> data </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxstring">''</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">    window</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">location</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">href </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxstring">'skp;'</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">+</span><span class="syntaxdefault"> name </span><span class="syntaxkeyword">+</span><span class="syntaxdefault"> </span><span class="syntaxstring">'@'</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">+</span><span class="syntaxdefault"> data</span><span class="syntaxkeyword">;<br />}<br /><br /></span><span class="syntaxcomment">// Open links with default browser.<br /></span><span class="syntaxkeyword">$(</span><span class="syntaxdefault">document</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">on</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'click'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'a[href]'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> function</span><span class="syntaxkeyword">(){<br /></span><span class="syntaxdefault">    if </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">this</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">href</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">contains</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"http"</span><span class="syntaxkeyword">)){<br /></span><span class="syntaxdefault">        callback</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'open_link'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> this</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">href</span><span class="syntaxkeyword">);<br /></span><span class="syntaxdefault">        return false</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">}<br />});<br />&nbsp;</span><span class="syntaxdefault"></span> This goes to Ruby: <span class="syntaxdefault"><br /></span><span class="syntaxkeyword">@</span><span class="syntaxdefault">dlg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_action_callback</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'open_link'</span><span class="syntaxkeyword">){</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">dlg</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> params</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault">  UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">openURL</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">params</span><span class="syntaxkeyword">)<br />}<br />&nbsp;</span><span class="syntaxdefault"></span>
  • How do you intersect two faces?

    5
    0 Votes
    5 Posts
    711 Views
    C
    Thanks for the replies! slbaumgartner, splendid advice. It worked much smoother than I thought it would. The code is attached below. Here are some results from intersecting the two columns in the example file: Intersect from UI: 983s Outer shell (*****): 161s g0.intersect_with g1 (******): 104s Intersect face pairs: 4s () Outer shell is probably dominated by the intersect (*) In order to produce all edges for coplanar cuts two calls to intersect_with has to be made with the groups reversed. The result above is for a single call. cuttest.zip CAUL_CutTest0.3.rb
  • Create component with different axes

    13
    0 Votes
    13 Posts
    598 Views
    JQLJ
    @garry k said: JQL Flip along axis is great however, if the component has an interaction like rotate to simulate a door opening then you will find that the component reverts back to it's original state (you loose the flip). What I need to do is change axes. Funny doesn't happen to me. But I don't question your need to change axis.
  • Read Serial port or USB interface

    11
    0 Votes
    11 Posts
    3k Views
    S
    Hi! I am a student of electrotechnical engineering and i'm doing a project. I need a little help! How i get values from serial port to sketchyphysics?
  • Pick material under cursor

    3
    0 Votes
    3 Posts
    260 Views
    Dan RathbunD
    FYI, at the console: ts = Sketchup.active_model.tools %(#004000)[#<Sketchup::Tools:0x999fd98>] ts.active_tool_name %(#004000)[PaintMatchTool] ts.active_tool_id %(#004000)[21255] On the PC using the tool id does not seem to work (whilst it does for other native tools): Sketchup.send_action( 21255 ) .. nor does a action string: Sketchup.send_action "selectPaintMatchTool:" ?
  • UI doesn't update

    6
    0 Votes
    6 Posts
    357 Views
    nikusknxN
    Update for Sketchup 2014 : require "Win32API.rb msg = "\000" * 36 peekMessage = Win32API.new('user32','PeekMessage' , 'PLIII', 'I') peekMessage.call( msg, 0, 0, 0, 0x0000 ) != 0
  • A way to avoid that ?

    29
    0 Votes
    29 Posts
    12k Views
    nikusknxN
    Update for Sketchup 2014 : require "Win32API.rb msg = "\000" * 36 peekMessage = Win32API.new('user32','PeekMessage' , 'PLIII', 'I') peekMessage.call( msg, 0, 0, 0, 0x0000 ) != 0
  • Custom importer - setting options

    11
    0 Votes
    11 Posts
    668 Views
    T
    @tt_su said: Sorry about the delay in response. The API is currently missing the ability to set import options. I ensured we had a feature request for it filed. I forgot to say thankyou for this. Hope it gets sorted out.
  • Sketchup.load

    11
    0 Votes
    11 Posts
    435 Views
    Al HartA
    @tt_su said: Yea, it's an annoying deviance that Sketchup::load acts like Sketchup::require. For my personal projects I got reload code for when testing RBS files where I remove the file from the $LOADED_FEATURES list. $LOADED_FEATURES - Aha! I didn't know about that. I guess you learn something ever day.
  • Problem with the boundary of the viewport and my tool

    4
    0 Votes
    4 Posts
    331 Views
    jolranJ
    Same here on SU8. On both sides of the window. If I hold down the mousebutton near border of window(at the right side where there's no tools)and do a mousemove/nudge it starts panning right sometimes.

Advertisement