Multiple DXF Import

Multiple DXF Import

prajputZ23VK
Contributor Contributor
294 Views
3 Replies
Message 1 of 4

Multiple DXF Import

prajputZ23VK
Contributor
Contributor

Hello,

 

I am using below lisp code to import multiple DXF files into my drawing. But the issue is when I import all the DXF files, those gets overlapped. Is there any possibility to move the each DXF files in horizontal direction during import, so that they don’t overlap?

 

(defun c:PR (/ directory files)

 (setq directory "C:\\Temp\\Automation")

 (if (setq files (vl-directory-files directory "*.dxf" 1))

   (foreach dxf files

     (command "_.-insert"

              (strcat directory "\\" dxf)

              '(0. 0. 0.)

              ""

              ""

              ""

     )

   )

   (princ "\n No DXF files found into that folder !")

 )

 (princ)

)

 

Thanks in advance for help.

0 Likes
Accepted solutions (1)
295 Views
3 Replies
Replies (3)
Message 2 of 4

hak_vz
Advisor
Advisor
Accepted solution
(defun c:PR (/ directory files)
 (setq origin '(-1000  0 0) step '(1000 0 0))
 (setq directory "C:\\Temp\\Automation")
 (if (setq files (vl-directory-files directory "*.dxf" 1))
   (foreach dxf files
     (setq origin (mapcar '+ origin step))
     (command "_.-insert"
              (strcat directory "\\" dxf)
              origin
              ""
              ""
              ""
     )
   )
   (princ "\n No DXF files found into that folder !")
 )
 (princ)
)

 

Each next origin for a block insert is translated 1000 in x direction starting from '(0 0 0).

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 3 of 4

maratovich
Advisor
Advisor

Maybe this will help you - AutoImportCAD 

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
0 Likes
Message 4 of 4

prajputZ23VK
Contributor
Contributor

Hello hak_vz, 

 

Thank you for your quick help. Your code helped me achieving what I was looking for.

 

Thanks again.

 

Regards,
PR