sketchucation logo sketchucation
    • Login
    1. Home
    2. wpd
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    W
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 5
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: How to select everything touching a bounding box?

      I think that you are mistaking me for somebody who knows a lot more than I do πŸ˜„

      I want to do something much simpler than what you have described. To give a (ficticious, but concrete example), suppose I had a script in which I had drawn a bunch of lines, arcs, faces, etc... In that script, I would like to select every entity that exists to the right of the plane defined by x=1. Then I would like to rotate all of those entities by 10 degrees (about the Y axis).

      I think that I need to start by grabbing a hold of all of the entities that exist to the right of x=1.

      I'm just not sure how to do that.

      It seems like this would be a good candidate for a helper method.

      It seems like somebody has probably already figured out how to do this and may have even published the helper method.

      If not (to both), then I think I just need to iterate through all of the entities in my model, keep track of which ones start or end at x > 10, select them or add them to a group, and then rotate, move, delete, or do whatever I want to do to that selection/group.

      --wpd

      posted in Developers' Forum
      W
      wpd
    • RE: How to select everything touching a bounding box?

      Hi Chris,
      What I am trying to do, for example, is to select everything to the right of x=10. With the GUI, I would zoom out to see everything, choose the select tool, press the mouse button and draw a box around everything to the right of X=10. (Of course, in the GUI, I probably wouldn't know exactly where x=10 was, but by looking at my model, I would know that I wanted to selected everything to the right of some particular feature in my model.)

      Then I might want to rotate all of those entities. Or I might want to move them a little to the right. Or I might want to delete them...

      I'm just trying to figure out how to do programatically what is very easy and intuitive when using the GUI.

      Does that make more sense yet?

      --wpd

      posted in Developers' Forum
      W
      wpd
    • How to select everything touching a bounding box?

      Well,
      My last foray into asking a question in this forum went so well that I think I'll give it another shot πŸ˜„

      I am trying to write a script to draw something that I once drew by hand so that I can parameterize it, tweak the parameters, and see what I get for results. One of the things I did by hand was to select a bunch of drawing elements (lines, arcs, faces, etc...) by dragging my mouse from right to left (and bottom to top) across my drawing. I would then either move or rotate the bunch of things.

      How can I accomplish something similar from a Ruby script? Basically, I would like to select everything to the right of some plane that is parallel to the Y-Z plane (i.e. at some offset x from the Y-Z plane.)

      I suppose I could iterate through all of the entities in my drawing and look at some indication of the minimum and maximum coordinates and if both x coordinates are greater than "x", I could add that entity to my selection list. But what happens when, tomorrow, I decide that my selection criteria is no longer parallel to the Y-Z plane, but is parallel to some arbitrary plane?

      What I probably want to do is to write a support function to do this for me. But, usually when I have an idea for a support function like this, I find out that somebody else already has a much more full-featured solution to my tiny problem (witness Chris Fullmer's shape bender tool).

      Has anybody already solved this problem? Can I use your solution? Can you point me in a good direction to get started?

      Thanks again...

      --wpd

      posted in Developers' Forum
      W
      wpd
    • RE: How to use Geom::Transformation.rotation?

      Oops... that's embarrassing, especially given how much time I spent trying to understand the meaning of the "point" and "vector" arguments. I'm used to the C convention of promoting everything to the highest level of precision prior to performing arithmetic. So I thought that 45/3602PI would promote to floating point prior to doing any of the math. (Actually, I never "thought" anything with regard to that.)

      Thanks for your help.

      Is there any mechanism for feeding back additions and clarifications to the Sketchup documentation? I'd be glad to write something about the meaning of the point and vector arguments and about rotating using the right hand rule. Even a simple example of rotating a line or a face (one that had been written using 45.degrees) would have gone a long way to getting me where I wanted to go much sooner.

      --wpd

      posted in Developers' Forum
      W
      wpd
    • How to use Geom::Transformation.rotation?

      Hello,
      I would like to rotate a face about an axis. I have written the following code:

      
      group = entities.add_group
      
      slice = group.entities.add_face([23.57, -100, Height + 100],
                                      [23.57, Width+100, Height+100],
                                      [23.57, Width+100, -100],
                                      [23.57, -11, -100])
      
      xform = Geom;;Transformation.rotation(Geom;;Point3d.new([23.57, 0, 0]),
                                            Geom;;Vector3d.new([0, 1, 0]),
                                            45/360*2*Math;;PI)
      
      puts "#{xform.to_a.join(' ')}"
      group.transform! xform
      
      

      The problem is that the face does not change orientation. That's not too surprising, given the output of the 'puts()' call (four 1.0 values interspersed with 12 0.0 values -- not too sure exactly what the 16 element array representing a transform really is, but those values do not look much alike a 45 degree rotation).

      Is there any better documentation for the Geom::Transformation.rotation API function than:

      "The rotation method is used to create a Transformation that does rotation about an axis.
      The axis is defined by a point and a vector. The angle is given in radians."

      Basically, I want to automate the work done by the "rotate" tool in the GUI.

      Thanks for any help or pointers.

      --wpd

      posted in Developers' Forum
      W
      wpd
    • 1 / 1