Author Topic: Stretch Mleader  (Read 6344 times)

0 Members and 1 Guest are viewing this topic.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: Stretch Mleader
« Reply #15 on: September 19, 2017, 03:14:22 PM »

In Bricscad is not possible to stretch with "closed" Windows (x p1 = x p2) for perpendicular lines, see:  (Bricscad need a Window outside end point):
Code: [Select]
(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)
)

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Stretch Mleader
« Reply #16 on: September 20, 2017, 01:51:32 PM »
Just thinking outloud, haven't written any code yet, but how about this idea?

  • 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
  • Filter to only included the selected leader
  • Stretch as applicable

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: Stretch Mleader
« Reply #17 on: September 20, 2017, 03:51:31 PM »
Just thinking outloud, haven't written any code yet, but how about this idea?

  • 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
  • Filter to only included the selected leader
  • Stretch as applicable
I had thought of this solution but maybe not so simple, if i use NENTSEL on my MULTILEADER I get:
Code: [Select]
(
   (-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)
)



cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Stretch Mleader
« Reply #18 on: October 02, 2017, 07:55:35 PM »
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

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.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: Stretch Mleader
« Reply #19 on: October 03, 2017, 07:42:33 AM »
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

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.
Thanks for the answer, I need some time to examine your code...  :?

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: Stretch Mleader
« Reply #20 on: October 23, 2017, 12:09:04 PM »

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

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.
Sorry for delay...


I have modified this:
(command "._-layer" "_n" "LEADER" "_color" "_WHITE" "" "_lweight" "DEFAULT" "" "_ltype" "CONTINUOUS" "" "")
(command "._-layer" "_n" "LEADER" "_color" "_WHITE" "" "_lweight" "DEFAULT" "" "_ltype" "CONTINUOUS" "" "_pstyle" "BLACK" "" "")
(command "._mleaderalign" SS "" "_O" "_P" ML)
for my italian version, but I still have errors:
Code: [Select]
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 **


cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Stretch Mleader
« Reply #21 on: October 24, 2017, 04:35:07 PM »
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.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: Stretch Mleader
« Reply #22 on: October 25, 2017, 02:46:04 AM »

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:
Comando: UL
** Error: tipo di argomento errato: numberp: nil **

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Stretch Mleader
« Reply #23 on: October 25, 2017, 04:23:40 PM »
How strange, it works ok on my system (English admittedly, but there shouldn't be anything language dependent).

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: Stretch Mleader
« Reply #24 on: October 26, 2017, 04:40:54 AM »

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
Code: [Select]
(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 **

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Stretch Mleader
« Reply #25 on: October 26, 2017, 04:48:00 PM »
Hmm, that would mean you don't have a \ in your drawing path? How is that possible?

But try adding something like the following after that line and see if it works then for you:
Code: [Select]
(if (= pos nil)
(setq pos 1)
)

or change the line:
Code: [Select]
(If (or (= (strcase (substr *path* (+ pos 8) 1)) "C") (= (getvar "USERS5") "CIVIL"))To:
Code: [Select]
(if (/= pos nil)
(If (or (= (strcase (substr *path* (+ pos 8) 1)) "C") (= (getvar "USERS5") "CIVIL"))
)

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: Stretch Mleader
« Reply #26 on: October 27, 2017, 02:26:46 AM »

Hmm, that would mean you don't have a \ in your drawing path? How is that possible?

...
I have a path, read my post:
>>> Comando: (setq  *path* (getvar "dwgprefix"))
"Z:\\Temp\\"

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Stretch Mleader
« Reply #27 on: October 27, 2017, 01:18:41 PM »
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?

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Stretch Mleader
« Reply #28 on: October 27, 2017, 01:26:35 PM »
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?

Because vl-string-position is instructed to look for a backlash at position 5 onwards (which in this case returns the last backlash at position 7); and then vl-string-position is instructed to look for a backslash at position 8 (which returns nil):
Code - Auto/Visual Lisp: [Select]
  1. _$ (setq *path* "Z:\\temp\\")
  2. "Z:\\temp\\"
  3. _$ (setq pos (vl-string-position (ascii "\\") *path* (+ (vl-string-position (ascii "\\") *path* 5) 1)))
  4. nil
  5. _$ (vl-string-position (ascii "\\") *path* 5)
  6. 7
  7. _$ (vl-string-position (ascii "\\") *path* 8)
  8. nil