Svg to dxf convert problem from commandline

General discussions about Inkscape.
unalilker
Posts: 5
Joined: Wed Sep 13, 2017 8:03 am

Svg to dxf convert problem from commandline

Postby unalilker » Wed Sep 13, 2017 8:19 am

Hello,

I am trying to convert a svg file to dxf format form cli. Conversations were successful but my when i try to open them in Inkscape GUI or Dwg TrueView, i got blank screen from inkscape gui and error from Dwg TrueView saying that

Code: Select all

Error in drawing header on line 1.
C:\toolbox.dxf is not valid DXF file
Invalid or incomplete DXF input -- drawing discarded.


My first and second line in dxf file converted from cli is below

Code: Select all

%!PS-Adobe-3.0 EPSF-3.0
%%Creator: cairo 1.15.6 (http://cairographics.org)


If i use Inkscape gui for dxf conversion (Save as dxf), no problems. I can open converted files in GUI and Dwg Trueview but if i use cli i got errors.

Cli commands used.

Code: Select all

inkscape -E c:\test.dxf c:\test.svg


and i also install pstoedit and try command

Code: Select all

pstoedit -dt -f dxf:-polyaslines c:\test.svg c:\test.dxf


Can somebody please help :?

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Svg to dxf convert problem from commandline

Postby Moini » Wed Sep 13, 2017 11:08 pm

-E exports to eps, not to dxf. Did you want to save as eps? Inkscape doesn't care about the file extension, it only cares about the parameters it's being given.

As for the second command, can you explain the parameters?
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

unalilker
Posts: 5
Joined: Wed Sep 13, 2017 8:03 am

Re: Svg to dxf convert problem from commandline

Postby unalilker » Thu Sep 14, 2017 12:02 am

i want to save svg as dxf, which parameter can i use instead of -E?

unalilker
Posts: 5
Joined: Wed Sep 13, 2017 8:03 am

Re: Svg to dxf convert problem from commandline

Postby unalilker » Thu Sep 14, 2017 12:09 am

Can you please give me an example of how can i convert a svg file dxf file from command line. And one more thing when i use this command, a window popup (DXF Input). How can i prevent it, i want to use this command from a .net programme

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Svg to dxf convert problem from commandline

Postby Moini » Thu Sep 14, 2017 1:46 am

There isn't a direct command line parameter for that which doesn't require you to click around in the GUI (i.e. in the save as dialog) currently, unless you're on Linux, or can run bash scripts on your Windows machine, as far as I know, then you can (possibly, untested) dxf_output extension.

But doesn't this work:
- export to eps from Inkscape
- convert eps to dxf with pstoedit

The hint is: do this after one another. Not on the same file, but on the result of the previous operation.

Inkscape exports to eps.
pstoedit converts from (e)ps.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

unalilker
Posts: 5
Joined: Wed Sep 13, 2017 8:03 am

Re: Svg to dxf convert problem from commandline

Postby unalilker » Thu Sep 14, 2017 6:30 am

Thank you for your reply. I'll tried your suggestions and got results below.

Code: Select all

inkscape -E c:\toolbox.eps c:\toolbox.bmp

and command successfully created the eps file.

After that i tried

Code: Select all

pstoedit -f dxf:-polyaslines c:\toolbox.eps c:\toolbox.dxf


Result:

Code: Select all

pstoedit: version 3.70 / DLL interface 108 (built: Jan  1 2015 - release build - MS VC++ 1600 - 64-bit) : Copyright (C) 1993 - 2014 Wolfgang Glunz
running-win command line: gswin32c -q -dDELAYBIND -dWRITESYSTEMDICT -dNODISPLAY -dNOEPS C:/Users/User/AppData/Local/Temp/psin9
Interpreter failure: -1
running-win command line: gswin32cgswin32c.exe -q -dDELAYBIND -dWRITESYSTEMDICT -dNODISPLAY -dNOEPS C:/Users/User/AppData/Local/Temp/psin9
Interpreter failure: -1
PostScript/PDF Interpreter finished. Return status -1 executed command : gswin32c -q -dDELAYBIND -dWRITESYSTEMDICT -dNODISPLAY -dNOEPS C:/Users/User/AppData/Local/Temp/psin9
The interpreter seems to have failed, cannot proceed !


after that i tried

Code: Select all

pstoedit -f dxf c:\toolbox.eps c:\toolbox.dxf


Result:

Code: Select all

pstoedit: version 3.70 / DLL interface 108 (built: Jan  1 2015 - release build - MS VC++ 1600 - 64-bit) : Copyright (C) 1993 - 2014 Wolfgang Glunz
running-win command line: gswin32c -q -dDELAYBIND -dWRITESYSTEMDICT -dNODISPLAY -dNOEPS C:/Users/User/AppData/Local/Temp/psin12
Interpreter failure: -1
running-win command line: gswin32cgswin32c.exe -q -dDELAYBIND -dWRITESYSTEMDICT -dNODISPLAY -dNOEPS C:/Users/User/AppData/Local/Temp/psin12
Interpreter failure: -1
PostScript/PDF Interpreter finished. Return status -1 executed command : gswin32c -q -dDELAYBIND -dWRITESYSTEMDICT -dNODISPLAY -dNOEPS C:/Users/User/AppData/Local/Temp/psin12
The interpreter seems to have failed, cannot proceed !


What is the problem about pstoedit? Why it couldnt accomplish this task, any idea ? I am using windows 10. Thank you!

unalilker
Posts: 5
Joined: Wed Sep 13, 2017 8:03 am

Re: Svg to dxf convert problem from commandline

Postby unalilker » Thu Sep 14, 2017 6:49 am

I search about gswin32c and find that its about ghostscript. I install it and now pstoedit convert eps file to dxf but one problem. Autocad and inkscape both can open the dxf file, but no drawing inside it. My dxf file content is below what can be wrong? Please help.

Code: Select all

pstoedit -f dxf c:\toolbox.eps c:\toolbox.dxf


Code: Select all

  0
SECTION
  2
HEADER
  9
$ACADVER
  1
AC1009
  9
$EXTMIN
 10
0.0
 20
0.0
 30
0.0
  9
$EXTMAX
 10
1000.0
 20
1000.0
 30
0.0
  9
$FILLMODE
 70
 0
  9
$SPLFRAME
 70
 1
  0
ENDSEC
  0
SECTION
  2
TABLES
  0
TABLE
  2
LAYER
 70
1
  0
LAYER
  2
0
 70
     0
 62
     7
  6
CONTINUOUS
  0
ENDTAB
  0
ENDSEC
  0
SECTION
  2
ENTITIES
  0
ENDSEC
  0
EOF

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Svg to dxf convert problem from commandline

Postby Moini » Fri Sep 15, 2017 8:40 am

Can you share an example eps file? Then someone can try to reproduce.
(I won't be able until some time next week)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)


Return to “General Discussions”