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

    Lines2Components?

    Scheduled Pinned Locked Moved Plugins
    22 Posts 4 Posters 5.5k Views 4 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.
    • S Offline
      su30
      last edited by su30

      Hi everybody,
      I am looking for a plugin that can make selected lines into predefined components,
      so that I can easily locate an amount of components where I want to by just drawing simple straight lines, and the scale of components
      will depend on the length of these lines.

      I think it will be good if we define the direction of the lines as the replaced components' blue axis, and we manually give them another red axis direction

      I don't know if this idea is possible to become true, but it is my wish for quite a long time. Although I can't write ruby myself, I hope this short wish will be interesting for our ruby masters!!!

      Please reply this if you have any advice or similar idea, I think that will be good for us!

      Best Su30


      Lines2Compo.jpg

      su30

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

        Here's the outline ?

        You place down some edges with different lengths in the Z (blue) direction.
        You select an instance of the required component and some of these lines, and run the script.
        One by one each line is turned into a group and then a temporary component.
        Its definition is swapped with the required component's definition.
        The temporary component definition is deleted from the model.
        The max/min Z bounds of the temporary component and the required component can be compared, and the required component scaled to suit.
        Do you want the required component to be scaled evenly in all directions (XYZ) or just in the Z ?
        Do you want the ability to rotate the component ? I think this makes it too complicated: it would require pairs of lines meeting at the 'base' point; the horizontal one giving the direction of rotation etc...

        TIG

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

          @tig said:

          Here's the outline ?

          You place down some edges with different lengths in the Z (blue) direction.
          You select an instance of the required component and some of these lines, and run the script.
          One by one each line is turned into a group and then a temporary component.
          Its definition is swapped with the required component's definition.
          The temporary component definition is deleted from the model.
          The max/min Z bounds of the temporary component and the required component can be compared, and the required component scaled to suit.
          Do you want the required component to be scaled evenly in all directions (XYZ) or just in the Z ?
          Do you want the ability to rotate the component ? I think this makes it too complicated: it would require pairs of lines meeting at the 'base' point; the horizontal one giving the direction of rotation etc...

          Hi TIG,
          Thanks for the quick reply! ๐Ÿ˜›
          I think using edge to create and control a model is very common in every modeler's daily work. I have not only once worried about putting tons of component into the right position and also change them into different scale.
          for example, I want to locate louvers around a large building, and the length of each louver changes from short to long, in this case maybe control edges is easier than control components, edges can be trimmed, be extruded and intersected. Otherwise I have no choice but scale the louvers one by one...
          So I think blue axis will surely be consistent with the direction of edges. About the red axis, I want it to be optional. For example, all facing one direction or facing to one point. I know it's hard, but I think it's promising.
          Su30

          su30

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

            Here is the case


            Edge2Compo.jpg

            su30

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

              Here is v1.0
              It turns Selected Lines into Instances of a Selected Component...

                          **Usage:**
                      Put this file into 'Plugins' folder.
                          Open a Model.
                          Place Components and Lines...
                          Select an Instance of the required Component, and 
                          at least one Line (Edge)***.
                          Pick 'Lines2Components' from the 'Plugins' Menu.
                          If the Selection doesn't contain Edges or an Instance 
                          an error dialog tells you...
                          You are prompted for the 'Scaling': None/Z/XYZ.
                          ***The Z-height (blue) of each Line relative to the Z-
                          height of the required Component sets the 'Scaling'.
                          One by one the Lines are turned into Instances of the 
                          required Component, Scaled to suit.
                          Any Scaling is about the Instance's insertion point.
                          The Instance's insertion point is taken to be the lower 
                          of the Line's ends.
                          Unless the scaling is set to 'None' 'flat' Lines 
                          (equal Zs) are not used, then the insertion point is 
                          the Line's 'start'...
              

              It doesn't do any rotations [yet] - how would you want to pass that to the script / control it etc ?

              Let me know what you think...
              EDIT: Please use the latest version available here http://forums.sketchucation.com/viewtopic.php?p=330408#p330408


              Lines2Components.rb

              TIG

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

                WOW!!! ๐Ÿ˜ฎ ๐Ÿ˜ฎ
                I can't believe my eyes! you are so quick and so great!
                I have tried it, and it can quite fit into my situation!
                Lines to Components.
                Thanks TIG! this script you have done in the past few seconds helps me a lot and is just what I've think about. ๐Ÿ˜ ๐Ÿ˜
                I hope it's also can change lines that are not vertical to the ground, but it is already good!
                Oh, This feels quite like a story!!

                su30

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

                  Feed back


                  Lines2Compo_01.jpg

                  su30

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

                    If you enable scaling (Z or XYZ) any 'flat' lines (Z=Z) are ignored, if you have a Line 'angled' in 3D then the Instance's Scaled height will be the difference in the Zs of the Line's two ends.

                    Do you want to take the Line's Length as the Instance's Scale (as it is if it's vertical) and rotate the component to match the Line's rotation ? If so then it'd need a big rewrite...

                    Note that there are some other tools to rotate/scale components 'en mass'...

                    TIG

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

                      @su30 said:

                      Feed back

                      It takes the size of the original Definition NOT it's Instance - I think you must have scaled it in the Model ?

                      Would you like it to insert the new Instances Scaled relative to the scaled Instance ? I'll post an update shortly...

                      TIG

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

                        @tig said:

                        If you enable scaling (Z or XYZ) any 'flat' lines (Z=Z) are ignored, if you have a Line 'angled' in 3D then the Instance's Scaled height will be the difference in the Zs of the Line's two ends.

                        Do you want to take the Line's Length as the Instance's Scale (as it is if it's vertical) and rotate the component to match the Line's rotation ? If so then it'd need a big rewrite...

                        Note that there are some other tools to rotate/scale components 'en mass'...

                        I agree with you, TIG
                        I think just Z direction transfer is already enough if we combine other useful scripts! And I would like this script to be a smart short but effective plugin.
                        Yeah, I'd like the height of components fit into the edges' height. If you say it is possible, I would like to go for this.

                        Brilliant!

                        su30

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

                          Here's v1.1

                          Usage:
                          Put this file into 'Plugins' folder.
                          Open a Model.
                          Place Components and Lines...
                          Select an Instance of the required Component, and
                          at least one Line (Edge).
                          Pick 'Lines2Components' from the 'Plugins' Menu.
                          If the Selection doesn't contain Edges or an Instance
                          an error dialog tells you...
                          You are prompted for the Scaling: 'Z' [default] or 'None'.
                          If 'Z' is chosen then the Z-height (blue) of each Line

                          relative to the Z-height of the required Component sets
                          the 'Scaling' - for 3D 'angled' lines this is the end's
                          Z-difference NOT the Line's length.
                          One by one the Lines are turned into Instances of the
                          required Component, and Z-Scaled to suit.
                          Z-Scaling is from the Instance's insertion point.
                          If the Scaling is 'None' then the new inserted Instances
                          have the same Z-Scaling as the initially selected Instance.
                          If the Scaling is 'None' then 'flat' Lines (equal end-Zs)
                          can be used, the insertion point is then the Line's 'start':
                          otherwise each Instance's insertion point is taken to be
                          the lower of the Line's ends. Note that any Scaling other
                          than in the Z for the Selected Instance is ignored in the
                          newly placed Instances...
                          See how this goes...
                          EDIT: Please use the latest version available here http://forums.sketchucation.com/viewtopic.php?p=330408#p330408


                          Lines2Components.rb

                          TIG

                          1 Reply Last reply Reply Quote 0
                          • Chris FullmerC Offline
                            Chris Fullmer
                            last edited by

                            Great thread here guys. A while back I made 3 Line Tool plugin. It essentially will make vertical lines very quickly. Just activate it and click click click. Use the VCB/measurement box to adjust the height of the lines. 1 tool will draw a line from wherever you click to a certain elevation. the 2nd tool will draw a line X units tall from whereever you click and the other tool draws a line perpendicular to whatever you click on. I think you might find it useful for quickly populating a scene with vertical lines.

                            301 Moved Permanently

                            favicon

                            (www.sketchucation.com)

                            Chris

                            Lately you've been tan, suspicious for the winter.
                            All my Plugins I've written

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

                              Thanks TIG! Great effort! ๐Ÿ‘ ๐Ÿ‘
                              I have just used the Lines2Compo 1.1, It runs well, but I am afraid I still want the components' dimension in Z direction fit the lines length, that means a 100mm line turns into a component with the height of 100mm, sorry for the misleading if my wish was not clear enough...


                              Lines2Compo_02.jpg

                              su30

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

                                @chris fullmer said:

                                Great thread here guys. A while back I made 3 Line Tool plugin. It essentially will make vertical lines very quickly. Just activate it and click click click. Use the VCB/measurement box to adjust the height of the lines. 1 tool will draw a line from wherever you click to a certain elevation. the 2nd tool will draw a line X units tall from whereever you click and the other tool draws a line perpendicular to whatever you click on. I think you might find it useful for quickly populating a scene with vertical lines.

                                301 Moved Permanently

                                favicon

                                (www.sketchucation.com)

                                Chris

                                It's right! I think this effort TIG have made can perfectly match your 3line tool plugin. We can combine these two plugins together and use them in jobs such as planting trees, and it's accurate when we want to do something more complicated. ๐Ÿ˜›

                                su30

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

                                  @unknownuser said:

                                  I am afraid I still want the components' dimension in Z direction fit the lines length, that means a 100mm line turns into a component with the height of 100mm, sorry for the misleading if my wish was not clear enough...

                                  It does that for me ? The default of 'Z' scales the compos to match the lines' heights.
                                  The other option 'None' just places compos sized as the original instance's scale at the lines' bases.

                                  If you make a series of different height lines don't you get the compo's scaled to match ?

                                  EDIT: It WAS OK for me but did some more tests and after using it once it goes haywire - looking at cause... v1.2 on it's way...

                                  In passing - I think you could also perhaps use Grow.rb to place compo's around in a circle, each rotated to match and scaled incrementally in the Z, or just on a line etc... Download it and experiment...

                                  TIG

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

                                    I think there must be something different between out programs,
                                    is it because the unit?
                                    I don't know. Yeah I have downloaded your grow.rb quite a while before, but I hope this can fit into more situation than circle.
                                    I will keep finding the reason on my software! ๐Ÿ˜‰

                                    su30

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

                                      Here's v1.2 - I made the slightest tweak to the way it decides how to Z-scale the new instances based on the line height and definition height (not instance height) and now it "never" goes wrong for me now ! [never say never !]

                                      Please try and feedback...
                                      EDIT: Please use the latest version available here http://forums.sketchucation.com/viewtopic.php?p=330408#p330408


                                      Lines2Components.rb

                                      TIG

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

                                        @su30 said:

                                        I think there must be something different between out programs,
                                        is it because the unit?

                                        Units shouldn't matter as it works in SUp's base units (inches) anyway ?

                                        Try the v1.2 and report back...

                                        TIG

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

                                          Well done!
                                          I tried the function of Z scaling, and I found it's steady and correct!
                                          Here is the feedback picture...
                                          And I also find the lines can turn into the right sized components, no matter if I have scaled the original component or not!!!
                                          This is exactly the thing I am looking for!


                                          Lines2Compo_03.jpg


                                          Lines2Compo_04.jpg

                                          su30

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

                                            @tig said:

                                            @su30 said:

                                            I think there must be something different between out programs,
                                            is it because the unit?

                                            Units shouldn't matter as it works in SUp's base units (inches) anyway ?

                                            Try the v1.2 and report back...

                                            Yeah it has nothing to do with unit, I am using mm as basic unit and V1.2 fits very well!

                                            su30

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

                                            Advertisement