lisp program error

lisp program error

MKH-VB
Collaborator Collaborator
2,667 Views
9 Replies
Message 1 of 10

lisp program error

MKH-VB
Collaborator
Collaborator

got a simple lisp that i use quite a bit. Works fine in 2014, but get a "bad argument type" when trying to use in 2016.  I've attached incase someone is interested in trying to fix it. Thanks

 

 

mkh
0 Likes
Accepted solutions (1)
2,668 Views
9 Replies
Replies (9)
Message 2 of 10

hmsilva
Mentor
Mentor

@MKH-VB wrote:

got a simple lisp that i use quite a bit. Works fine in 2014, but get a "bad argument type" when trying to use in 2016.  I've attached incase someone is interested in trying to fix it. Thanks

 

 


Hi MKH-VB,

I don't have 2016 in this laptop, to test your code, but in 2015 it runs without an error.

If I'm not mistaken, in 2016 the QUIck snap mode, does not exist...

 

Try to change

(setq pt1 (osnap (cadr first) "qui,end")
         pt2 (osnap (cadr second) "qui,end")
   )

to

(setq pt1 (osnap (cadr first) "end")
         pt2 (osnap (cadr second) "end")
   )

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 3 of 10

Kent1Cooper
Consultant
Consultant

You might be interested in the routine I wrote partially in response to a shortcoming in that one, available here [see the first Comment about the shortcoming].  It also offers additional options for what to draw across the end, and has other benefits [for instance, it requires the ends to be parallel and aligned, whereas endpipe.lsp will let you pick ends that aren't, and will draw a skewed thingie].  Read the description there, and the commentary at the top of the file.

Kent Cooper, AIA
Message 4 of 10

MKH-VB
Collaborator
Collaborator
Henrique....
I removed the qui and then the program output changes. It tries to draw the arcs, but they are not drawn correctly. thanks for the reply.
mkh
0 Likes
Message 5 of 10

hmsilva
Mentor
Mentor
Accepted solution

Hi mkh,

and like this, it works as expected?

 

(defun c:endpipe (/ plwid first second pt1 pt2 ang dis pt3 layr entl)
 (setq olderr *error* *error* pipe_err)
 (setq plwid (getvar"plinewid"))
 (setvar"plinewid" 0)
 (while (not
  (setq first (entsel "\nPick first endpoint: ")))
  (prompt "\nNo endpoint found. ")
 )
 (while (not
  (setq second (entsel "\nPick second endpoint: ")))
  (prompt "\nNo endpoint found. ")
 )
 (if second
  (progn
   (setq pt1 (osnap (cadr first) "end")
         pt2 (osnap (cadr second) "end")
   )
   (setq ang (angle pt1 pt2)
         dis (distance pt1 pt2)
         pt3 (polar pt1 ang (/ dis 2.0))
   )
   (command "pline" "_NON" pt1 "arc" "a" "100" "_NON" pt3 "_NON" pt2 "a" "-100" "_NON" pt3 ""))
  )
  (setq layr (cdr (assoc 8 (entget (car first)))) 
        entl (entget (entlast))
  )
  (setq entl (subst (cons 8 layr)(assoc 8 entl) entl))
  (entmod entl)
  (setvar "plinewid" plwid)
  (setq *error* olderr)
 (princ)
)


(defun pipe_err (s)                    
 (if (/= s "Function cancelled")
  (princ (strcat "\nError: "s))
 )
 (setvar"plinewid" plwid)
 (if olderr (setq *error* olderr))
 (princ)
) 

 

Hope this helps,
Henrique

EESignature

Message 6 of 10

MKH-VB
Collaborator
Collaborator
yes, thank you so much!
mkh
0 Likes
Message 7 of 10

hmsilva
Mentor
Mentor

@MKH-VB wrote:
yes, thank you so much!

You're welcome, mkh!
Glad I could help

Henrique

EESignature

0 Likes
Message 8 of 10

Kent1Cooper
Consultant
Consultant

@Kent1Cooper wrote:

.... the routine I wrote partially in response to a shortcoming in that one, available here [see the first Comment about the shortcoming].  It also offers additional options for what to draw across the end, and has other benefits [for instance, it requires the ends to be parallel and aligned, whereas endpipe.lsp will let you pick ends that aren't, and will draw a skewed thingie].  ....


Some of the kinds of inappropriate results that endpipe can give you ["facing" the wrong way, accepting non-aligned or non-parallel objects], that the Pipe option in CapEnd.lsp [in the link] was designed to prevent:

EndPipe.png

Kent Cooper, AIA
0 Likes
Message 9 of 10

MKH-VB
Collaborator
Collaborator
Kent....
I tried yours this morning. It is great! Thanks for the tip.
MKH
mkh
0 Likes
Message 10 of 10

_Tharwat
Advisor
Advisor

Hi,

 

A bit late to the party, try this old program of mine FROM HERE

0 Likes