get text and dimensions lisp routine in not working in BricsCAD

Hi
I have a Lisp routine for AutoCAD but this routine is not working in BricsCAD.
In this routine select all dimension and then select all text it will give us all cumulative values as a text.
Thanks,
Avinash
Comments
-
My attempt.
(defun c:gettext (/ sset sum typ val)
(prompt "\nSelect all dimensions and all corresponding texts...")
(setq sset (ssget '((0 . "dimension,*text"))))(if (= sset nil)
(progn (alert "No text or dims found \nwill now exit"))
)(setq sum 0)
(repeat (setq x (sslength sset))
(setq ent (entget (ssname sset (setq x (1- x)))))
(setq typ (cdr (assoc 0 ent)))
(if (or (= typ "TEXT")(= typ "MTEXT"))
(setq val (atof (cdr (assoc 1 ent))))
(setq val (atof (cdr (assoc 1 ent))))
)
(setq sum (+ sum val))
)(alert (strcat "Total is " (rtos sum 2 2)))
(princ)
)0 -
Thanks for your reply,
I need cumulative dimensions as a text modification in down lined text
0 -
Hello.
In Autocad, the error is:
; error: too few argumentsBeside this, there are quite a few errors in the code.
The parentheses are not paired correctly, and some of them are doubled.
The variable successive_sum is also used as a function - a function that is not defined.
I attached a modified version that works.
I only corrected the errors mentioned above.
I am not sure about the logic - this needs to be checked further.0 -
Hi
Thanks for reply
you didn't get my routine I have attached CAD drawing. I need cumulative dimension as a text at the below.
In AutoCAD it works perfectly.
Avinash Patil
0 -
Hello.
I used the lisp attached in the first message, namely GetText.lsp.
I understood that the requirement is to calculate some sort of cumulative sum.
Unfortunately, in Autocad, that lisp script doesn't work at all.
I tested with Autocad 2025.In Autocad 2025, the error is:
; error: too few argumentsThere are a few reasons for which Autocad fails to run the script:
-- The parentheses are not paired correctly.
-- Some parentheses are doubled - see ((rtos)).
-- The cumulative sum function is missing.
Instead, the variable successive_sum is used as function - this won't work, even in Autocad.The solution would be to, first, correct the syntax.
You could use the script I posted as a start point.Then, you need to add the definition of the cumulative function.
You could use the example provided by ALANH.0 -
Hello.
Just to exemplify a summing function, I attached a new version of the script where I added a new function.
This new function is not present in the original script, I created it from scratch.
0 -
Thanks for your prompt reply, It works great
0