Display full version of the post: Autolisp File

1616syd
27.01.2014, 22:41
Anyone got a lisp file which will enable the properties of a LWPOLYLINE to be matched to a LINE
and thus converting it into a LWPOLYLINE, in much the same way as the MATCH PROPERTIES
does with other objects.

Kent Cooper
28.01.2014, 15:09
Try this, in nearly simplest terms:
 
(defun C:MPPL
; = Match Properties of Polyline to Line [including converting Line to Polyline]  (/ pl lin)  (setq pea (getvar 'peditaccept))  (setvar 'peditaccept 1)  (setq    pl (car (entsel "\nSelect Polyline to match Line to: "))    lin (car (entsel "\nSelect Line to convert to Polyline and match selected one: "))  ); setq  (command    "_.pedit" lin ""    "_.matchprop" pl lin ""  ); command  (setvar 'peditaccept pea)); defun
 
It ought to be enhanced with valid-object-type selection controls, maybe command-echo suppression, error handling, and all the other usual bells and whistles, but as a start it works for me, in limited testing.

1616syd
28.01.2014, 15:18
Thank you for that Kent, it works OK, other than it has to be run a second
time to create the global width of the new polyline to match original if greater than 0.
Kind regards
Syd

1616syd
28.01.2014, 15:58
Hello Kent
I've managed to juggle your code with the addition of entlast in
the matchprop call instead of lin, which holds only the original data
fo the selected line, and not the new polyline.
 
(defun C:MPPL (/ pl lin)  (setq pea (getvar 'peditaccept))  (setvar 'peditaccept 1)  (setq    pl (car (entsel "\nSelect Polyline to match Line to: "))    lin (car (entsel "\nSelect Line to convert to Polyline and match selected one: "))  ); setq  (command "_.pedit" lin "" "_.matchprop" pl (entlast) "")  (setvar 'peditaccept pea)  (princ)); defun
Kind Regards
Syd

Kent Cooper
28.01.2014, 17:02
Ah, yes, of course....  I at first had it doing Matchprop before Pedit, and I reversed that specifically in case of non-zero width, but didn't think about the entity-name change, and obviously didn't test the reversed-order version in that situation.