sketchucation logo sketchucation
    • Login
    1. Home
    2. August
    3. Posts
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now
    A
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 29
    • Posts 238
    • Groups 1

    Posts

    Recent Best Controversial
    • Turtle Graphics for Sketchup

      Many times over my years of intermittent Sketchup use, I have wanted to be able to input a list of directions and distances and have SU simply follow that to create a line drawing.

      Recently I realized that this isi the basic concept of one of the very first computer drawing programs, Turtle Graphics. Implementations of Turtle Graphics have been done in numerous languages, from SmallTalk to Python. There's even a downloadable Python Module.

      Turtle Graphics also seems a natural for Sketchup, but in poring over Sketchucation, the Sketchup Form, the web, etc, I can't find anything.

      The concept is simple, you provide a list of directions and distances and the system follows directions.

      N 1"
      W 1"
      S 1"
      E 1"

      or

      0, 1
      90, 1
      180, 1
      270, 1

      will draw a 1" or 1 unit square.

      Previous uses that I would have like to use it in have been measuring a room interior that is more complicated that a simple rectangle and pacing off the layout of pathways in a large garden site.

      If I were to try myself at getting a Ruby Script to input the data and draw the line, it could take me weeks to get up to speed on all the different Ruby functions I would need. I can read some Ruby, but generating it slower than one hour per line.

      Has anyone done this already? Is there someone for whom Ruby is a native language who could just whip our a demonstration version (sans bell and whistles of different data input formats, etc.) that I might augment?

      Thanks.

      P.S. Nice to be back on Sketchucation. It's been a while.

      posted in Extensions & Applications Discussions ruby data input turtle graphics
      A
      August
    • RE: [Plugin] Arcs Circles +

      Could someone please edit the top post in this thread and the v2.0.2 page in the Plugin Store to point to v3.0.0 in the Extensions warehouse?

      I installed v2.0.2 thinking it was the latest and spent well over an hour working around a bug. Only after finishing my task and coming here to report the bug did I find that 3.0.0 exists. I installed it and the tool worked exactly as expected, no bug.

      Thanks.

      posted in Plugins
      A
      August
    • RE: [Plugin] Arcs Circles +

      @lothian said:

      Can't seem to change the number of segments. Stuck at 24.

      I had trouble with this too. In v2.0.2, the version available here on SketchUcation, I had to change the number of segments with the Circle tool first.

      Doing that, I easily made an arc of 26" with 13 segments. Each segment was exactly 2". Constructing an arc out of fixed 2" segments would have been a LOT of work.

      (It was "easy" after I figured out an axis orientation of my curve that didn't produce buggy results. v3.0.0 from Extensions Warehouse didn't have that bugginess.)

      posted in Plugins
      A
      August
    • RE: Line-of-Sight Tool?

      Hi Pixero,

      That tool appears to, as it says, draw a line from the camera to the "target", the center of the camera field.

      My tool, when active, draws a line from the camera through the selected point in the frame. So from a single camera position, you can draw the rays that outline an object.

      Would it be straightforward to modify your tool to do that?

      Thanks,
      August

      posted in Newbie Forum
      A
      August
    • RE: Line-of-Sight Tool?

      @pbacot said:

      I think the Position Camera tool does the same thing if you set it to "0" height and drag it along the line, or am I wrong?

      I don't use the Position Camera tool much but I don't think it's applicable. I'm not getting your meaning, for what I am seeking, of "drag it along the line." What line? Do you mean drag the camera, at zero height, along the ground. Not quite. My task is to create a new line, a 3D line, not one on the ground. Let me explain a little more.

      My "Line-of-Sight" tool was initially primarily for photo matching, but I can imagine uses for planning movie shots as well, to plan what obscures what in a shot.

      In use, you activate the tool and then click on a point in your view. Your click creates a line, but at first you see nothing because you have created a line relative to the current camera position and you are looking exactly down the length of the line. It's like shooting a laser beam out of the camera at any of the points in the scene that you are looking at. Shoot a bunch of them, while you are at it.

      When you move the camera viewpoint with Orbit, then you can see the lines you created as all going through the original camera position and fanning out in 3D from there. Any particular line can let you identify everything that is along that Line-of-Sight that were all aligned in the original view.

      My original intent was to use it for photo matching of things that don't have straight lines and flat planes, like trees and boulders on a building site, or even power poles, which are hugely difficult to place using Match Photo. With my tool, to position a tree trunk or power pole from photos, I shoot a line on either side of it in one view, switch to a different view and do that again, and again in a third view. Then looking from the top, I have six lines that show me where the tree looks to be in the photos and I can place the trunk in between them where it will align in all of the photos.

      A few years ago a made a Ruby extension that does this, but it doesn't work with newer versions of SU. Someplace, in some thread, I got the idea that such a tool now exists in SU. I would like to know if that's true and what the tool is, before I put in the work of updating my my extension to work in the new SU.

      posted in Newbie Forum
      A
      August
    • Line-of-Sight Tool?

      Is there a "Line-of-Sight" tool in SU?

      Several years ago I made my first (and only) Plug-in / Extension where you can click the tool anywhere in the scene and it creates a line exactly lined up with your line of sight at that point. So at first the line is invisible because you're looking right down its length. When you change the viewpoint, then you can see the line.

      I remember seeing a reference a few years ago to a new tool in SU that does that kind of thing, so I'm reluctant to update the older Extension to work in the new SU with the new Extension policies if an equivalent already exists. But I've never found it.

      Does a Line-of-Sight tool exist?

      Can anyone shine a light on my vague memories?

      Thanks,
      August

      posted in Newbie Forum sketchup
      A
      August
    • Bug in SketchUcation pages, or operator error?

      Hi folks,

      I'm on a new computer and in my first visit to SketchUcation in a while, instead of screenshots in threads, I'm seeing error displays from photobucket.com that tell me to check my account.

      So is it the new computer, does everyone need to sign up for photobucket now, is the site broken, or what?

      Thanks,
      August

      posted in Corner Bar
      A
      August
    • RE: The zero point of circles changes with their orientation

      Hi Dan,

      Thanks for a pretty amazing exploration of the possibilities. It's both educational and entertaining (for those of us who like this kind of thing).

      My apologies for dropping the ball on getting back to you. This is one of those projects that I just keep whittling away at because each step seems a little more complex than I had expected or was ready to deal with.

      You provided quite an array of methods for finding the starting angle of a circle, and I'm sure some of those will be useful as I move forward.

      As for my current stuck spot, I think what I'm really trying to figure out is how to specify the starting angle of a circle, a polygon, or a curve, relative to the previously placed circle or polygon, as I go around the knot placing circles.

      When I use the usual tools to create a circle, the starting angle does not seem to be a parameter that is under my control. The image at the top of this thread shows where it defaults to, just using the standard circle-creating functions. I do not need to understand the logic behind those defaults, because that's not going to help me with my actual problem.

      If I create a polygon, like a circle, I also do not know how to specify a starting angle.

      I have to wonder, when you draw a circle or a polygon manually in SU, the point you drag out from the center becomes the starting angle. So what's going on under the hood? Is a default circle being generated and then rotated so that it's starting angle is where the cursor is?

      Lacking that methodology, the only way I can see to create either a circle or a polygon where I get to specify the staring angle is to make a 360 degree curve. That feels unnecessarily limiting, but that's where I've gotten to.

      My current thinking on my original problem is that I need to figure out how to place the new curve, based on the information I have from the previous circle/curve. I have the normal, which is derived from the current segment of the knot curve. I have the previous circle/curve. And I have the previous circle/curve's starting angle.

      And, as you suggested, I have to deal with what the starting angle is relative to.

      I have to figure out what starting angle I want to specify, based on the previous normal, the previous starting angle, and the current normal.

      I think I'm going to have to nudge the starting angle of the next successive circle by just a little, so that as the sequence progresses around the knot, it does a slow rotation and comes back to the beginning. Does it want to go around only once? Or three times for the three lobes of this knot? Or what?

      You gave me a great nudge that percolated for a while and now I think I know what I need to figure out for my next step. I hope that's not another year, but who knows?

      Anyway, thanks for all the tips.
      August

      posted in Developers' Forum
      A
      August
    • RE: The zero point of circles changes with their orientation

      Thanks Dan,

      That's a angle, not a point, but it may turn out to be useful. Thanks for the pointer (no pun intended). I'll bang around on it for a bit over the next couple of days.

      As for terminology in the broad sense, I suppose that following the above lead I would call my "zero point" the "start_point" for the circle. But if there's nothing standardized, then
      zero_point = circle[0][0]
      still has an appeal.

      August

      posted in Developers' Forum
      A
      August
    • RE: The zero point of circles changes with their orientation

      P.S. If anyone has a better term for the starting point of the first edge than "zero point", I'll happily use it.

      posted in Developers' Forum
      A
      August
    • The zero point of circles changes with their orientation

      ![A FollowMe construction connecting the "zero points" of an array of circles.](/uploads/imported_attachments/m55j_zero-point-connections.jpg "A FollowMe construction connecting the "zero points" of an array of circles.")

      I'm not sure how describe this problem. I've done a lot of poring through the Plugins forum searching on "circle". Searching on [0][0] wasn't getting me anywhere.

      I am trying to connect a smooth path between "corresponding" points on an array of circles.

      For each circle, I find what I call the zero point, the starting point of the first edge in the circle.

      ... create a circle ...
      zeropoint = circle[0][0]

      Putting all of those zero points into an array, making a curve from that, and using that as the path for .followme, results in the image attached.

      As you can see in the image, there are three places where the "zero point" on some of the circles is a bit discontinuous from the adjacent circles.

      Obviously this is an effect of how SketchUp creates the circles. There is no parameter for where the starting point of a circle is, SU just uses the center, the normal direction, and the radius. It has some internal algorithm, presumably based on the normal angle, for where it starts the circle. And for a sequence of circles that twists around like this, sometimes that products glitches.

      So here's the question: Does anyone have any ideas for how to generate a "smooth path" through "corresponding" points on all of these circles?

      One approach that I have come up with is this:

      • I got to the current point from a previous point. Perhaps I presume that I can start with two zero points to get
        going.
      • There is a vector from the previous point to the current point.
      • To whatever points on the next circle that I might connect with, there will be another vector.
      • I pick whatever point on the next circle gives me the minimum angle
        between those two vectors.

      Does that make sense? Anyone have ideas for a simpler method?

      Thanks,
      August

      posted in Developers' Forum
      A
      August
    • RE: This tripped me up (again) today

      Back to TIG's comment about plural vs. singular names for arrays, here is the way I'm naming things. In this context, the singular terms seem to work better for me, probably because I think of it as the mathematical notation P[sub:2dctu78y]0[/sub:2dctu78y], P[sub:2dctu78y]1[/sub:2dctu78y], ... P[sub:2dctu78y]N[/sub:2dctu78y].

      =begin
      
                point[N]
                        x-------------x point[0]  angle[0] = angle_between vector[N], vector[0]
                           vector[N]   \
        vector[N] = point[N], point[0]  \
                                         \
                                vector[0] \
            vector[0] = point[0], point[1] \
                                            x point[1]  angle[1] = angle_between vector[0], vector[1]
                                           /
                                vector[1] /
          vector[1] = point[1], point[2] /
                                        /
                                       /
                                      x point[2]  angle[2] = angle_between vector[1], vector[2]
      
      =end
      
      posted in Developers' Forum
      A
      August
    • RE: SketchUp-Ruby Resources

      In his main post above, Dan basically suggests becoming very familiar with Ruby before beginning to use it with Sketchup. And he has a very good point, especially when it comes to the powerful and rather esoteric ways that Dan himself can use Ruby.

      However, in the other direction, the Bastard's Book above, http://ruby.bastardsbook.com/, makes the point that "Programming and knitting are both skills that require continual practice but aren't easily improved by doing things other than, well, actually programming or knitting." So he presents lots of simple ways to get in your practice. "The good thing about programming compared to knitting a scarf is that you can experiment and mess up all you want without having to go out and buy more yarn."

      Even further in that direction, Matthew Scarpino's book, "Automatic Sketchup", gives you ways to get that fundamental practice by working in Sketchup. And that's your goal, isn't it? I would even recommend Matt's book and SketchUp Ruby for initial programming instruction -- the instant gratification of creating SU objects is hard to beat.

      And don't let the Amazon price for this out-of-print book scare you off. It's available free at the author's site. See also this thread, Automatic Sketchup book can now be freely downloaded.

      posted in Developers' Forum
      A
      August
    • RE: This tripped me up (again) today

      Thanks Dan,

      So refine allows me to add my own operators to an existing class? That's a sweet (and dangerous) concept.

      I'll have to put that on the back burner for now. I'm still working on basic Ruby.

      posted in Developers' Forum
      A
      August
    • RE: This tripped me up (again) today

      TIG, I'm not sure that clone does what you say it does.

      This page, http://lukaszwrobel.pl/blog/copy-object-in-ruby suggests that a clone's elements still point to the original elements so some changes to one will indeed show up in the other. That's what I found with my initial testing.

      Above, Dan says
      @unknownuser said:

      It WILL work for any custom Sketchup classes that provide an overidden version of clone, such as:
      Geom::Point3d
      Geom::Transformation
      Geom::Vector3d

      • note that these work like dup and not clone (in that they do not copy the frozen state of the receiver.)

      The Ruby inherited edition will not work for many C++ objects like Sketchup::Face.
      So I didn't use .clone.

      And yet, I just tried in the SU Ruby console:

      > a = ["a","b", "c"]
      ["a", "b", "c"]
      > b = a
      ["a", "b", "c"]
      > c = a.clone
      ["a", "b", "c"]
      > d = a << "d"
      ["a", "b", "c", "d"]
      > a
      ["a", "b", "c", "d"]
      > b
      ["a", "b", "c", "d"]
      > c
      ["a", "b", "c"]
      > a[2] = "3"
      3
      > a
      ["a", "b", "3", "d"]
      > b
      ["a", "b", "3", "d"]
      > c
      ["a", "b", "c"]
      > d
      ["a", "b", "3", "d"]
      
      

      which shows that for these two kinds of changes, the clone is not affected.

      I'm still not clear on when I can use .clone and when not, nor do I really understand shallow vs. deep copies and frozen objects, so for now, unless I'm doing tens of thousands of copies, I may use a brute force method becuase the shortcuts seem so problematical.

      Thanks,
      =A=

      posted in Developers' Forum
      A
      August
    • RE: This tripped me up (again) today

      Thanks TIG.

      I had not tried using that additional set of square brackets. It makes sense.

      As for naming, I thought about using plural in the first place, but most of my usages were as singular references, point[0], point[1], ... point[n-1], point[n] where the singular read better to me. I like "curve_points" -- that is always used as a group, never individually, so plural reads much better there.

      Thanks,
      August

      posted in Developers' Forum
      A
      August
    • RE: This tripped me up (again) today

      I am SO glad that I found this 5-year-old thread. I, too, was having trouble copying an array and having the copy be independent of the original.

      In my case, I had an array of points that I had generated, and I wanted to create a closed curve from them. My strategy was to copy the point array
      curve = []
      curve = point
      and then add point[0] to the end,
      curve << point[0]
      so that a curve created from the new curve[] array would return to its beginning point.
      path = ents.add_curve curve

      But the above sequence kept adding the extra point to the point array too.

      What I finally kludged around to was
      curve = []
      curve = point[0..(point.length - 1)]
      curve << point[0]
      path = ents.add_curve curve

      Using the sample code from the above discussion, I have tested and confirmed that
      b = a.dup
      and
      b = a.clone
      both have the same problem as my initial
      curve = point

      And I have confirmed that
      b = a.dclone
      gives an error.
      I'm using SU 15, which is supposed to have Ruby 2.0 and Dan notes that dclone is in 1.9, so I'm confused.

      I do have a kludge that works. Maybe it's not so much of a kludge after all. I understand the issue a little more, and hopefully I will remember it in the future.

      FWIW, I hope this helps,
      August

      posted in Developers' Forum
      A
      August
    • RE: Location of SketchUp 2015 Plugins Folder on Mac

      @unknownuser said:

      ... or modify $: to find them.

      This is starting to get a bit off topic from the title, but...

      HOW do you modify $:? Where is it defined? Is it a shell variable or a Ruby variable?

      Thanks.

      posted in SketchUp Discussions
      A
      August
    • RE: Location of SketchUp 2015 Plugins Folder on Mac

      Thanks Dave. I went through this thread multiple times and each time I obviously overlooked "Plugins folder is in your User/Library... path not HD path...". I guess I was expecting to see something with more than two parts.

      TIG, thanks for the tip about the $: variable. I had not seen that before. However, I'm confused by your reference to "the two ../Tools/RubyStdLib folders" because I don't seem to have them.

      I have a pretty much "out of the box" SU 2015 MAC installation and my $: contains:
      ["/Applications/SketchUp 2015/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.0/lib/ruby/site_ruby/2.0.0",
      "/Applications/SketchUp 2015/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.0/lib/ruby/site_ruby/2.0.0/x86_64-darwin12.5.0",
      "/Applications/SketchUp 2015/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.0/lib/ruby/site_ruby",
      "/Applications/SketchUp 2015/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.0/lib/ruby/vendor_ruby/2.0.0",
      "/Applications/SketchUp 2015/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.0/lib/ruby/vendor_ruby/2.0.0/x86_64-darwin12.5.0",
      "/Applications/SketchUp 2015/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.0/lib/ruby/vendor_ruby",
      "/Applications/SketchUp 2015/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.0/lib/ruby/2.0.0",
      "/Applications/SketchUp 2015/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.0/lib/ruby/2.0.0/x86_64-darwin12.5.0",
      "/Applications/SketchUp 2015/SketchUp.app/Contents/Resources/Content/Tools",
      "/Users/amohr/Library/Application Support/SketchUp 2015/SketchUp/Plugins"]

      Is that Tools/RubyStdLib folder where you install Ruby extension modules rather than SU extensions?

      Thanks again,
      August

      posted in SketchUp Discussions
      A
      August
    • RE: Location of SketchUp 2015 Plugins Folder on Mac

      Thanks TIG. I'll edit my post to emphasize that that my $: list is from a Mac.

      posted in SketchUp Discussions
      A
      August
    • 1 / 1