Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sequencial numbering

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
JasonLLINDNER
1455 Views, 10 Replies

Sequencial numbering

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)) )
    )
10 REPLIES 10
Message 2 of 11
BeKirra
in reply to: JasonLLINDNER

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²
Message 3 of 11
JasonLLINDNER
in reply to: BeKirra

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

Message 4 of 11
BeKirra
in reply to: JasonLLINDNER

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²
Message 5 of 11
JasonLLINDNER
in reply to: BeKirra

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)

Message 6 of 11
braudpat
in reply to: JasonLLINDNER

 

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


Message 7 of 11
pbejse
in reply to: JasonLLINDNER


@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

Message 8 of 11
JasonLLINDNER
in reply to: braudpat

@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

Message 9 of 11
ВeekeeCZ
in reply to: JasonLLINDNER

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.

Message 10 of 11
pbejse
in reply to: ВeekeeCZ


@В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.

Message 11 of 11
ВeekeeCZ
in reply to: pbejse


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)
)

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report