Sequencial numbering

JasonLLINDNER
Advocate
Advocate

Sequencial numbering

JasonLLINDNER
Advocate
Advocate

Hi

 

I have this LISP which I'm using for sequential numbering and it runs perfectly ok in AutoCAD Architecture 2016 English ... The problem is when I run it on a different language pack of AutoCAD Architecture 2016 (German and French) ... any ideas how to fix this and get it to run on other LP of ACAD

 

File attached

 

PS: Previously posted this on ACA Forum and it was recommended to post question here 🙂

 

 

(defun C:arn ()

    (setq a (getstring  T " Enter prefix if any - "))(terpri)
    (setq b (getreal " Starting at number - "))(terpri)
    (setq h(getvar "textsize"))
    (setq c "W")

    (while c
        (setq c (getpoint "position of number -"))(terpri)
        (setq d (rtos b 2 0 ))
        (setq st (strcat a d ))
        (command "_text" "_m" c h "" st )
            (setq b (+ b 1)) )
    )
0 Likes
Reply
Accepted solutions (2)
1,471 Views
10 Replies
Replies (10)

BeKirra
Advisor
Advisor

What if placing a dot at front of _text? ( i.e. (command "._text" ...

 

HTH

Please mark "Accept as Solution" and "Like" if my reply resolves the issue and it will help when others need helps.
= ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ =
A circle is the locus of a cursor, starting and ending at the same point on a plane in model space or in layout such that its distance from a given coordinates (X,Y) is always constant.
X² + Y² = C²

JasonLLINDNER
Advocate
Advocate

Same ... with or without dot the German and French LP seem to be Messing up with the translation

0 Likes

BeKirra
Advisor
Advisor

Can you tell if there is any error message?

Please mark "Accept as Solution" and "Like" if my reply resolves the issue and it will help when others need helps.
= ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ = ♪ = ♫ =
A circle is the locus of a cursor, starting and ending at the same point on a plane in model space or in layout such that its distance from a given coordinates (X,Y) is always constant.
X² + Y² = C²
0 Likes

JasonLLINDNER
Advocate
Advocate

Unbenannt1.PNG

 

Would this help?

 

it adds a Rotation angle 2 degrees instead of getting Default

then assumes text as a command (unknown Command/Befehl)

0 Likes

braudpat
Mentor
Mentor

 

Hello

 

Welcome to the Autodesk / AutoCAD Forums

 

1) Your routine "ARN" is OK on a French ACAD !

 

2) Please check (before running) that your current text style has a Height = ZERO

 

3) Because the routine FAILS if there is a fixed (NON-ZERO) height !

 

Regards, Patrice

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


pbejse
Mentor
Mentor

@JasonLLINDNER wrote:

...any ideas how to fix this and get it to run on other LP of ACAD

 


Any error message? or it just doesn't do anything?

 

EDIT: Too late Smiley Very Happy

0 Likes

JasonLLINDNER
Advocate
Advocate

@braudpat

 

I am changing the routines for each LP that was just the one I am using in German... Issue starts with the Drehwink/Angle. Confused cuz it runs perfectly on English (testing in a new blank Default template drawing with all values reseted)

 

@pbejse

 

Just the screenshot i pasted above...nothing gets added to the drawing

0 Likes

ВeekeeCZ
Consultant
Consultant
Accepted solution

I think @braudpat is right. This this code that should fix this.

 

(defun C:arn ( / a b h c st )
  
  (setq a (getstring  T "\nEnter prefix <none>: ")
        b (cond ((getreal "\nStarting at number <1>: "))
                (1))
        h (getvar 'TEXTSIZE))
  
  (while (setq c (getpoint "\nPosition of number <done>: "))
    (setq st (strcat a (rtos b 2 0 ))
          b (1+ b))
    (command "_.TEXT" "_M" c)
    (if (= 0 (cdr (assoc 40 (tblsearch "STYLE" (getvar 'TEXTSTYLE)))))
      (command h))
    (command "" st))
  (princ)
)

 

Edited. Last at :55.

pbejse
Mentor
Mentor

@ВeekeeCZ wrote:

I think @braudpat is right. This this code that should fix this.

 

    ....
(command "_.TEXT" "_M" c) (if (= 0 (cdr (assoc 40 (tblsearch "STYLE" (getvar 'TEXTSTYLE))))) (command h)) (command "" st))
...

 


 

Same here, text style issues.

 

@ВeekeeCZ 

 

While you're at it, do away with command and use ENTMAKEX to completely avoid issues with the different language packs.

0 Likes

ВeekeeCZ
Consultant
Consultant
Accepted solution

pbejse wrote:

 

Same here, text style issues.

@BeekeeCZ

While you're at it, do away with command and use ENTMAKEX to completely avoid issues with the different language packs.


Sure, it's definitely way to improve the code, little more advanced but independent of the autocad version...

 

@JasonLLINDNER

Some other improvements added as well.. you to learn from 🙂

 

(defun c:ARN ( / tmp)

  (or *arn-a*
      (setq *arn-a* ""))
  (or *arn-b*
      (setq *arn-b* 1))
  
  
  (setq tmp (getstring T (strcat "\nEnter prefix <" (if (= *arn-a* "") "none" *arn-a*) ">: "))
        *arn-a* (if (= tmp "")
                  *arn-a*
                  tmp)
        *arn-b* (cond ((getint (strcat "\nStart number <" (itoa *arn-b*) ">: ")))
                      (*arn-b*)))
  
  (while (setq c (getpoint (strcat "\nPlace text '" (strcat *arn-a* (itoa *arn-b*)) "' <done>: ")))
    (entmake (list (cons  00 "TEXT")
                   (cons  10 (trans c 1 0))
                   (cons  11 (trans c 1 0)) 			; must be same as 10, would adjusted automatically
                   (cons  40 (getvar 'TEXTSIZE))
                   (cons  50 (angle '(0 0 0) (getvar 'UCSXDIR)))
                   (cons  01 (strcat *arn-a* (itoa *arn-b*)))
                   (cons  72 4)
                   (cons  73 0)
                   ))
    (setq *arn-b* (1+ *arn-b*)))
  (princ)
)