Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Using 'LENGTHEN' within a lisp program

voseo
Contributor
Contributor

Using 'LENGTHEN' within a lisp program

voseo
Contributor
Contributor

Hi.  I'm Attempting to write some code that will allow me to dynamically lengthen a previously selected line, however, it appears that if I pass the line entity to the LENGTHEN command from within a Lisp routine:

(vl-cmdf "lengthen" "DY" line_2 pause "")

Where line_2 is the line entity, it always lengthens the end of the that's physically further to the left of the entity, however if I do this outside of Lisp, just using the 'LENGTHEN' command, then the end that lengthens is determined by the location at which I pick the line.

I've tried rotating the line and changing the UCS but cannot seem to trick the system into dynamically lengthening the line to its Right hand side..

Anyone know how to get around this?

Thx

 

 

 

0 Likes
Reply
Accepted solutions (1)
508 Views
5 Replies
Replies (5)

Kent1Cooper
Consultant
Consultant
Accepted solution

An entity name is not enough to tie it down, since by itself it doesn't tie down which end you want to Lengthen.  Apparently one is assumed, but on what basis, I don't know.

 

Do you have the endpoints of line_2 saved, and know which one is the end you want to Lengthen?  If so, try giving it, instead of the entity name, either the point if there won't be anything else it might "see" there instead:

(vl-cmdf "lengthen" "DY" YourEndPoint pause "")

or if there might be, the combination of entity and point, such as would be returned by (entsel):

(vl-cmdf "lengthen" "DY" (list line_2 YourEndpoint) pause "")

Kent Cooper, AIA

komondormrex
Advisor
Advisor

hi,

maybe you can get it over if you'll pass to lengthen command not the line but a point the line was picked like that

(setq line_2 (entsel))

.....

(vl-cmdf "lengthen" "DY" (cadr line_2) pause "")

0 Likes

voseo
Contributor
Contributor
Superb... Passing the entity together with the endpoint (as is returned from (entsel)) . works perfectly... I always assumed that passing anything other than an entity name or selection set to the 'Select Objects' prompt would create an error, but No!! - It works great. Many thanks.
0 Likes

Kent1Cooper
Consultant
Consultant

You're welcome.  Note that the prompt in that case is not the classic "Select objects: " but rather "Select an object to change or [Undo]: ".  It might be better if they included something like "... nearer the end to be changed" [too wordy, but clearer about what to do].

Kent Cooper, AIA
0 Likes

Sea-Haven
Mentor
Mentor

Using "T" option can be very useful also as can imply total length again pick end to change. 

 

Maybe 2 user defuns Total and dynamic.