• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

[REQ] replace construction point with component

Scheduled Pinned Locked Moved Plugins
10 Posts 6 Posters 1.7k Views
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.
  • D Offline
    djohnson.nz
    last edited by djohnson.nz 20 Oct 2009, 11:22

    Hi all,
    I am looking for a plugin that will replace selected construction points with a component.
    Anyone know of one.
    Cheers.

    nO fiKst ideas

    1 Reply Last reply Reply Quote 0
    • J Offline
      Jackson
      last edited by 20 Oct 2009, 11:27

      Better post ruby requests in the Ruby discussions forum (add [Request] to the topic title so people know you're requesting something rather than offering).

      http://forums.sketchucation.com/viewforum.php?f=180

      Jackson

      1 Reply Last reply Reply Quote 0
      • E Offline
        Ecuadorian
        last edited by 20 Oct 2009, 14:12

        Could you give us an idea of the intended use? You could simply make that construction point a component itself and then right click > Reload component.

        -Miguel Lescano
        Subscribe to my house plans YouTube channel! (30K+ subs)

        1 Reply Last reply Reply Quote 0
        • G Offline
          Gaieus
          last edited by 20 Oct 2009, 14:17

          Imagine he has a set of construction points (imported) as place-holders for trees for instance. Now he wants to turn them into instances of the same component definition and yes, indeed, for the same reason; to be able to reload these construction point-components with real trees.

          (Do I get a beer if I guessed correctly?)
          😉


          Edit - as Jackson said, there is more chance for something in the ruby forum so I am moving the topic).

          Gai...

          1 Reply Last reply Reply Quote 0
          • H Offline
            honoluludesktop
            last edited by 20 Oct 2009, 17:53

            Assuming that you do not already have the points located, you can also make a point into a component, and insert it from the the component's menu. When you are done, "edit component" one of the component points, and insert your component into it.

            1 Reply Last reply Reply Quote 0
            • D Offline
              djohnson.nz
              last edited by 20 Oct 2009, 20:08

              you have earned yourself a light beer Gaieus,
              I am working with LIDAR information which gives me a point cloud and I want to represent the trees in the park. I would like to select a tree and replace the construction points with leaf components. (probably just green diamonds) A large tree contains about 450 construction points. This would give me an accurate representation of the canopy. If I was to make each construction point a component then replace them I would have to make 450 separate points into components (no thanks)then replace them. A script which simply replaces the selected construction points with the selected component would do that nicely. A script which relaces the component points and aligns the component to radiate away from a central point would be awesum.
              Cheers.

              nO fiKst ideas

              1 Reply Last reply Reply Quote 0
              • D Offline
                djohnson.nz
                last edited by 20 Oct 2009, 20:12

                Thanks for that code Tig. I will give that a try as soon as I have some time to experiment. Always wanted to have a go at scripts so nows my chance.

                nO fiKst ideas

                1 Reply Last reply Reply Quote 0
                • T Offline
                  TIG Moderator
                  last edited by 20 Oct 2009, 20:23

                  
                  def cpoints2components()
                    model=Sketchup.active_model
                    ents=model.active_entities
                    ss=model.selection
                    instance=nil; cpoints=[]
                    ss.each{|e|
                      cpoints<<e if e.class==Sketchup;;ConstructionPoint
                      instance=e if e.class==Sketchup;;ComponentInstance
                    }
                    if not instance or not cpoints[0]
                      UI.messagebox("Must select an Instance of a Component and at least one Cpoint.")
                      return nil
                    end#if
                    model.start_operation("cpoints2components")
                    cpoints.each{|cpoint|
                      tr=Geom;;Transformation.new(cpoint.position)
                      ents.add_instance(instance.definition,tr)
                    }
                    model.commit_operation
                  end#def
                  
                  

                  Copy this into a file called cpoints2compos.rb in the Plugins Folder.
                  Select your Cpoints and one Instance of the required Component, type/paste cpoints2components into the Ruby Console and it should swap them around. [Menu is easy too but I'll leave that to you...]
                  Cpoints are also left behind ... Delete Construction Geometry to erase them or tweak the code to erase! them afterwards...

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • G Offline
                    Gaieus
                    last edited by 20 Oct 2009, 20:38

                    Looking forward to the results - really curious how it works.

                    Gai...

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      djohnson.nz
                      last edited by 3 Nov 2009, 01:13

                      @gaieus said:

                      Looking forward to the results - really curious how it works.

                      Hi there,
                      Just got back to this today.
                      The code worked really well thanks Tig.
                      Attached is the sketchup file I used to create the trees from LIDAR
                      Its a bit fiddly but the result could be useful.
                      More could be done to change the nature of the component to get a feel for different tree types.
                      Use the layers to turn off the constructino points to see what the trees look like. Note I havent done all the trees.
                      I added very basic lines as trunks and this helps visualise the tree a bit better.
                      Remember these are New Zealand trees so they might look different to yours.
                      Cheers.


                      SU7.1 file

                      nO fiKst ideas

                      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