sketchucation logo sketchucation
    • Login
    šŸ¤‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Making a group out of everything in a component definition

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 2 Posters 8.7k Views 2 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.
    • Al HartA Offline
      Al Hart
      last edited by

      We wanted to take all the exiting geometry in a component definition, and put it in a group within the same component definition, so that we could put the new group in a layer, which made it easy to turn off a layer to hide all of the existing geometry. (This was part of our project to convert hi-poly components so that they could be displayed as lo-poly proxies just by turning layers on and off)

      We came up this this logic:
      (I thought I would share this here in case anyone ever need to perform a similar task)

      1. Make a new dummy component instance with the same definition as the original component

      2. Make the dummy component instance unique. (It now has a cloned copy of the geometry in the original component definition)

      3. Erase the geometry from the definition of the original component.

      4. Add a group to the original component definition and give it the layer desired.

      5. Place an instance of the dummy component into the group in the original component.

      6. Explode the instance, in the group in the original component definition.

      • (You can also add additional information to the original component - such as the low-poly geometry.)
      1. Erase the dummy component instance and the dummy component definition.
        (I was not able to figure out how to remove a component instance - I used purge_unused instead)

      Here is a sample ruby script which does this:

      lo_poly.rb

      This seems to work well, but is rather complicated.

      Is there some easy way to do this that I am missing?

      Al Hart

      http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
      IRender nXt from Render Plus

      1 Reply Last reply Reply Quote 0
      • S Offline
        sorgesu
        last edited by

        1. Edit the component.
        2. Select all of the geometry of the component and "copy" which will copy it all to the clipboard.
        3. Create one simple segment, still within the component, and Make a group out of it. ( I don't believe that the "right click" works to get the "make group" option when you only have a single segment so you will need to use the "make group" option under the edit menu or, if you have one, a keyboard shortcut".
        4. Edit the group.
        5. Erase the segment that you didn't need anyway, and choose "paste in place" from the edit menu. This will place the geomtry in the clipboard inside the group.
        6. Close the group and associate the group with whatever layer you want.
        7. Do whatever you need to do with the component geometry outside the group and inside the component.

        Susan Sorger
        Former Seller Hand Rendered Entourage
        Former Canadian Authorized Training Centre, SketchUp

        1 Reply Last reply Reply Quote 0
        • Al HartA Offline
          Al Hart
          last edited by

          @sorgesu said:

          1. Edit the component.
          2. Select all of the geometry of the component and "copy" which will copy it all to the clipboard.

          I;m not sure how to emulate "Edit Component" from a ruby script.

          Ditto, for copy and paste.

          Al Hart

          http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
          IRender nXt from Render Plus

          1 Reply Last reply Reply Quote 0
          • S Offline
            sorgesu
            last edited by

            can't help there. I have no clue how to do a ruby.

            I know for a fact that edit component is possible since I own a ruby that does that.
            I have posted it once before. It is called cleanimage.rb and it edits a component and hides all the lines.

            I have uploaded it here
            Perhaps you can deconstruct the ruby to see the way to "edit component". I have nothing that does a "paste in place" that I am know of, but I'm sure one of the guys here who do ruby scripts can be of help.


            clean_image.rb

            Susan Sorger
            Former Seller Hand Rendered Entourage
            Former Canadian Authorized Training Centre, SketchUp

            1 Reply Last reply Reply Quote 0
            • S Offline
              sorgesu
              last edited by

              Sorry Al. I didn't even notice that it was in the Ruby forum since I always view "active topices".
              I also thought you wanted both the "group" as well as the component. Sorry about that. I'll leave the ruby queries to the ruby experts and I'll make sure to check which forum the question comes from.

              Susan Sorger
              Former Seller Hand Rendered Entourage
              Former Canadian Authorized Training Centre, SketchUp

              1 Reply Last reply Reply Quote 0
              • Al HartA Offline
                Al Hart
                last edited by

                I appreciate your trying to help, Susan, but I put this query in the ruby forum because I was soliciting help from other ruby programmers on how best to do this task.

                It is easy in SketchUp itself, as you point out, although probably even easier than you suggest because you can probably:

                1. Open the component for edit
                2. Select all the geometry in the component
                3. Right click and select Make group

                and you have the group.

                My problem is that this is much more difficult in Ruby, unless there is a ruby command for #1 and #3 (there is a one line command for #2)

                Again, though, thanks for offering your help.

                Al Hart

                http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
                IRender nXt from Render Plus

                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