⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • Adding local Mercurial project to BitBucket?

    3
    0 Szavazatok
    3 Hozzászólások
    313 Megtekintések
    thomthomT
    well, that was easy... cheers!
  • Face: concave vs convex

    10
    0 Szavazatok
    10 Hozzászólások
    2k Megtekintések
    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 Szavazatok
    26 Hozzászólások
    3k Megtekintések
    T
    See my first post - I already reported.
  • Newbie: Drawing state diagrams with Ruby - would this work?

    16
    0 Szavazatok
    16 Hozzászólások
    3k Megtekintések
    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 Szavazatok
    3 Hozzászólások
    252 Megtekintések
    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 Szavazatok
    26 Hozzászólások
    2k Megtekintések
    L
    Perhaps what makes problem is the word "snippet".
  • Keep WebDialog in front on XP/Vista?

    10
    0 Szavazatok
    10 Hozzászólások
    506 Megtekintések
    J
    Wowsers, thanks for all the responses. Question answered!
  • Add_group( entity ) weirdness

    9
    0 Szavazatok
    9 Hozzászólások
    495 Megtekintések
    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 Szavazatok
    3 Hozzászólások
    686 Megtekintések
    thomthomT
    It was just a pseudo code of how the puts behave in SU.
  • Detect units using ruby

    3
    0 Szavazatok
    3 Hozzászólások
    273 Megtekintések
    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
  • Help on scale

    7
    0 Szavazatok
    7 Hozzászólások
    434 Megtekintések
    TIGT
    @shirazbj said: Instead of writing every 'mm' in code, I thought it's more easy to draw as it is and scale back at the end. That also cleared me from inserting a DWG file, need scale back to get the dimensions show in right number. Thanks. An imported DWG will use whatever units it has set in the import 'options' dialog opened from the main DWG import browser, So you can rely on that to always be correct.
  • Math module? Where is the information in API

    7
    0 Szavazatok
    7 Hozzászólások
    1k Megtekintések
    GaieusG
    @unknownuser said: Now I get it! thanks- i had no idea sketchup used the old version So it seems this was the only thing that bothered you. Good.
  • Detect face on pushpull

    10
    0 Szavazatok
    10 Hozzászólások
    562 Megtekintések
    B
    Thanks Didier! These examples are good for learning. Regards, Siegfried
  • Variable problem

    11
    0 Szavazatok
    11 Hozzászólások
    405 Megtekintések
    chrisglasierC
    @tig said: I'm not clear about how a good or bad entry for 'value >>> v' might actually 'look' in your code... <span class="syntaxdefault">new_value </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[]<br /></span><span class="syntaxdefault">            value</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each do</span><span class="syntaxkeyword">|</span><span class="syntaxdefault"> v </span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault">                if </span><span class="syntaxkeyword">!</span><span class="syntaxdefault">v</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(Array)<br /></span><span class="syntaxdefault">                    v </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[[</span><span class="syntaxdefault">1</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">0</span><span class="syntaxkeyword">]<br /></span><span class="syntaxdefault">                end<br />                v </span><span class="syntaxkeyword"><<</span><span class="syntaxdefault"> time </span><span class="syntaxkeyword">*</span><span class="syntaxdefault"> a<br />                a </span><span class="syntaxkeyword">+=</span><span class="syntaxdefault"> 1<br />                new_value </span><span class="syntaxkeyword"><<</span><span class="syntaxdefault"> v<br />            end<br />            keyframes</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">key</span><span class="syntaxkeyword">]</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> new_value</span> I did it like this in the end as both types of v have time added. Anyway it works which is good! Thanks again. The empty elements currently are needed to delay certain rotations - like a kick at the end of a run. I have a mechanism to modularise the animation. I want to leave that until later.
  • Export image by layer

    6
    0 Szavazatok
    6 Hozzászólások
    379 Megtekintések
    Dan RathbunD
    BTW... the script should make a temp hash with layer names as the keys and visibility as the values. This should store the visible state of layers before rendering starts. .. do your thing ... .. then restore the visibilty state for all layers at the end.
  • Loop returns non-planar vertices?

    14
    0 Szavazatok
    14 Hozzászólások
    812 Megtekintések
    Chris FullmerC
    Hi Scott, the question you have is a bit different than the one being discussed here. You might just start a new topic asking the whole group your question - which seems to be specifically "How do I make a wing surface from a list of 3d points" or something along those lines. Your question is a bit burried here in this topic, and you will probably get more eyes seeing your dilema if you just made your own topic. Do you have any programming experience? Not that it matters, you can always learn, I just thought I'd ask.
  • New Material Methods! (With bugs :( )

    25
    0 Szavazatok
    25 Hozzászólások
    4k Megtekintések
    Dan RathbunD
    @unknownuser said: I'm thinking I could make a debugging monitoring class that loads first and monitors the base Ruby and SketchUp classes and modules for extensions. I also.. have a couple of methods proto'd out. I was thinking they need to be in a common namespace. How about: SKX::Dev ?? @jim said: tattletale. Yep.. I didn't want to "publish" the method publically, as there can be only one "monitor", or they'd be fighting each other to override it. @unknownuser said: "Monitor" because one couldn't just get the load path for any method. Need to hook into at the beginning before anything else. @jim said: I'm not sure you need to "monitor", but an as-needed check of the files in plugins would be sufficient. Much more efficient to 'hook in at the beginning' that way you can detect when a rbs file does an override. Ruby can tell you the file and line number without having to parse actual files. (Even Kernel.set_trace_function can do it.) One issue however is that "the method" will report ALL methods created once monitoring begins, so definately some filtering will be needed to ignore methods added to custom classes and modules. Otherwise you'll flood $stdout or the logging object (file, hash etc.)
  • Ordering 3dpoints ?

    36
    0 Szavazatok
    36 Hozzászólások
    4k Megtekintések
    Didier BurD
    Yep, on any plane Here is the rough test code: make a selection of n coplanar guide points on any face, type 'graham' in the console and it draws the convex hull correctly. As you will see, code is yours almost entirely. It's likely there is something wrong in my classes or methods. def graham() pts=[] # Selection of coplanar guide points to array pts Sketchup.active_model.selection.each { |cp| pts.push(cp.position) } # Transform points to horizontal plane t1=Geom;;Transformation.new(pts[0],pts[0].vector_to(pts[1]),pts[0].vector_to(pts[2])) horizPoints = pts.map { |pt| pt.transform(t1.inverse) } # Sort by X and Y points = sort_points_by_x_y(horizPoints) # Graham l_upper = [ points[0], points[1] ] 2.upto(points.length - 1) do |i| l_upper << points[i] while l_upper.length > 2 && !right_turn?(l_upper.last(3)) l_upper.delete_at(-2) end end l_lower = [ points[-1], points[-2] ] (points.length - 3).downto(0) do |i| l_lower << points[i] while l_lower.length > 2 && !right_turn?(l_lower.last(3)) l_lower.delete_at(-2) end end l_lower.delete_at(0) l_lower.delete_at(-1) # Reset convex hull to its original transform hull=(l_upper + l_lower).map! { |pt| pt.transform(t1) } # draw hull Sketchup.active_model.entities.add_line(hull) Sketchup.active_model.entities.add_line(hull.last,hull.first) end def right_turn?(points) p, q, r = points return (determinant_3x3([1,p.x,p.y,1,q.x,q.y,1,r.x,r.y]) < 0.0) end def determinant_3x3(array) a,b,c,d,e,f,g,h,i = array return ((a*e*i) - (a*f*h) + (b*f*g) - (b*d*i) + (c*d*h) - (c*e*g)) end def sort_points_by_x_y(points) return points.sort! { |a,b| a.x==b.x ? a.y <=> b.y ; a.x <=> b.x } end
  • Group from Selected Entities

    7
    0 Szavazatok
    7 Hozzászólások
    433 Megtekintések
    thomthomT
    cheers
  • Call for attention - context handlers and validation procs

    24
    0 Szavazatok
    24 Hozzászólások
    34k Megtekintések
    Dan RathbunD
    not really... the context menu is "built on the fly"... The menu needs to know what items and submenus it will need to display. It cannot know what they will be until Sketchup processes all the context_menu_handlers.

Advertisement