Importing named Layout in an AutoCAD DWG file using LISP

<?xml encoding=”UTF-8″>By Partha Sarkar

If you are
wondering how to import a named Layout into the current drawing file using LISP
in AutoCAD, here you go.

LISP code
snippet below, demonstrates how to import a layout named “ABC” from a
selected DWG file to the current drawing file.

(defun C:LayoutImport()<br><br>  ;; Select a DWG file to import a Layout<br>	(setq myFile (getfiled "Select your DWG File:" " " "dwg" 8)) <br>	<span>(command"layout" "t" myFile "ABC")</span> <br>	(alert "New Layout is inserted!") <br>	(princ) <br>)

 

After
executing the above LISP code, you would see a new Layout named “ABC” is
imported to the current DWG –

AutoCAD_LISP_Layout

 


Comments

4 responses to “Importing named Layout in an AutoCAD DWG file using LISP”

  1. imadhabash@hotmail.com Avatar
    imadhabash@hotmail.com

    Hi Partha,
    actually i have a very big project using the same floor design . in some cases i have to mirror the xref BUT the problem is that the text mirrored also. i try mirrtext command to solve the problem but nothing happened.
    is there is a way or Lisp to mirror Xref’s without mirroring text with it ?
    Thanks in advance,,
    Habash

  2. you can duplicate your texts, put them in two layers, one set of text will be backwards
    then, in the mirrored xref, you will turn on the layer with backwars texts
    this requires, that the texts are justified to center, otherwise, they will be moved, when changed to backwards (or you will have to reposition them, which might be a lot of work)

  3. Thank you very much i find this info.I’m very happy :)
    Thank you againg.King regards

  4. Thank you so much!
    I have send 3 days on trying to do this, so lucky to find out this page.

Leave a Reply to DwgCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading