sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Place components at guide points?

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    9 Posts 3 Posters 1.2k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F Offline
      fjb80
      last edited by

      I am able to import a GPX file into Adobe Illustrator CS through a GIS plugin. It's showing tree locations on a specific site. When I export a CAD file of points, even if I change them to symbols in Illustrator, they are imported into SketchUp as Guide Points.

      Is there a way to place a component using a guide point as reference? Similar to the "replace selected" in the components window. Or maybe there's a plugin that would let you "place component at guidepoint."

      Thanks,

      Fraser

      Note I've tried this using QGIS to export as a DXF too with the same result.

      I'm using SU on an iMac with 32GB RAM, OSX10 and SketchUp Pro 2017.

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        Let's assume you have all of the cpoints [aka guide-points] selected.
        Let's also assume that you have a component definition named 'MyTree' [edit n=... below to suit what you actually have !]
        This code snippet will add a component instance of MyTree at each point...

        n='MyTree';m=Sketchup.active_model;s=m.selection;ps=s.grep(Sketchup;;ConstructionPoint);m.start_operation('ex',true);d=m.definitions[n];ps.each{|pt|m.active_entities.add_instance(d, Geom;;Transformation.new(pt.position))}if d;m.commit_operation;
        

        [mod=:21w308lk]Corrected typos in previous example, added operation block for one-step undo.[/mod:21w308lk]

        TIG

        1 Reply Last reply Reply Quote 0
        • F Offline
          fjb80
          last edited by

          Thanks for the response TIG. It sounds like a great solution. Where would I paste that line of code? Is this an option in SketchUp?

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            SketchUp's menu Window > Ruby Console.
            Paste the whole line in the bottom section and press 'enter'.

            The Ruby Console is your friend and lets you run many useful 'snippets' of code...

            Incidentally, my example code filters the cpoints from the current selection, so there's no need to be super-careful when making the selection...

            TIG

            1 Reply Last reply Reply Quote 0
            • F Offline
              fjb80
              last edited by

              Hmmm... I have a component called "2DTREE-CEDAR01". When I input your line of code with that replacing 'MyTree':

              n='2DTREE-CEDAR01';m=Sketchup.active_model;ps=m.selection.grep(Sketchup::ConstructionPoint);d=

              I get the following error:

              Error: #<SyntaxError: <main>: syntax error, unexpected end-of-input
              ...Sketchup::ConstructionPoint);d=
              ... ^>
              SketchUp:1:in `eval'

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                My typos, sorry, I hadn't tested it - in a rush...
                I have edited the original code - it should now work [I actually had time to test it this time!]...
                It now also has an operation block, so it's one-step undo-able...

                Please redo the n=...; part to suit your component[s].

                TIG

                1 Reply Last reply Reply Quote 0
                • F Offline
                  fjb80
                  last edited by

                  SUCCESS!

                  Thanks TIG!


                  Trees

                  1 Reply Last reply Reply Quote 0
                  • cottyC Offline
                    cotty
                    last edited by

                    There's an option for this (Insert Components at CPoints) in Thomthoms GuideTools too.

                    my SketchUp gallery

                    1 Reply Last reply Reply Quote 0
                    • F Offline
                      fjb80
                      last edited by

                      That worked wonderfully too!

                      Thanks cotty!

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        Last post
                      Buy SketchPlus
                      Buy SUbD
                      Buy WrapR
                      Buy eBook
                      Buy Modelur
                      Buy Vertex Tools
                      Buy SketchCuisine
                      Buy FormFonts

                      Advertisement