Insert several DXF with original coordinates

Insert several DXF with original coordinates

Egd4
Contributor Contributor
1,336 Views
7 Replies
Message 1 of 8

Insert several DXF with original coordinates

Egd4
Contributor
Contributor

Hi,

First, excuse my english, I'm french 🙂

I'm a total noob in autocad, but for work I have to import several DXF files into one DWG. I found a little script working, my dxf files are all merged into one dwg but original coordinates are lost.

 

(defun c:DXFIMPORTALL (/ directory files)
(setq directory "D:\\3D\\273_Port_Valais\\01_ENTREES\\SWISS_BUILDINGS")
(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)
)

 

I don't know how to obtain the same result has with a CTRL+C / Paste to original coordinates.

 

Thanks in advance for help!

 

0 Likes
Accepted solutions (1)
1,337 Views
7 Replies
Replies (7)
Message 2 of 8

hmsilva
Mentor
Mentor

@Egd4 wrote:

Hi,

First, excuse my english, I'm french 🙂

I'm a total noob in autocad, but for work I have to import several DXF files into one DWG. I found a little script working, my dxf files are all merged into one dwg but original coordinates are lost.

 

(defun c:DXFIMPORTALL (/ directory files)
(setq directory "D:\\3D\\273_Port_Valais\\01_ENTREES\\SWISS_BUILDINGS")
(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)
)

 

I don't know how to obtain the same result has with a CTRL+C / Paste to original coordinates.

 

Thanks in advance for help!

 


@Egd4 

Try to change

(command "_.-insert" (strcat directory "\\" dxf) '(0. 0. 0.) """""")

to

(command "_.-insert" (strcat directory "\\" dxf) "_non" '(0. 0. 0.) """""")

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 3 of 8

Egd4
Contributor
Contributor

Thanks for the help!

Unfortunately, the result is the same.

For example, instead of having an original point such as

 

Egd4_0-1671620807022.png

it turns to

 

Egd4_1-1671620855776.png

 

0 Likes
Message 4 of 8

hmsilva
Mentor
Mentor

Diferent units...

_$ (/ 2551307.777 6.4803e+07)
0.0393702

 

1.00000 mm to in = 0.0393702

 

Objects are scaled when inserted into a drawing in AutoCAD products

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 5 of 8

Egd4
Contributor
Contributor

allriiiiiiiiiiiiiiiiiiiiiiiiiiiiiiight! You're a genius...(to me 😉)

Is there any solution to include the conversion (or not to convert) in my little lisp code?

0 Likes
Message 6 of 8

hmsilva
Mentor
Mentor
Accepted solution

@Egd4 wrote:

allriiiiiiiiiiiiiiiiiiiiiiiiiiiiiiight! You're a genius...(to me 😉)

Is there any solution to include the conversion (or not to convert) in my little lisp code?


From my previous post:

Objects are scaled when inserted into a drawing in AutoCAD products

"To deactivate automatic scaling of inserted objects:

  1. At the command prompt in AutoCAD, enter INSUNITS.
  2. Change the value to 0 (zero).
  3. Repeat this for INSUNITSDEFSOURCE and INSUNITSDEFTARGET."

Hope this helps,
Henrique

 

 

EESignature

0 Likes
Message 7 of 8

Egd4
Contributor
Contributor

You're a life savior! Thank you very much for your involvement!

Message 8 of 8

hmsilva
Mentor
Mentor

@Egd4 wrote:

You're a life savior! Thank you very much for your involvement!


You're welcome, @Egd4 
Glad I could help


Henrique

EESignature

0 Likes