🏢 PlaceMaker | 25% off for February including new Google Earth data imports! Learn more
  • Help on scale

    7
    0 Votes
    7 Posts
    291 Views
    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 Votes
    7 Posts
    1k Views
    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 Votes
    10 Posts
    448 Views
    B
    Thanks Didier! These examples are good for learning. Regards, Siegfried
  • Variable problem

    11
    0 Votes
    11 Posts
    261 Views
    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 Votes
    6 Posts
    280 Views
    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 Votes
    14 Posts
    623 Views
    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 Votes
    25 Posts
    4k Views
    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 Votes
    36 Posts
    4k Views
    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 Votes
    7 Posts
    342 Views
    thomthomT
    cheers
  • Call for attention - context handlers and validation procs

    24
    0 Votes
    24 Posts
    33k Views
    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.
  • Complex numbers and other libraries

    5
    0 Votes
    5 Posts
    422 Views
    Dan RathbunD
    It's in the Standard (ie Extended,) Libraries for 1.8.6 (not in the Core.) In Files lib/complex.rb lib/mathn.rb You need a full ruby installation. You need to add paths to the $LOAD_PATH array. I have a topic on this and a utility script called !loadpaths.rb Addenda: -See these posts: for the !loadpaths.rb script: [code] Ruby LOAD PATHs script for (Win32) and for info: same topic near the bottom.. for the complete Ruby libraries (with precompiled .so files,) direct from ftp.ruby-lang.org: to match SU 8.0M0 & M1: ruby 1.8.6-p287* for Ruby 1.8.6-p369 (latest as of this posting.) requires you replace DLL in Sketchup program folder if on Windows.* See instructions: Ruby Interpreter DLLs (Win32) Also see: Ruby Newbie's Guide to Getting Started
  • Online Editing on Google Project Hosting

    6
    0 Votes
    6 Posts
    760 Views
    thomthomT
    That's neat!
  • No constructor for Vertex object ?

    6
    0 Votes
    6 Posts
    398 Views
    TIGT
    @thomthom said: @tig said: If you think about it a Vertex can't exist without an Edge ! No in SketchUp world - but you can create stand-alone vertices in 3DsMax. I was talking "in Sketchup World"... where else are we? You can make a 'guide-point' in Sketchup - cpt=entities.add.cpoint(pt) but it isn't a vertex - cpt.position will return its Point3d though... cpoints don't 'stick' to anything so they are relatively useless as 'vertices' but can form useful 'markers for future vertices - like 3d-mesh made from a points cloud...
  • Accessing Menu Objects from Submenu's

    4
    0 Votes
    4 Posts
    274 Views
    Dan RathbunD
    @david. said: Yes, I realized that. I thought there might be a way through the SU UI similar to accessing toolbars that have been created. Apparently, not. Not a big issue. Actually the API lacks a Toolbars collection, which we have wanted. Now with the name method (just added, we can create one, 'on the fly'.) module SuchandSuch Toolbars={} ObjectSpace.each_object(UI;;Toolbar) {|tb| Toolbars[tb.name]=tb } end You refer to the just added method each which accesses the buttons ( UI::Command objects,) on a given toolbar. But ... the Sketchup::Menu class has not yet been updated with Enumerable methods (which should include each_item and each_submenu iterator methods;) nor any name, parent, etc getter methods. We'll have to cross our fingers for the next MR.
  • How is better and faster?

    5
    0 Votes
    5 Posts
    223 Views
    Dan RathbunD
    I usually keep the toolwindows "in my stack" rolled up, with the EntityInfo open, on the bottom of the stack. (Because it varys in height depending on what is selected, when it's at the top, the whole stack jiggles up and down in a most annoying way.) Anyway.. I only unroll a toolwindow when I'm actually using it.
  • SKX Project? Win32::API ?

    33
    0 Votes
    33 Posts
    1k Views
    Dan RathbunD
    if they were to.. yes are they likely to... if they poke about and learn a bit, and end up using the Installer, they will have minGW compiled Ruby, and should use a copy of the minGW interpreter DLL with Sketchup. ... but if they go with what ever Google gives them .. a large percent of the users, they'll have th mswin32 compiled DLL.
  • WebDialogs made with hashes don't store settings?

    10
    0 Votes
    10 Posts
    292 Views
    thomthomT
    @driven said: although I think they did before the latest upgrade I tried the hash in V7.1 - didn't work there either. Created the section key, but not any of the position and size keys. @dan rathbun said: I will say that the UI::WebDialog.new() method is "cranky" when it comes to processing arguments... if you put nil as the pref_key arg, the method stops processing the remaining args. I tested that yesterday, Doesn't do that in SU8M1. @dan rathbun said: Note that processing of a hash is also cranky... it doesn't work correctly if string keys are used (at least on SU 7.x,) Seems hashes with keys are cranky as well. I always use symbols. @driven said: has anyone got a working example of any WD that can be re-positioned... You can always reposition and resize after you created the WD object. Note that, if you set a preference key, then the size and position you give in new will be ignored if there exist values in the registry. @dan rathbun said: One of the changes, for SU 8 was an updated user agent string ... I wonder if that's causing this problem? I see the same problems in SU7.1. So it doesn't appear to be new. And I'd be surprised if the web control's user-agent-string affected the a ruby method.
  • SketchUp 8 Bugs &amp; Troubles!

    25
    0 Votes
    25 Posts
    3k Views
    J
    Thanks Brad! As far as I know, only the 4 stipple types have been documented. If other types are supported, it would be great to get those documented and to be able to use them.
  • Has anyone successfully added dynamic 3D model to website?

    8
    0 Votes
    8 Posts
    642 Views
    C
    ICEVision supports Sketchup files as well as a variety of other formats. http://icevision.ice-edge.com/features.jsf
  • Static component/object in front of camera

    6
    0 Votes
    6 Posts
    396 Views
    Chris FullmerC
    I've got a few snippets of code I could send you if you want to dig through them. Does it have to really be a sketchup component? Or can it just look like a navigation wheel? A few of us have played a LOT with the draw methods. You probably can do exactly what you want with those. If interested, I'll PM you an example or two. Chris

Advertisement