Line Lisp routine
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Line Lisp routine

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
aosterday
Guest





Posted: Wed Apr 06, 2005 12:37 am    Post subject: Line Lisp routine Reply with quote

I have a routine that draws a line between point 1 and point 2, then inserts a block at point 2. I now need to have the line at point 1 to extend past the point by a certain percentage. Any help I can get is much appreciated.

Back to top
Jeff Mishler
Guest





Posted: Wed Apr 06, 2005 12:48 am    Post subject: Re: Line Lisp routine Reply with quote

(setq proportion 0.1);10% longer
(setq initial_length (distance pt1 pt2))
(setq length2add (* initial_length proportion))
(setq newpt1 (polar pt1 (angle pt2 pt1) length2add))

--
Jeff
check out www.cadvault.com
"aosterday" <nospam@address.withheld> wrote in message
news:1417266.1112733504694.JavaMail.jive@jiveforum2.autodesk.com...
Quote:
I have a routine that draws a line between point 1 and point 2, then
inserts a block at point 2. I now need to have the line at point 1 to
extend past the point by a certain percentage. Any help I can get is much
appreciated.
Back to top
Kent Cooper, AIA
Guest





Posted: Wed Apr 06, 2005 1:06 am    Post subject: Re: Line Lisp routine Reply with quote

Assuming:
- you always want the line extended by the same percentage of the overall
line length, say 10%, beyond point 1, and
- your points are called pt1 and pt2 in your routine;

after inserting the block, you could do something like:

(command "lengthen" "de" (* (distance pt1 pt2) 0.1) pt1 "")

Change the 0.1 for a different percentage, and the pt1 and pt2 for the names
you use in your routine. And this assumes there's not likely to be
something else that it might find at pt1.
--
Kent Cooper

"aosterday" wrote...
Quote:
I have a routine that draws a line between point 1 and point 2, then
inserts a block at point 2. I now need to have the line at point 1 to
extend past the point by a certain percentage. Any help I can get is much
appreciated.


Back to top
aosterday
Guest





Posted: Wed Apr 06, 2005 1:10 am    Post subject: Re: Line Lisp routine Reply with quote

Thank you Jeff, that worked perfectly
Back to top
Kent Cooper, AIA
Guest





Posted: Wed Apr 06, 2005 1:11 am    Post subject: Re: Line Lisp routine Reply with quote

....then it needs something to Change the line to the newpt1 location....
--
Kent Cooper

"Jeff Mishler" wrote...
Quote:
(setq proportion 0.1);10% longer
(setq initial_length (distance pt1 pt2))
(setq length2add (* initial_length proportion))
(setq newpt1 (polar pt1 (angle pt2 pt1) length2add))
Back to top
Kent Cooper, AIA
Guest





Posted: Wed Apr 06, 2005 1:14 am    Post subject: Re: Line Lisp routine Reply with quote

....or if you had in mind to do this prior to drawing the line in the first
place, that works....
--
Kent Cooper

"Kent Cooper, AIA" wrote...
Quote:
...then it needs something to Change the line to the newpt1 location....
--
Kent Cooper

"Jeff Mishler" wrote...
(setq proportion 0.1);10% longer
(setq initial_length (distance pt1 pt2))
(setq length2add (* initial_length proportion))
(setq newpt1 (polar pt1 (angle pt2 pt1) length2add))
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Contact Us
Powered by phpBB