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

Script file to retrieve text and use it to name a layer

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
808 Views, 2 Replies

Script file to retrieve text and use it to name a layer

Hi

I am importing a dxf file that has text contained in it on layer “X” (there is nothing else on this layer). I want to retrieve the text to use it to rename another layer.

 

How do I replace "XLYP1H18" with the text contained on layer “X”?

 

Script below…

 

-LAYER

RENAME

"Workpiece Size"

"XLYP1H18"

 

Any help appreciated

Thanks

M

2 REPLIES 2
Message 2 of 3
ВeekeeCZ
in reply to: Anonymous

With a LISP.

 

(defun c:GetXContent ()
  (if (ssget "_X" '((0 . "TEXT") (8 . "X")))
    (cdr (assoc 1 (entget (ssname (ssget "_X" '((0 . "TEXT") (8 . "X"))) 0))))))
Message 3 of 3
Anonymous
in reply to: ВeekeeCZ

Sorry for late reply - it's been very busy.

Thanks for the code I will test it soon (I hope)

 

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