TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: abdulellah on December 12, 2019, 02:55:47 PM

Title: REQ: from point draw line with preset length and angle
Post by: abdulellah on December 12, 2019, 02:55:47 PM
hello all .
please can you help me to write lisp to do this massion .
lisp sinario explained in images attached
Title: Re: REQ: from point draw line with preset length and angle
Post by: MP on December 12, 2019, 03:03:36 PM
This appears to be homework. Where is the code you've written so far? What specifically are you struggling with?
Title: Re: REQ: from point draw line with preset length and angle
Post by: abdulellah on December 12, 2019, 03:18:12 PM
 :-Psorry brother , i am not autolisper , i want lisp to this task explained in image  , in frist image explain senario and lisp result with wihte line at red poly line ,
Title: Re: REQ: from point draw line with preset length and angle
Post by: DEVITG on December 13, 2019, 07:13:03 AM
Please upload a sample.dwg
Title: Re: REQ: from point draw line with preset length and angle
Post by: BIGAL on December 13, 2019, 10:32:27 PM
This has been answered at cadtutor but poster did not like answer.
Title: Re: REQ: from point draw line with preset length and angle
Post by: MP on December 13, 2019, 11:19:02 PM
I am eager - as I believe all swampers are - to help people that have a genuine interest in learning.
Title: Re: REQ: from point draw line with preset length and angle
Post by: HasanCAD on December 14, 2019, 02:56:59 AM
This is a good start
Code - Auto/Visual Lisp: [Select]
  1. (defun c:LLA ()
  2.   (while
  3.     (setq p1 (getpoint "\nSelect Start point: "))
  4.     (if (null ang) (setq ang 1.) (setq ang (* 180.0 (/ ang pi))))
  5.     (initget 1)
  6.     (if (setq angt (getreal (strcat "\nWhat is Line Angle? <" (rtos ang) ">: "))) (setq ang angt))    
  7.     (setq ang (* pi (/ ang 180.0)))
  8.     (if (null lng) (setq lng 1.))
  9.     (initget 1)
  10.     (if (setq lngt (getreal (strcat "\nWhat is Line Length? <" (rtos lng) ">: "))) (setq lng lngt))
  11.     (setq p2 (polar p1 ang lng))
  12.     (vl-cmdf "_.LINE" p1 p2 "")
  13.     )
  14.   )
Title: Re: REQ: from point draw line with preset length and angle
Post by: abdulellah on December 14, 2019, 12:20:59 PM
Thanks to everyone who generously helps jealousy even the word, of course I don’t forget begal help for me