Edit annotative scale

Edit annotative scale

peter_pan_y_vino
Contributor Contributor
374 Views
4 Replies
Message 1 of 5

Edit annotative scale

peter_pan_y_vino
Contributor
Contributor

Hello people.

Is it possible to rename an annotative scale using lisp?.

Thank you.

0 Likes
Accepted solutions (1)
375 Views
4 Replies
Replies (4)
Message 2 of 5

Moshe-A
Mentor
Mentor
Accepted solution

@peter_pan_y_vino  hi,

 

check this function

 

enjoy

moshe

 

; return elist of the renamed annotation scale or nil if it fails
(defun rename_annoscale (oldsym newsym / isexist table)

 (defun isexist ()
  (vl-some
    (function
      (lambda (item)
       (and
         (= (car item) 350)
         (eq (strcase (cdr (assoc '300 (entget (cdr item))))) (strcase newsym))
       )
      ); lambda
    ); function
   table
  ); vl-some
 ); isexist


 (cond
  ((not (setq table (entget (cdadr (member '(3 . "ACAD_SCALELIST") (entget (namedobjdict))))))))
  ((isexist)
   (prompt (strcat "\nAnnotation scale " newsym " is already exist."))
  ); case
  ((vl-some
    (function
     (lambda (item / elist)
       (if (and
	     (= (car item) 350)
	     (setq elist (entget (cdr item)))
	     (eq (strcase (cdr (assoc '300 elist))) (strcase oldsym))
	   )
        (entmod (subst (cons '300 newsym) (assoc '300 elist) elist)) ; rename
       ); if
     ); lambda
    ); function
    table
   ); vl-some
  ); case
 ); cond
); rename_annoscale

 

Message 3 of 5

peter_pan_y_vino
Contributor
Contributor

Perfect, thank you very much.

0 Likes
Message 4 of 5

john.uhden
Mentor
Mentor

@Moshe-A 

You appear to have a good grasp on annotativity (?).

Got any clues on how to use entmake to create an annotative object (if it can be)?

Let's say we're confining our goal to use the current scale (1" = 10',  1" = 20',  etc.)

John F. Uhden

0 Likes
Message 5 of 5

Moshe-A
Mentor
Mentor

@john.uhden ,

 


@john.uhden wrote:

@Moshe-A 

You appear to have a good grasp on annotativity (?).

Got any clues on how to use entmake to create an annotative object (if it can be)?

Let's say we're confining our goal to use the current scale (1" = 10',  1" = 20',  etc.)


form where did you take that?!  i do not give my self that creadit 😀  but anyhow thank you very much.

 

to the matter...i doubt if you can do that with classic autolisp maybe with (vla-copy) ??? but as far as we know (vla-copy) does not do deep cloning. if (vla-copy) tries to add the new object to database then it may fail because of dublicate names??? do not know 🤣

 

Moshe

 

 

 

 

 

0 Likes