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

[plugin]Random replacement of components

Scheduled Pinned Locked Moved Plugins
47 Posts 13 Posters 43.8k 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.
  • S Offline
    sdmitch
    last edited by sdmitch 21 Jun 2011, 18:16

    In response to http://forums.sketchucation.com/viewtopic.php?f=323&t=37434 and others, I have written a plugin to accomplish this given two sets of components, a source set and a target set. These sets are identified by giving all the members of the set the same component name. Components also have a definition name which is what is entered when the component is created. The component name is displayed and can be assigned in the Entity Info panel. The appearence of a component is determined by the definition assigned to it by the definition name. If a sub-set of target components are pre-selected, then only those will be randomly changed.


    random replacement of components

    Nothing is worthless, it can always be used as a bad example.

    http://sdmitch.blogspot.com/

    1 Reply Last reply Reply Quote 0
    • B Offline
      Bertier
      last edited by 22 Jun 2011, 07:45

      is it possible to use this script to create custom set of trees ?

      1 Reply Last reply Reply Quote 0
      • P Offline
        pilou
        last edited by 22 Jun 2011, 10:40

        Like a building construction game yes β˜€
        just careful that all connections between parts is good managed
        But seems it's a painful work to divide a tree in small parts
        then create some variations for all these tree's parts πŸ˜‰

        But if you want remplace just all one tree by another tree no problem
        you will have different forest at each launch 😎

        Frenchy Pilou
        Is beautiful that please without concept!
        My Little site :)

        1 Reply Last reply Reply Quote 0
        • H Offline
          harnstein
          last edited by 22 Jun 2011, 11:27

          Man, that's great! Thanks to sdmitch!

          Thanks to Pilou for this tut- even if i didn't really get it..yet. πŸ˜‰

          I'll give it a try asap.

          How are the components replaced? By replacing it a the origin of axis within each component?

          Is it possible to add random scale and orientation as well (like for scattering trees)?

          Looks nice already!

          still sketchin'

          1 Reply Last reply Reply Quote 0
          • P Offline
            pilou
            last edited by 22 Jun 2011, 11:41

            @unknownuser said:

            How are the components replaced? By replacing it a the origin of axis within each component?

            I believe Yes

            @unknownuser said:

            Is it possible to add random scale and orientation as well (like for scattering trees)?

            I believe you can use some existing plugs for this at the end of the process πŸ˜‰

            Like Random select by TIG
            and then make some Scale or Rotation / Move

            • in the same time Scale and Rotate mutiple who has randomly feature inside by Chris Fullmer πŸ‘ πŸ‘ πŸ‘

            Or with only the plug make a familly of trees with different Sizes and Rotations πŸ˜‰

            Frenchy Pilou
            Is beautiful that please without concept!
            My Little site :)

            1 Reply Last reply Reply Quote 0
            • S Offline
              srx
              last edited by 22 Jun 2011, 15:26

              Thank you Sam πŸ‘ ...good plugin. Maybe this cod of tig for renaming the components could be integrated in your plugin,
              so not to waste time on renaming. πŸ˜„

              www.saurus.rs

              1 Reply Last reply Reply Quote 0
              • S Offline
                sdmitch
                last edited by 22 Jun 2011, 16:50

                First, there is no reason the change the component.definition.name only the component.name which is the only thing that the plugin checks for. If you select those components that you want to use as the Source set then, from the ruby console, "Sketchup.active_model.selection.each{|c| c.name='Source'}" will properly identify them as the Source set. Substitute 'Target' for 'Source' to identify the selected Target set.

                Nothing is worthless, it can always be used as a bad example.

                http://sdmitch.blogspot.com/

                1 Reply Last reply Reply Quote 0
                • P Offline
                  pilou
                  last edited by 22 Jun 2011, 16:58

                  I will change again my tut πŸ˜‰
                  PS You can make the same for Target's Components πŸ˜‰
                  "Sketchup.active_model.selection.each{|c| c.name='Target'}"

                  Frenchy Pilou
                  Is beautiful that please without concept!
                  My Little site :)

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    sdmitch
                    last edited by 22 Jun 2011, 19:24

                    Pilou, Thanks again for providing the tutorial. It looks perfect!!!

                    Nothing is worthless, it can always be used as a bad example.

                    http://sdmitch.blogspot.com/

                    1 Reply Last reply Reply Quote 0
                    • P Offline
                      pilou
                      last edited by 22 Jun 2011, 22:26

                      In fact that is some redundant with the use of the Dialog box Info for rename a group of components! 😳 πŸ˜„

                      Frenchy Pilou
                      Is beautiful that please without concept!
                      My Little site :)

                      1 Reply Last reply Reply Quote 0
                      • P Offline
                        pilou
                        last edited by 27 Jun 2011, 00:32

                        Little teaser β˜€
                        The 24 position Plug always by Sdmitch will be released in a few time! 😎
                        A very pleasant plug! πŸ‘twenty4position.jpg

                        Frenchy Pilou
                        Is beautiful that please without concept!
                        My Little site :)

                        1 Reply Last reply Reply Quote 0
                        • EdsonE Offline
                          Edson
                          last edited by 27 Jun 2011, 11:38

                          @sdmitch said:

                          In response to http://forums.sketchucation.com/viewtopic.php?f=323&t=37434 and others, I have written a plugin to accomplish this given two sets of components, a source set and a target set. These sets are identified by giving all the members of the set the same component name. Components also have a definition name which is what is entered when the component is created. The component name is displayed and can be assigned in the Entity Info panel. The appearence of a component is determined by the definition assigned to it by the definition name. If a sub-set of target components are pre-selected, then only those will be randomly changed.

                          it would be great if the plugin's author could explain how to use it or, better still, post a tutorial showing it.

                          sorry, pilou, but yours is not that clear to me.

                          edson mahfuz, architect| porto alegre β€’ brasil
                          http://www.mahfuz.arq.br

                          1 Reply Last reply Reply Quote 0
                          • P Offline
                            pilou
                            last edited by 27 Jun 2011, 11:51

                            πŸ˜„ @Edson ("Definition Name" and "Name" are two distinc thing in a component)
                            select some components with different "Definition Name" in any position
                            Give the "Name" Source to these selection with the Info Dialog box

                            Draw another one component: Draw copy past it anywhere you want in any position
                            Select all these copies
                            Give the "Name" Target to the all selection copies with the Info Dialog box

                            launch the plugin Random Replacement πŸ˜„
                            I can't be more clear πŸ˜„

                            (the 24 positions is another plugin not yet released πŸ˜‰

                            Frenchy Pilou
                            Is beautiful that please without concept!
                            My Little site :)

                            1 Reply Last reply Reply Quote 0
                            • EdsonE Offline
                              Edson
                              last edited by 27 Jun 2011, 12:34

                              @unknownuser said:

                              πŸ™‚ @Edson ("Definition Name" and "Name" are two distinc thing in a component)
                              select some components with different "Definition Name" in any position
                              Give the "Name" Source to these selection with the Info Dialog box

                              Draw another one component: Draw copy past it anywhere you want in any position
                              Select all these copies
                              Give the "Name" Target to the all selection copies with the Info Dialog box

                              launch the plugin Random Replacement πŸ˜„
                              I can't be more clear πŸ˜„

                              (the 24 positions is another plugin not yet released πŸ˜‰

                              thanks, pilou. you are right: in writing, the explanation is very clear.

                              I have been asking for a similar plugin for a long time but no one seemed willing to create one. for me it will be very useful to randomize vegetation and windows (closed, open, half this, half that, etc).

                              a comment though: one does not necessarily have to name the source components source and the target ones target for the plugin to work. first I named them as you suggested and then I named them 1 and 2. the plugin worked in both situations. so, as long as there is a named source group and a named target group it works fine.

                              edson mahfuz, architect| porto alegre β€’ brasil
                              http://www.mahfuz.arq.br

                              1 Reply Last reply Reply Quote 0
                              • P Offline
                                pilou
                                last edited by 27 Jun 2011, 12:36

                                @Edson πŸ˜„

                                No, Source and Target are not nescessary names πŸ˜‰
                                It's just these given by default in the dialog box πŸ˜‰
                                you can put any names you want πŸ˜„ (of course these that you have yet renamed your components in the Info Box πŸ˜‰
                                But carreful it's sensitive cases !!!

                                Frenchy Pilou
                                Is beautiful that please without concept!
                                My Little site :)

                                1 Reply Last reply Reply Quote 0
                                • P Offline
                                  pilou
                                  last edited by 27 Jul 2011, 22:22

                                  And here the 24 positions plug of Sdmitch πŸ˜‰
                                  With his autorisation! 😎


                                  Pilou24Positions.rb

                                  Frenchy Pilou
                                  Is beautiful that please without concept!
                                  My Little site :)

                                  1 Reply Last reply Reply Quote 0
                                  • A Offline
                                    AcesHigh
                                    last edited by 12 Aug 2011, 14:52

                                    there are many uses for this plugin.

                                    for example... think of 3D tiles on a roof. Each tile is a component. But the roof gets so artificial, with all the tiles exactly the same color, no stains, etc. With this plugin, you would be able to, for example, create some 10 different roof tiles, each of them a slight different color variation, some stains, etc. And randomly replace the original components along the entire roof.

                                    another possibility: a building with a glass faΓ§ade. Real such buildings will have curtains/blinds behind the windows. Make the the building with window components. The random replace them with OTHER window components, each window component with blinds in different positions (no blinds, blinds half way pulled, pulled down completely)

                                    there are so many uses!!!

                                    1 Reply Last reply Reply Quote 0
                                    • R Offline
                                      rachmatrf
                                      last edited by 21 Feb 2012, 08:28

                                      Thhank you Sdmitch

                                      1 Reply Last reply Reply Quote 0
                                      • P Offline
                                        pilou
                                        last edited by 31 May 2012, 09:39

                                        Sdmitch has made a new variant with no Random integrated! β˜€
                                        (see second post for more precsion of use πŸ˜‰

                                        No Random.jpg


                                        31 May 2012

                                        Frenchy Pilou
                                        Is beautiful that please without concept!
                                        My Little site :)

                                        1 Reply Last reply Reply Quote 0
                                        • P Offline
                                          pilou
                                          last edited by 31 May 2012, 10:50

                                          A little tut πŸ˜‰
                                          No limite of number of any components source or target! πŸ‘
                                          You can name all your source components by hand but it's painfull when you have numerous!
                                          So a little trick πŸ˜‰
                                          Just select Components source and copy this in the ruby console
                                          Sketchup.active_model.selection.each{|c| c.name='Source'}
                                          Your source components are now named "Source"
                                          You can make the same for Target Component πŸ˜‰
                                          Just select Components source and copy this in the ruby console
                                          Sketchup.active_model.selection.each{|c| c.name='Target'}

                                          Edit : In fact for the rename Source and Target you can make the just with the Entity Info Box! πŸ’š

                                          rollend1.jpg
                                          You can now use the random plug πŸ˜‰ (click for zoom)
                                          rollend2.jpg

                                          Of course it's infinite possibilities πŸ˜’
                                          trop rigolo.jpg

                                          You can fill the space with no periodic infinite volumes πŸ’š
                                          Rollem2.jpg
                                          you can play with this speedy one πŸ˜„

                                          Edit 31 May 2012
                                          A new variant without random is integrated!
                                          No Random.jpg


                                          Dice2.skp


                                          renameInstances.rb


                                          31 May 2012

                                          Frenchy Pilou
                                          Is beautiful that please without concept!
                                          My Little site :)

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

                                          Advertisement