Author Topic: Stretch Mleader  (Read 6351 times)

0 Members and 1 Guest are viewing this topic.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Stretch Mleader
« on: September 14, 2017, 09:14:06 AM »
Is there a way to Stretch without selecting the two grips with the shift keyboard, basically like taking the midpoint as in the exploded version?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Stretch Mleader
« Reply #1 on: September 14, 2017, 10:09:34 AM »
Use the stretch command ( s ) with a crossing window?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: Stretch Mleader
« Reply #2 on: September 14, 2017, 10:39:55 AM »
Use the stretch command ( s ) with a crossing window?
Thanks, but sometime there are objects inside the Windows... it is not very fast...

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Stretch Mleader
« Reply #3 on: September 14, 2017, 11:39:03 AM »
When I explode an mleader it is a bunch of pieces ? How are you accomplishing the top image?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: Stretch Mleader
« Reply #4 on: September 14, 2017, 11:55:00 AM »
When I explode an mleader it is a bunch of pieces ? How are you accomplishing the top image?
I have exploded Mleader only to show (see DWG), but I do not want explode it...
Somethink like this, but if there are objects on the endpoints they are stretched...:
Code: [Select]
(defun C:zz ( / Pnt000)
  (setq Pnt000 (getpoint "\nSeleziona il primo punto finale della direttrice da stirare: "))
  (prompt "\nSeleziona l'altro punto finale: ")
  (vl-cmdf "_.STRETCH" "_C" Pnt000 "_END" pause "" Pnt000)
  (princ)
)

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Stretch Mleader
« Reply #5 on: September 14, 2017, 04:49:46 PM »
Maybe a combination of grread and modifying the coordinates of the mleader .. stretch seem more applicable though.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Stretch Mleader
« Reply #6 on: September 14, 2017, 06:06:27 PM »
Use the stretch command ( s ) with a crossing window?
Thanks, but sometime there are objects inside the Windows... it is not very fast...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:test ( / p q s )
  2.     (if (and (setq p (getpoint "\nSpecify first corner of crossing window: "))
  3.              (setq q (getcorner p "\nSpecify opposite corner: "))
  4.         )
  5.         (if (setq s (ssget "_C" p q '((0 . "MULTILEADER"))))
  6.             (vl-cmdf "_.stretch" s "" "\\" "\\")
  7.             (princ "\nNo multileaders found in crossing window.")
  8.         )
  9.     )
  10.     (princ)
  11. )

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: Stretch Mleader
« Reply #7 on: September 15, 2017, 02:05:08 AM »
Use the stretch command ( s ) with a crossing window?
Thanks, but sometime there are objects inside the Windows... it is not very fast...
Code - Auto/Visual Lisp: [Select]
  1. (defun c:test ( / p q s ) ...)
Thank you Lee, you gave me the idea to do two new commands too:
- stretch by filtering from selected object(s)
- stretch by filtering from selected layer(s)
 :-)

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Stretch Mleader
« Reply #8 on: September 15, 2017, 07:14:10 AM »
Way to go Lee. I don't know how many of you use Civil3D. Specially with the Grading Elevation Labels. By changing the filter to that it makes stretching those spot shots a lot easier than clicking / griping.

Code: [Select]
      (defun c:test ( / p q s )

    (if (and (setq p (getpoint "\nSpecify first corner of crossing window: "))

             (setq q (getcorner p "\nSpecify opposite corner: "))

    )

;;        (if (setq s (ssget "_C" p q '((0 . "MULTILEADER"))))

        (if (setq s (ssget "_C" p q '((0 . "AECC_SURFACE_ELEVATION_LABEL") (8 . "0-SRF-LBL"))))

            (vl-cmdf "_.stretch" s "" "\\" "\\")

            (princ "\nNo multileaders found in crossing window.")

        )

    )

    (princ)

Civil3D 2020

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Stretch Mleader
« Reply #9 on: September 15, 2017, 07:53:43 AM »
Good stuff guys, glad I could help.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Stretch Mleader
« Reply #10 on: September 15, 2017, 07:54:59 AM »
Lee. . . Man! You always Help!
Civil3D 2020

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Stretch Mleader
« Reply #11 on: September 15, 2017, 08:11:59 AM »
I know this is another off the wall question. With this scenario the user has to window the object. Works great.

But how would a user select an object and it react the same?

Like an MLeader default we click once and then click again on the grip or type in the command to stretch it.

lol save a click. Thoughts?
Civil3D 2020

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: Stretch Mleader
« Reply #12 on: September 18, 2017, 05:08:10 PM »

Stretch by filtering from selected object(s):
Code: [Select]
(defun C:ALE_Edit_StretchOnlySelected ( / p q Ss_Tot Ss_Str Countr EntNam)
  (if
    (and
      (princ "\nSelect Objects to Stretch: ")
      (setq Ss_Str (ssget))
      (setq p (getpoint "\nSpecify first corner of Crossing Window: "))
      (setq q (getcorner p "\nSpecify opposite corner: "))
    )
    (progn
      (if (setq Ss_Tot (ssget "_C" p q))
        (progn
          (repeat (setq Countr (sslength Ss_Tot))
            (or
              (ssmemb (setq EntNam (ssname Ss_Tot (setq Countr (1- Countr)))) Ss_Str)
              (ssdel EntNam Ss_Tot)
            ) 
          )         
          (if (> (sslength Ss_Str) 0)
            (progn
              (princ "\nBase point: ")
              (vl-cmdf "_.STRETCH" Ss_Tot "" "\\")
              (princ "\nSecond point: ")
              (vl-cmdf "\\")
            )
            (princ "\nNo Objects to Stretch found in Crossing Window.")
          )
        )
        (princ "\nNo Objects to Stretch found in Crossing Window.")
      )
    )
  )
  (princ)
)

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Stretch Mleader
« Reply #13 on: September 18, 2017, 05:43:31 PM »
Good extension of the idea Marc  :-)

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: Stretch Mleader
« Reply #14 on: September 19, 2017, 03:28:12 AM »

Good extension of the idea Marc  :)
New "extension"  8) :
Code: [Select]
(defun C:ALE_Edit_StretchOnlyLayerSel ( / Pnt001 Pnt002 Ss_Tot Ss_Str Countr EntNam LyrLst LyrStr LyrNam)
  (if
    (and
      (princ "\nSelect Objects on Layer to Stretch: ")
      (setq Ss_Str (ssget))
      (setq Pnt001 (getpoint "\nSpecify first corner of Crossing Window: "))
      (setq Pnt002 (getcorner Pnt001 "\nSpecify opposite corner: "))
    )
    (progn
      (repeat (setq Countr (sslength Ss_Str))
        (or
          (member (setq LyrNam (cdr (assoc 8 (entget (ssname Ss_Str (setq Countr (1- Countr))))))) LyrLst)
          (setq LyrLst (cons LyrNam LyrLst))
         ) 
      )
      (if (setq Ss_Tot (ssget "_C" Pnt001 Pnt002 (list (cons 8 (vl-string-trim "()" (vl-string-translate " " "," (vl-princ-to-string LyrLst)))))))
        (progn
          (princ "\nBase point: ") (vl-cmdf "_.STRETCH" Ss_Tot "" "\\") (princ "\nSecond point: ") (vl-cmdf "\\")
        )
        (princ "\nNo Objects to Stretch found in Crossing Window.")
      )
    )
  )
  (princ)
)