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

problem with the lisp bomlenghts

  • Thread starter Thread starter dl1989
  • Start date Start date

dl1989

Guest
Good morning, this morning I open autocad, I carry out all the work, but at the time when I go to call the command bomlenghts - all - I select all the lines in order to calculate the total meters, I exit this writing:

- impossible to call (command) from * error* without first calling (*push-error-using-command*).
- it is recommended to convert (command) calls to (command-s).

But what does that mean? I turned around a bit on the internet x see to solve the problem, but nothing... is there anyone who could help me? is a command that serves a lot x the work I do...thanks to everyone and soon
 
Good morning, this morning I open autocad, I carry out all the work, but at the time when I go to call the command bomlenghts - all - I select all the lines in order to calculate the total meters, I exit this writing:

- impossible to call (command) from * error* without first calling (*push-error-using-command*).
- it is recommended to convert (command) calls to (command-s).

But what does that mean? I turned around a bit on the internet x see to solve the problem, but nothing... is there anyone who could help me? is a command that serves a lot x the work I do...thanks to everyone and soon
from one of the latest versions of autocad (it seems to me 2013) it is no longer possible to recall a function (command) within a routine that manages the error of an autolisp program.
In your case, when the * error* routine is recalled (because the main program you use generated an error) you get the error message you mention.

try to replace, within the * error* function (recognize it because it starts like this:
Code:
"(defun *error*"
), at every word "command" the word "command-s"... should work. . assuming that you have a single .lsp file that contains all the code.
 
the word * error* that I find within the .lisp file with what should I replace it?
a command I added the -s but cmq nn works me more extension. . .
 
the word * error* that I find within the .lisp file with what should I replace it?
a command I added the -s but cmq nn works me more extension. . .
* error* must not be changed!
What does "n" mean to me more? ?
 
I have modified within the file the command word with command-s, I have uploaded the new extension to autocad, I call the command bomlenghts, I write to x count any type of "article"(lines, polylines etc), click I send and exit this writing:
lengths:
command:
That's it. the writing of the error before does not come out anymore, but now it is as if the command no longer works...
 
I have modified within the file the command word with command-s, I have uploaded the new extension to autocad, I call the command bomlenghts, I write to x count any type of "article"(lines, polylines etc), click I send and exit this writing:
lengths:
command:
That's it. the writing of the error before does not come out anymore, but now it is as if the command no longer works...
the replacement of the "command" in "command-s" was done only within the * error* function.

the function begins with "(defun * error*" and ends when you meet the closed bracket that balances the open bracket placed before "defun".
If you want to attach the code or, if there are reasons of confidentiality, send it to me in private and try to understand what happened.
 
;;;---------------------------------------------------------------------------;
;;;
;;; bomlengths.lsp
;;;
;;; by jimmy bergmark
;;; copyright (c) 1997-2007 jtb world, all rights reserved
;;; website: www.jtbworld.com;;; e-mail: info@jtbworld.com
;;;
;;; 1998-03-31 - first release
;;; 2000-05-11 - fixed for lwpolylines and for a2k
;;; 2003-06-10 - tested on 2004 and fixed a minor bug
;;; 2004-03-18 - added (vl-load-com)
;;; 2007-09-24 - shows the result in the active unit
;;; tested on autocad 2000, 2004, 2005, 2008
;;; should be working on older versions too with minor modifications.
;;; exchange bom-code-old with bom-code
;;;
;;;---------------------------------------------------------------------------;
;;; description
;;;
;;; bill of lengths. get the accumulated sum length of multiple objects.
;;; c:bomlengths - length of lines, arcs, polylines and splines and total.
;;; c:bom_lines - length of lines and total.
;;; c:bom_arcs - length of arcs, and total.
;;; c:bom_polylines - length of polylines and total.
;;; c:bom_splines - length of splines and total.
;;;---------------------------------------------------------------------------;

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

