TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: notredave on August 09, 2017, 11:13:53 AM
-
Good morning all,
After Google searching with no luck, does anyone know or have a lisp routine willing to share with me that will match a rectangular polyline (2d)? I have hundreds of boxes (rectangular 2d polyline) that the drawing borders has changed scales. That leaves me having to scale down hundreds of rectangular boxes. I would also love it, if it would keep current orientation. I have combination of horizontal and vertical boxes. If anyone has seen such a lisp routine, PLEASE let me know. I would greatly appreciate it.
Thank you and good day,
David
-
Can you post a sample drawing?
-
I sure can, see attached....
-
Give this a try:
(defun c:s2a
(/ _boundingbox a e p s
) (defun _boundingbox
(o
/ ll ur
) )
)
)
)
o
'scaleentity
)
)
)
)
)
-
Here's a start - this will maintain the proportions of each rectangle:
(defun c:matchrec
( / ent idx lng lst sel src
) (setq src
(selectif
"\nSelect source rectangle: " 'rectangle
-p
)) (setq sel
(ssget "_:L" '
((0 .
"LWPOLYLINE") (90 .
4) (-4 .
"&=") (70 .
1) (-4 .
"<NOT") (-4 .
"<>") (42 .
0.0) (-4 .
"NOT>")))) )
)
)
)
)
)
)
)
(defun selectif
( msg prd
/ ent
) (prompt "\nMissed, try again.") )
( (prompt "\nInvalid object selected.")) )
)
)
)
ent
)
(defun rectangle
-p
( ent
/ p1 p2 p3 p4
) (nobulge-p enx)
(mapcar '
set '
(p1 p2 p3 p4
) (lwvertices enx
)) )
)
(defun nobulge
-p
( enx
/ bul
) )
)
)
(defun lwvertices
( enx
/ vtx
) )
)
-
WOW!!!
Ronjonp and Lee Mac, I want to thank you both so much for these lisp routines! They both work awesome!
I don't but wish I understood the language you both speak, LOL.
I'm being sincere when I say "Thank you so much!"
You have made my day. Hoping you two gents have a wonderful day!
Thanks again,
David
-
Glad to help out :) ... after looking at your test drawing, have you thought about creating an mleader style that uses your block? IMO that would tidy up the drawing quite a bit.
-
Ronjonp,
No, I have not thought about that. But, I just tried it. Thank you for your suggestion!
-
You're most welcome David, thank you for your gratitude.
Nice variation Ron :-)
-
...
Nice variation Ron :)
Thanks! :)