• 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 13 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.
  • C Offline
    coty82
    last edited by 17 Oct 2014, 01:21

    Allright, it works now, thanks alot πŸ‘ ! But i noticed that it only works with a single level in the components hierarchy, that is when i have some individual components part of a mother component. But if i include this in another larger component, it doesnt work. Even if i copy the source inside the larger component. Its still great but i wonder if this would be a difficult property to implement?

    Anyway i have another ideea about it πŸ˜„ . In a previous post you said it is also able to replace components based on a rule? For example i have 3 sources 1, 2, 3 And i want to distribute them according to a repeating pattern for ex 11231123, etc. They could replace an array of targets. This would be amazing for creating panelling patterns for facades for example. But it would probably need to work with something like series, to know the start and ending point. Dunno if its possible or how complicated?

    1 Reply Last reply Reply Quote 0
    • S Offline
      sdmitch
      last edited by 17 Oct 2014, 01:49

      Yes, it currently will only work for one level, mother and child, no grand kids.

      As the name implies, it is supposed to be a random replacement.

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

      http://sdmitch.blogspot.com/

      1 Reply Last reply Reply Quote 0
      • C Offline
        coty82
        last edited by 17 Oct 2014, 02:28

        I see there is another version with No random option, how is it working? I tried but i didnt see a difference.

        1 Reply Last reply Reply Quote 0
        • S Offline
          sdmitch
          last edited by 17 Oct 2014, 02:41

          @coty82 said:

          I see there is another version with No random option, how is it working? I tried but i didnt see a difference.

          Component Replacement has a random option which, if not selected, causes the "Target" components to be replaced in order by the "Source" components. The results is dependent on the order the "Source" components are found in the model or selection.

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

          http://sdmitch.blogspot.com/

          1 Reply Last reply Reply Quote 0
          • C Offline
            coty82
            last edited by 17 Oct 2014, 03:17

            @sdmitch said:

            @coty82 said:

            I see there is another version with No random option, how is it working? I tried but i didnt see a difference.

            Component Replacement has a random option which, if not selected, causes the "Target" components to be replaced in order by the "Source" components. The results is dependent on the order the "Source" components are found in the model or selection.

            Oh i see. And what is the rule by which it finds the "Source" components? It always gives me the same result but the initial order seems random. I couldnt replicate your example where you have components 1, 2, 3 which then become a repeated sequence in the target. Could you also integrate this no random feature in the version with child option as well? πŸ˜„ Thanks

            1 Reply Last reply Reply Quote 0
            • P Offline
              pilou
              last edited by 17 Oct 2014, 07:24

              Can you post an image of results of this new version (parent / child) ?

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

              1 Reply Last reply Reply Quote 0
              • S Offline
                sdmitch
                last edited by 17 Oct 2014, 15:55

                @unknownuser said:

                Can you post an image of results of this new version (parent / child) ?

                The result looks the same.

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

                http://sdmitch.blogspot.com/

                1 Reply Last reply Reply Quote 0
                • S Offline
                  sdmitch
                  last edited by 17 Oct 2014, 16:36

                  I have added the recursive search to my Component Replacement plugin. You can obtain a copy from my blog page. This is a total replacement for the original Random Component Replacement plugin.

                  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 17 Oct 2014, 17:02

                    Thx, I will explore this new opus! β˜€

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

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      AcesHigh
                      last edited by 20 May 2015, 18:36

                      It would be really nice if we could set % of random replacement.

                      example:

                      have a building with 300 closed window components. These will be the target

                      then we also have 4 other window components that will be used as sources: totally opened window, 3/4 opened window, half opened window and 1/4 opened window

                      this plugin, as it is, will replace ALL closed windows with a random number of each of the other 4 windows.

                      but it would be ideal if we could decide to make random ONLY which components will be replaced, not the number.

                      So...

                      Original Component Remaining: 30% (I set to 30% so 30% of the 300 closed windows will remain as the "closed window" component

                      Source 1 - 10% (of 300)
                      Source 2 - 20%
                      Source 3 - 30%
                      Source 4 - 10%

                      After the operation, in random locations of the building, we would have
                      90 closed windows (original component)
                      30 4/4 open windows
                      60 3/4 open windows
                      90 half open windows
                      30 1/4 open windows

                      1 Reply Last reply Reply Quote 0
                      • P Offline
                        pilou
                        last edited by 20 May 2015, 21:43

                        @unknownuser said:

                        It would be really nice if we could set % of random replacement.

                        Just build the source with your result % wished! πŸ˜‰
                        It's not a big deal to make some copy move for build your sets of %! πŸ˜‰

                        4 seconds * 16 cases = 1 minute πŸ˜„

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

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          sdmitch
                          last edited by 23 May 2015, 12:25

                          @pilou said:

                          @unknownuser said:

                          It would be really nice if we could set % of random replacement.

                          Just build the source with your result % wished! πŸ˜‰
                          It's not a big deal to make some copy move for build your sets of %! πŸ˜‰

                          4 seconds * 16 cases = 1 minute πŸ˜„

                          Sorry but I don't think this method will work because the Sources are picked randomly and, other trying to avoid picking the same source back to back, there is no tracking of the number of each of the sources that have been picked.

                          However, I have created a version that does if anyone else is interested.

                          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 23 May 2015, 15:51

                            If you have 50 Blue objects, 50 Pink Objects (B, P, B, P.....)
                            Pick randomly in this bicolored list as Source will be very near than 50 % / 50 % of each color! πŸ˜‰

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

                            1 Reply Last reply Reply Quote 0
                            • E Offline
                              Einstein
                              last edited by 24 Dec 2017, 23:48

                              Hi!

                              It works really nice. But if I replace many components and want to undo, I have to undo all changes one by one component. Could it be all the changes are done within one step only? Could somebody modify the script or give me a hint how to modify it? (I have no clue about coding - the only thing I can do is to replace some part of code in Notebook πŸ˜›)

                              And... if it also worked with groups... that would be gorgeous.

                              Anyways, great thanks for the Creators!

                              1 Reply Last reply Reply Quote 0
                              • S Offline
                                sdmitch
                                last edited by 25 Dec 2017, 02:13

                                @einstein said:

                                Hi!

                                It works really nice. But if I replace many components and want to undo, I have to undo all changes one by one component. Could it be all the changes are done within one step only? Could somebody modify the script or give me a hint how to modify it? (I have no clue about coding - the only thing I can do is to replace some part of code in Notebook πŸ˜›)

                                And... if it also worked with groups... that would be gorgeous.

                                Anyways, great thanks for the Creators!

                                The latest version of that plugin is Component Replacement on my blog. It has a one step Undo. Sorry but it does not work with groups only components. Groups have some component characteristics but can not assign a definition to a group like you can to a component.

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

                                http://sdmitch.blogspot.com/

                                1 Reply Last reply Reply Quote 0
                                • S Offline
                                  Sl-m
                                  last edited by 5 Aug 2019, 06:05

                                  I actually tried it in Sketchup 2019.2
                                  Nothing was happening at the beginning 😲 until I edit the SOURCE & TARGET "instance names" (not definition). It worked like a charm and It will make me save LOTS of time. You guys are champs! πŸ‘Š

                                  Tip: you can select all your source components in one go and enter their instance name in one time.
                                  Hope that helps anyone who got stuck:)

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

                                  Advertisement