sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Divide_Cpoint.rb > Question for Didier Bur

    Scheduled Pinned Locked Moved Plugins
    11 Posts 2 Posters 3.0k 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.
    • JClementsJ Offline
      JClements
      last edited by

      Hi Didier:

      1- Would it be possible for this script to work on Polylines (arcs, circles, "welded" segments, etc.) as well?

      2- It looks like you are able to load the script without specifying the .rb name, correct?
      What part of the code enables the script to be loaded then?

      Regards, John

      John | Illustrator | Beaverton, Oregon

      1 Reply Last reply Reply Quote 0
      • Didier BurD Offline
        Didier Bur
        last edited by

        Hi John,

        @unknownuser said:

        Would it be possible for this script to work on Polylines (arcs, circles, "welded" segments, etc.)

        Why not ? I will look into it when I've some time.

        @unknownuser said:

        It looks like you are able to load the script without specifying the .rb name

        No, it's a regular rb and if it is not in the Plugins folder it won't load.
        Maybe you are talking about the fact that it "loads on demand" via the context menu when a valid selection is active ?

        DB

        1 Reply Last reply Reply Quote 0
        • JClementsJ Offline
          JClements
          last edited by

          "No, it's a regular rb and if it is not in the Plugins folder it won't load.
          Maybe you are talking about the fact that it "loads on demand" via the context menu when a valid selection is active ?"

          Yes that must be it. I don't think I've ever investigated "load on demand" before.
          a) So what code segment specifically tells SU to load this script?
          b) And I take it that model.start_operation "Divide with construction points" defines what is shown in the menu, correct?

          Reason I ask is that I almost always change the menu name displayed by adding the script's file and author in brackets; for example, "Add Construction Points at Equal Intervals [Divide_CPoint.rb Didier Bur]. Even though my menus get rather large, its easy for me to identify which script is responsible for a particular menu item.

          John | Illustrator | Beaverton, Oregon

          1 Reply Last reply Reply Quote 0
          • Didier BurD Offline
            Didier Bur
            last edited by

            @unknownuser said:

            what code segment specifically tells SU to load this script?

            None. The script IS loaded from SU start, BUT the option appears in the context menu only under precise circumstances. Here the "divide_cpoint_valid_selection" function checks for a selection of 1 element of type "Edge".

            @unknownuser said:

            model.start_operation "Divide with construction points" defines what is shown in the menu, correct?

            Nope. It's the label after the "Undo" in the Edit menu when you undo the operation. It tells SU to "memorize" all what's hapenning from that point until the "commit_operation" statement in the code, to further undo it globally if needed.

            If you want to change the menu, go to the line
            menu.add_item("Divide with construction points") { divide_cpoint } and edit between the quotes.
            Regards,

            DB

            1 Reply Last reply Reply Quote 0
            • JClementsJ Offline
              JClements
              last edited by

              Thanks Didier, for taking the time to explain.

              Ingenious how it works.

              Regards, John

              John | Illustrator | Beaverton, Oregon

              1 Reply Last reply Reply Quote 0
              • JClementsJ Offline
                JClements
                last edited by

                ☀

                Works great, thanks.

                You know what this leads to ... an option to explode the line/arc/circle at construction points. :}?

                John | Illustrator | Beaverton, Oregon

                1 Reply Last reply Reply Quote 0
                • Didier BurD Offline
                  Didier Bur
                  last edited by

                  I also add a quarter of an hour "free time" to implement arcs and circles
                  Polylines are more tricky...
                  Download it here (same link than first version):
                  http://www.sketchucation.com/forums/scf/viewtopic.php?f=153&t=5633&p=32173#p32173

                  DB

                  1 Reply Last reply Reply Quote 0
                  • Didier BurD Offline
                    Didier Bur
                    last edited by

                    Do-able. Wait 5 mn 🤣

                    Edit: Explode working for lines, arcs, circles.

                    DL here 'same link than previous versions):
                    http://www.sketchucation.com/forums/scf/viewtopic.php?f=153&t=5633&p=32173#p32173

                    DB

                    1 Reply Last reply Reply Quote 0
                    • JClementsJ Offline
                      JClements
                      last edited by

                      Didier, it kind of works.

                      Try the attached .skp; 3-segmented arc with points for 7 divisions.

                      Similar results with other arcs.

                      Some vertices without a point are divided and segments with points not being divided. Divisions that are defined by begining with a point, then a vertex, and end with a point are not equal in length to other divisions.

                      I just tried dividing a 3-segment arc into 11 divisions, the last division got deleted.

                      Also could cpoints be automatically group?


                      3line curve with 7 points.skp

                      John | Illustrator | Beaverton, Oregon

                      1 Reply Last reply Reply Quote 0
                      • Didier BurD Offline
                        Didier Bur
                        last edited by

                        Updated.
                        http://www.sketchucation.com/forums/scf/viewtopic.php?f=153&t=5633
                        Should work OK now, BUT, it is unfortunately impossible to rebuild several curves between cpoints, because new segments to draw do not have the same lengthes within a sub-curve, so there's no way to retrieve the same curve than the original.
                        Regards,

                        DB

                        1 Reply Last reply Reply Quote 0
                        • JClementsJ Offline
                          JClements
                          last edited by

                          Merce, Didier.

                          Regards, John

                          John | Illustrator | Beaverton, Oregon

                          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