(defun bom-code (ssfilter / errexit undox restore
*error* olderr oldcmdecho %l %t
sset %i en ed p1 p2
ot a1 a2 r
)
(defun errexit (s)
(princ)
(restore)
)

(defun undox ()
(command "._undo" "_e")
(setvar "cmdecho" oldcmdecho)
(setq *error* olderr)
(princ)
)

(setq olderr *error*
restore undox
*error* errexit
)
(setq oldcmdecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command "._undo" "_be")
(setq %i 0
%t 0
)
(vl-load-com)
(setq sset (ssget ssfilter))
(if sset
(progn
(princ "\nlengths:")
(repeat (sslength sset)
(setq en (ssname sset %i))
(setq ed (entget en))
(setq ot (dxf 0 ed))
(setq curve (vlax-ename->vla-object en))
(if (vl-catch-all-error-p
(setq len (vl-catch-all-apply
'vlax-curve-getdistatparam
(list curve
(vl-catch-all-apply
'vlax-curve-getendparam
(list curve)
)
)
)
)
)
nil
len
)
(setq %l len)

(setq %i (1+ %i)
%t (+ %l %t)
)
(terpri)
;(princ %l )
(princ (rtos %l (getvar "lunits")(getvar "luprec")))
)
(princ "\ntotal = ")
;(princ %t)
(princ (rtos %t (getvar "lunits")(getvar "luprec")))
(textpage)
)
)
(restore)
)

(defun bom-code-old (ssfilter / errexit undox restore
*error* olderr oldcmdecho %l %t
sset %i en ed p1 p2
ot a1 a2 r
)
(defun errexit (s)
(princ)
(restore)
)

(defun undox ()
(command "._undo" "_e")
(setvar "cmdecho" oldcmdecho)
(setq *error* olderr)
(princ)
)

(setq olderr *error*
restore undox
*error* errexit
)
(setq oldcmdecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command "._undo" "_be")
(setq %i 0
%t 0
)
(setq sset (ssget ssfilter))
(if sset
(progn
(princ "\nlengths:")
(repeat (sslength sset)
(setq en (ssname sset %i))
(setq ed (entget en))
(setq ot (dxf 0 ed))
(cond
((= ot "line")
(setq p1 (dxf 10 ed)
p2 (dxf 11 ed)
%l (distance p1 p2)
)
)
((= ot "arc")
(setq a1 (dxf 50 ed)
a2 (dxf 51 ed)
r (dxf 40 ed)
%l (* r (abs (- a2 a1)))
)
)
(t
(command "._area" "_obj" en)
(setq %l (getvar "perimeter"))

)
)
(setq %i (1+ %i)
%t (+ %l %t)
)
(terpri)
(princ %l)
)
(princ "\ntotal = ")
(princ %t)
(textpage)
)
)
(restore)
)

(defun c:bomlengths ()
(initget "lines arcs polylines splines all")
(setq ans (getkword
"enter an option [Lines/Arcs/Polylines/Splines] <all>: "
)
)
(cond
((= ans "lines") (c:bom_lines))
((= ans "arcs") (c:bom_arcs))
((= ans "polylines") (c:bom_polylines))
((= ans "splines") (c:bom_splines))
(t
(bom-code '((-4 . "<or") "arc")="" "line")="" "lwpolyline")="" "or="" "polyline")="" "spline")="" (-4="" (0="" .="">")
)
)
)
)
(princ)
)

(defun c:bom_lines ()
(bom-code '((0 . "line")))
(princ)
)

(defun c:bom_arcs ()
(bom-code '((0 . "arc")))
(princ)
)

(defun c:bom_polylines ()
(bom-code '((-4 . "<or") "lwpolyline")="" "or="" "polyline")="" (-4="" (0="" .="">")
)
)
(princ)
)

(defun c:bom_splines ()
(bom-code '((0 . "spline")))
(princ)
)</or")></or")></all>
 
This is the original code...maybe if you can send me the code already modified you would do me a huge favor...thanks a thousand
 
This is the original code...maybe if you can send me the code already modified you would do me a huge favor...thanks a thousand
I only entered a command-s. for the rest the program works ok.
you have to understand what there is of anomalous in your design, when you select objects, which interrupts the command by causing error.. .
 

Attachments

Unfortunately nothing... now I'm only written
lengths:
I try to uninstall everything and install it back to my point
 
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