Jump to content

Recommended Posts

Posted

Can any one help me to find this error of lisp used to draw wire. 

 

When i drag drop it in autocad give me error:(maleformed list in INPUT) 

 

Am upload file below 

wiredraw.lsp

Posted (edited)

Nearly there, a couple of small errors, see below. I added a couple of descriptions into the code, lined things up a little to make them easier for me to read if that is OK?

 

malformd list in input is where brackets don't match or line up right - you might have them all in, but not necessarily in the right places - simple internet search will tell you that i think - trick is working out where....

 

EDITTED THE CODE BELOW SLIGHTLY

 

;; Draw Electric Wire
(defun c:ew ( / ew_layer p1 p2 msg ) 
  (setq ew_layer "Wire") 

  (defun draw-ew ( p4 p1 lay / p2 p3 ) 
;;I'VE SPLIT THESE SETQ P2 and P3 into 2, TO MAKE YOUR DEBUGGING EASIER... THERE IS AN ERROR HERE
;;(polar pt ang dist)....
    (setq p2 (polar p1 (- (angle p1 p4) (/ pi ) 57.40259411) ))
    (setq p3 (polar p4 (+ (angle p4 p1) (/ pi ) 57.40259411) ))

;;YOU WANT SOMETHING LIKE THIS?
;;    (setq dist 5)
;;    (setq p2 (polar p1 (- (angle p1 p4) (/ pi 57.40259411)) dist ))
;;    (setq p3 (polar p4 (+ (angle p4 p1) (/ pi 57.40259411)) dist ))

    (entmakex 
      (list
        '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") 
        (cons 8 lay) (cons 90 4) '(70 . 0)
        (cons 10 p1) '(40 . 0.0) '(41 . 0.0) '(42 . 0.198912) 
        (cons 10 p2) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) 
        (cons 10 p3) '(40 . 0.0) '(41 . 0.0) '(42 . 0.198913) 
        (cons 10 p4) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) 
      ) ; end list
    )  ; end entmakex
  ) ; end defun

  (setq p1 (getpoint "\nPick start point (Draw clockwise"))
  (setq msg "\nPick next point clockwise.")
  (while (setq p2 (getpoint p1 msg))
    (draw-ew p1 p2 ew_layer)
    (setq p1 p2) 
  )

  (princ) 
)
(prompt "\nElectric Wire loaded, Enter EW to run.")

 

Edited by Steven P

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...