I'm having a problem with thie cadalyst lisp routine. When ran it, it allows me to select entities but then gives me the following error: ActiveX Server returned the error: unknown name: Length Any advice would be appreciated . . . Code: ;;CADALYST 04/04 Tip1939: LL.LSP Length of Linear Objects (c) 2004 Will DeLoach (vl-load-com) (defun c:ll (/ sset num llen) (vl-load-com) (setq sset (ssget '((0 . "LINE,LWPOLYLINE"))) num 0 llen 0 ) (if sset (progn (repeat (sslength sset) (setq llen (+ llen (vla-get-length (vlax-ename->vla-object (ssname sset num))) ) ) (setq num (1+ num)) ) (setq num (rtos num 2 0) llen (rtos llen 4) ) (alert (strcat num " line lengths = " llen)) ) ) ) Thanks in advance, Scott
Swu, I just made a .lsp called harry.lsp - with the code. Checked it out. Ran just fine in R2002. Bob
Thanks for your reply. I tried the code again, it works for me in paperspace, not in model space though. Any ideas? Land Desktop 3 on Map 2002, Win 2000
Good call, I was using a line in paperspace so it worked, pline doesn't work. Thanks for pointing that out.
Give this a try. I've modified it to work with 2002. Jeff (defun c:ll (/ sset num llen obj) (vl-load-com) (setq sset (ssget '((0 . "LINE,LWPOLYLINE"))) num 0 llen 0 version (atof (getvar "ACADVER") );; added for check purposes ) (if sset (progn (repeat (sslength sset) (setq obj (vlax-ename->vla-object (ssname sset num))) (setq llen (+ llen (if (or (= (vla-get-objectname obj) "AcDbLine") (>= version 16.0));;added check for version 2004+ (vla-get-length obj) (vlax-curve-getdistAtParam obj (vlax-curve-getEndParam obj));; added code for pre-2004 to work on plines ) ) ) (setq num (1+ num)) ) (setq num (itoa num);;modified for Integer llen (rtos llen);; modified to use current unit format & prec. ) (alert (strcat num " line lengths = " llen)) ) ) (princ);added for quiet exit ) -- For additional help, try out www.cadvault.com remove USES from email address to reply work. Thanks for pointing that out.