Use the stretch command ( s ) with a crossing window?Thanks, but sometime there are objects inside the Windows... it is not very fast...
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...
(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)
)
Use the stretch command ( s ) with a crossing window?Thanks, but sometime there are objects inside the Windows... it is not very fast...
Thank you Lee, you gave me the idea to do two new commands too: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]
(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)
)
(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)
)
Good extension of the idea Marc :)New "extension" 8) :
(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)
)
(defun C:ALE_Edit_StretchMleaders ( / Pnt001 Pnt002 Ss_Str)
(if
(and
(setq Pnt001 (getpoint "\nSpecify first corner of Crossing Window (Start point of Stretch): "))
(setq Pnt002 (getcorner Pnt001 "\nSpecify opposite corner (Bricscad need a Window outside end point): "))
)
(if (setq Ss_Str (ssget "_C" Pnt001 Pnt002 '((0 . "MULTILEADER"))))
(progn (princ "\nSecond point: ") (vl-cmdf "_.STRETCH" Ss_Str "" "_NONE" Pnt001 "\\"))
(princ "\nNo Multileaders found in Crossing Window.")
)
)
(princ)
)
Just thinking outloud, haven't written any code yet, but how about this idea?I had thought of this solution but maybe not so simple, if i use NENTSEL on my MULTILEADER I get:
- Enter command
- Select line to stretch using nEntsel
- Create a stretch window based on the boundary of the object, see Lee Mac's Bounding Box function: http://www.lee-mac.com/boundingbox.html (http://www.lee-mac.com/boundingbox.html)
- Filter to only included the selected leader
- Stretch as applicable
(
(-1 . <Nome entità: 7ff7bd02ef00>)
(0 . "MULTILEADER")
(5 . "70328")
(102 . "{ACAD_REACTORS")
(330 . <Nome entità: 7ff7bd02ef50>)
(102 . "}")
(330 . <Nome entità: 7ff7bd211820>)
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "$PRC_NORM")
(100 . "AcDbMLeader")
(270 . 2)
(300 . "CONTEXT_DATA{")
(40 . 25.0)
(10 100253.0 -4310.54 0.0)
(41 . 100.0)
(140 . 100.0)
(145 . 50.0)
(174 . 1)
(175 . 6)
(176 . 0)
(177 . 0)
(290 . 0)
(296 . 1)
(341 . <Nome entità: 7ff7bd02ebe0>)
(14 0.0 0.0 1.0)
(15 100678.0 -4345.54 0.0)
(16 25.0 25.0 25.0)
(46 . 0.0)
(93 . -1073741824)
(47 . 25.0)
(47 . 0.0)
(47 . 0.0)
(47 . 0.0)
(47 . 0.0)
(47 . 25.0)
(47 . 0.0)
(47 . 0.0)
(47 . 0.0)
(47 . 0.0)
(47 . 25.0)
(47 . 0.0)
(47 . 0.0)
(47 . 0.0)
(47 . 0.0)
(47 . 1.0)
(110 100678.0 -4345.54 0.0)
(111 1.0 0.0 0.0)
(112 0.0 1.0 0.0)
(297 . 0)
(302 . "LEADER{")
(290 . 1)
(291 . 1)
(10 101153.0 -4310.54 0.0)
(11 -1.0 0.0 0.0)
(90 . 0)
(40 . 50.0)
(304 . "LEADER_LINE{")
(10 102568.0 -4770.16 0.0)
(10 102568.0 -4310.54 0.0)
(91 . 0)
(170 . 1)
(92 . -1056964608)
(340 . <Nome entità: 0>)
(171 . -2)
(40 . 0.0)
(341 . <Nome entità: 0>)
(93 . 0)
(305 . "}")
(271 . 0)
(303 . "}")
(272 . 9)
(273 . 9)
(301 . "}")
(340 . <Nome entità: 7ff7bd02ec80>)
(90 . 6816768)
(170 . 1)
(91 . -1023410155)
(341 . <Nome entità: 7ff7bd2119e0>)
(171 . -2)
(290 . 1)
(291 . 1)
(41 . 2.0)
(342 . <Nome entità: 7ff7bd02c4a0>)
(42 . 4.0)
(172 . 1)
(343 . <Nome entità: 7ff7bd2119c0>)
(173 . 1)
(95 . 6)
(174 . 1)
(175 . 0)
(92 . -1056964608)
(292 . 0)
(344 . <Nome entità: 7ff7bd02ebe0>)
(93 . -1056964608)
(10 1.0 1.0 1.0)
(43 . 0.0)
(176 . 0)
(293 . 0)
(330 . <Nome entità: 7ff7bd02ec40>)
(177 . 1)
(44 . 0.0)
(302 . "80401")
(330 . <Nome entità: 7ff7bd02ec50>)
(177 . 2)
(44 . 0.0)
(302 . "")
(294 . 0)
(178 . 0)
(179 . 1)
(45 . 25.0)
(271 . 0)
(272 . 9)
(273 . 9)
(295 . 1)
)
It is possible to get the coordinates, I have a command that liens up leaders, so it is possible, my code at: https://www.theswamp.org/index.php?topic=46576.msg516569#msg516569 (https://www.theswamp.org/index.php?topic=46576.msg516569#msg516569)Thanks for the answer, I need some time to examine your code... :?
It has been a while since I have updated it, so I am sure there are bugs in the code at this point, but it should give you a jumping off point at least.
It is possible to get the coordinates, I have a command that liens up leaders, so it is possible, my code at: https://www.theswamp.org/index.php?topic=46576.msg516569#msg516569 (https://www.theswamp.org/index.php?topic=46576.msg516569#msg516569)Sorry for delay...
It has been a while since I have updated it, so I am sure there are bugs in the code at this point, but it should give you a jumping off point at least.
Comando: L2M
Traccia all'indietro:
[0.48] (VL-BT)
[1.44] (ERRDUMP "tipo di argomento errato: numberp: nil")
[2.39] (_call-err-hook #<SUBR @00000000374a9548 ERRDUMP> "tipo di argomento errato: numberp: nil")
[3.33] (sys-error "tipo di argomento errato: numberp: nil")
:ERROR-BREAK.28 nil
[4.25] (+ nil 8)
[5.19] (C:L2M)
[6.15] (#<SUBR @0000000037705250 -rts_top->)
[7.12] (#<SUBR @00000000030f8700 veval-str-body> "(C:L2M)" T #<FILE internal>)
:CALLBACK-ENTRY.6 (:CALLBACK-ENTRY)
:ARQ-SUBR-CALLBACK.3 (nil 0)
Comando:
Comando: ul
** Error: tipo di argomento errato: numberp: nil **
Sorry, I was out on vacation, it looks like you are calling the L2M command, that is designed to convert lines and text to leaders, sorry I forgot there are multiple commands, look more at the UL command within that file.I have tested also UL:
How strange, it works ok on my system (English admittedly, but there shouldn't be anything language dependent).I have found the error on Lines: 575 and 1211
(setq *path* (getvar "dwgprefix"))
(setq pos (vl-string-position (ascii "\\") *Path* (+ (vl-string-position (ascii "\\") *path* 5) 1)))
Comando: (setq *path* (getvar "dwgprefix"))
"Z:\\Temp\\"
Comando: (setq pos (vl-string-position (ascii "\\") *Path* (+ (vl-string-position (ascii "\\") *path* 5) 1)))
nil
pos is nil so in
(If (or (= (strcase (substr *path* (+ pos 8) 1)) "C") (= (getvar "USERS5") "CIVIL"))
(+ nil 8) > ** Error: tipo di argomento errato: numberp: nil **
(if (= pos nil)
(setq pos 1)
)
(If (or (= (strcase (substr *path* (+ pos 8) 1)) "C") (= (getvar "USERS5") "CIVIL"))
To:(if (/= pos nil)
(If (or (= (strcase (substr *path* (+ pos 8) 1)) "C") (= (getvar "USERS5") "CIVIL"))
)
Hmm, that would mean you don't have a \ in your drawing path? How is that possible?I have a path, read my post:
...
So, what would cause POS to be set to nil in that line then? It should set it to the position of the \
What am I missing? Any ideas?
So, what would cause POS to be set to nil in that line then? It should set it to the position of the \I have removed these lines:
What am I missing? Any ideas?
(If (> (strlen *path*) 5)
(progn
(setq pos (vl-string-position (ascii "\\") *Path* (+ (vl-string-position (ascii "\\") *path* 5) 1)))
(If (or (= (strcase (substr *path* (+ pos 1)) "C") (= (getvar "USERS5") "CIVIL"))
(setq *IsCivil* T)
)
)
)
Honestly, I am not sure, I would have to look at the mleader style definition in the drawing you are testing with, as I haven't tested with anything quite like that one, but I think that is getting off topic here, I would post that question back in the original thread, as I said, my point of linking to it was so you could see how to get the points of the mleader.Ok, thanks. :)