• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

lisp loading error in autocad 2015

vbrestolli

Guest
I don't understand why some lisp in autocad 2015 don't work anymore, such as vp-outline
that creates a polyline in modelspace that has the contour of the selected window.
After launching the lisp and selecting the window object, this message appears to me:

select objects:
; error: no function definition: vlax-ename->vla-object

Can someone tell me how to solve the problem?
Thank you.
 
grazie per la tua tempestiva risposta.
ho provato a fare come tu mi dici ma purtroppo ottengo sempre lo stesso errore
se mi puoi dare un'occhiata e vedere se c'e' qualche errore questo e' il file lisp;
;;; vp-outline.lsp
;;;
;;; creates a polyline in modelspace that
;;; has the outline of the selected viewport.
;;; supports clipped viewports. polyline is supported
;;; ellipse, spline, region and circle not supported at this point
;;; if vp-outline is called when in mspace it detects
;;; the active viewport.
;;;
;;; c:vp-outline
;;;
;;; by jimmy bergmark
;;; copyright (c) 1997-2013 jtb world, all rights reserved
;;; website: www.jtbworld.com;;; e-mail: [email protected]
;;;
;;; 2000-04-10
;;; 2003-11-19 added support for drawing the outline in other ucs/view than world/current
;;;
;;; 2006-04-06 added support for twisted views tom beauford
;;; 2013-06-08 added support for circular viewports
;;;
;;; should work on autocad 2000 and newer
(vl-load-com)

(defun dxf (n ed) (cdr (assoc n ed)))

(defun ax:list->variantarray (lst)
(vlax-make-variant
(vlax-safearray-fill
(vlax-make-safearray
vlax-vbdouble
(cons 0 (- (length lst) 1))
)
lst
)
)
)

(defun c:vp-outline (/ ad ss ent pl plist xy n vpbl vpur msbl msur ven vpno ok
circ)
(setq ad (vla-get-activedocument (vlax-get-acad-object)))
(if (= (getvar "tilemode") 0)
(progn
(if (= (getvar "cvport") 1)
(progn
(if (setq ss (ssget ":e:s" '((0 . "viewport"))))
(progn (setq ent (ssname ss 0))
(setq vpno (dxf 69 (entget ent)))
(vla-display (vlax-ename->vla-object ent) :vlax-true)
(vla-put-mspace ad :vlax-true) ; equal (command "._mspace")
; this to ensure trans later is working on correct viewport
(setvar "cvport" vpno)
; (vla-put-mspace ad :vlax-false) ; equal (command "._pspace")
(setq ok t)
(setq ss nil)
)
)
)
(setq ent (vlax-vla-object->ename (vla-get-activepviewport ad))
ok t
)
)
(if ok
(progn (setq circle nil)
(setq ven (vlax-ename->vla-object ent))
(if (/= 1 (logand 1 (dxf 90 (entget ent)))) ; detect perspective
(progn (if (= (vla-get-clipped ven) :vlax-false)
(progn ; not clipped
(vla-getboundingbox ven 'vpbl 'vpur)
(setq vpbl (trans (vlax-safearray->list vpbl) 3 2)
msbl (trans vpbl 2 1)
msbl (trans msbl 1 0)
vpur (trans (vlax-safearray->list vpur) 3 2)
msur (trans vpur 2 1)
msur (trans msur 1 0)
vpbr (list (car vpur) (cadr vpbl) 0)
msbr (trans vpbr 2 1)
msbr (trans msbr 1 0)
vpul (list (car vpbl) (cadr vpur) 0)
msul (trans vpul 2 1)
msul (trans msul 1 0)
plist (list (car msbl)
(cadr msbl)
(car msbr)
(cadr msbr)
(car msur)
(cadr msur)
(car msul)
(cadr msul)
)
)
)
(progn ; clipped
(setq pl (entget (dxf 340 (entget ent))))
(if (= (dxf 0 pl) "circle")
(setq circle t)
(progn (setq plist (vla-get-coordinates
(vlax-ename->vla-object (dxf -1 pl))
)
plist (vlax-safearray->list (vlax-variant-value plist))
n 0
pl nil
)
(repeat (/ (length plist) 2)
(setq xy (trans (list (nth n plist) (nth (1+ n) plist)) 3 2)
xy (trans xy 2 1)
xy (trans xy 1 0)
pl (cons (car xy) pl)
pl (cons (cadr xy) pl)
n (+ n 2)
)
)
(setq plist (reverse pl))
)
)
)
)
(if circle
(vla-addcircle
(vla-get-modelspace ad)
(ax:list->variantarray
(trans (trans (trans (dxf 10 pl) 1 0) 2 1) 3 2)
)
(/ (dxf 40 pl) (caddr (trans '(0 0 1) 2 3)))
)
(vla-put-closed
(vla-addlightweightpolyline
(vla-get-modelspace ad)
(ax:list->variantarray plist)
)
:vlax-true
)
)
)
)
)
)
)
)
(if ss
(vla-put-mspace ad :vlax-false)
) ; equal (command "._pspace"))
(princ)
)
(vl-load-com)
 
In fact, now that I saw the code, that instruction was already present at the beginning.
I don't know how to help you, to me on 2015 the lisp works. :confused:

You're not using mac now?
 
I realized that actually this lisp on other computers works regularly
I don't know what happened on mine.
maybe some bad set variable but I don't know which one.
The strange thing is that the same mistake gives me on some lisp, others instead fuzionano fine.
again thanks for the interest
 
Last edited by a moderator:

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top