Wings 3D Development Forum
[fixed] When Import any ps/eps file,Output error log. - Printable Version

+- Wings 3D Development Forum (https://www.wings3d.com/forum)
+-- Forum: Wings 3D (https://www.wings3d.com/forum/forumdisplay.php?fid=1)
+--- Forum: Bug Reports (https://www.wings3d.com/forum/forumdisplay.php?fid=12)
+--- Thread: [fixed] When Import any ps/eps file,Output error log. (/showthread.php?tid=2279)

Pages: 1 2 3


[fixed] When Import any ps/eps file,Output error log. - tkbd - 12-06-2016

I tried test by several Illustrator 8 EPS and Postscript files.
Apparently it seems to have failed to acquire the bounding box.
And the problem occurred even with very simple data.

This is simple EPS Test data,You can this copy and paste the data and to save named with "test.eps".
(This data simply draw a triangle.)
Code:
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 240 90
newpath 170 50 moveto 140 60 lineto 140 30 lineto 170 50 closepath stroke showpage
%%EOF


The error log is here.
Code:
wings_wm:821: Dropped Event autosaver: redraw
Using GPU shaders.
File Import Error Report:
{'EXIT',
     {function_clause,
         [{e3d_bv,box,[[]],[{file,"e3d_bv.erl"},{line,54}]},
          {e3d_vec,bounding_box,1,[{file,"e3d_vec.erl"},{line,304}]},
          {wpc_ps,try_import_ps,2,[{file,"wpc_ps.erl"},{line,86}]},
          {wpc_ps,make_ps,2,[{file,"wpc_ps.erl"},{line,66}]},
          {wpa,do_import,3,[{file,"wpa.erl"},{line,129}]},
          {wpa,'-import/3-fun-0-',3,[{file,"wpa.erl"},{line,118}]},
          {wings_file,'-import_filename_1/2-fun-0-',3,
              [{file,"wings_file.erl"},{line,67}]},
          {wings_develop,time_command,2,
              [{file,"wings_develop.erl"},{line,79}]},
          {wings_plugin,command,3,[{file,"wings_plugin.erl"},{line,139}]},
          {wings,raw_command_1,3,[{file,"wings.erl"},{line,624}]},
          {wings,raw_command,4,[{file,"wings.erl"},{line,621}]},
          {wings_wm,handle_event,3,[{file,"wings_wm.erl"},{line,952}]},
          {wings_wm,send_event,2,[{file,"wings_wm.erl"},{line,918}]},
          {wings_wm,do_dispatch,2,[{file,"wings_wm.erl"},{line,824}]},
          {wings_wm,dispatch_event,1,[{file,"wings_wm.erl"},{line,725}]},
          {wings_wm,get_and_dispatch,0,[{file,"wings_wm.erl"},{line,646}]},
          {wings,init,1,[{file,"wings.erl"},{line,147}]}]}}

I hope the EPS / PS format will be able to be read correctly by bug fix.

Wings3D 2.1.4.1
MacOSX 10.11.6


RE: When Import any ps/eps file,Output error log. - oort - 12-06-2016

tkbd,
Even in older versions of Wings3D, importing as ps/eps worked off and on depending on the application used to produce the ps/eps file. The file created by different applications is not always the same. That is why optigon added the .svg option. Here is a thread from the old forum on the subject... ps import

I would stick with svg if I were you. You could convert .ps files to .svg with Inkscape or The Gimp and see if that works.

P.S. The script for exporting .svg files that I had used in an older version of The Gimp no longer works in the newer version I have. Here is a link with information on how to export an svg path from The Gimp... Export SVG Path from The Gimp

oort


RE: When Import any ps/eps file,Output error log. - tkbd - 12-07-2016

oort,
Thank you for the advice and points to the thread.
I was able to save the GIMP path as SVG in the way you taught me with other threads (about the thread of SVG Path importer).
It was successfully imported to Wings 3D.
Surely it seems better to target SVG.

I often use AI rather than SVG.It still active. (AI importer can import only load AI8 format, but I love it).
This can be imported perfectly even if the file contains a square or/and a circle.
I curious that only AI importer works well(among ps ,eps and ai).

So,eps/ps importer's fix can be low priority unless urgent matter.

P.S.
I also didn't know that there is Wings2DShocked.
It is amazing software!.


RE: When Import any ps/eps file,Output error log. - micheus - 12-07-2016

(12-06-2016, 09:16 AM)tkbd Wrote: I tried test by several Illustrator 8 EPS and Postscript files.
Apparently it seems to have failed to acquire the bounding box.
And the problem occurred even with very simple data.

This is simple EPS Test data,You can this copy and paste the data and to save named with "test.eps".
(This data simply draw a triangle.)
Code:
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 240 90
newpath 170 50 moveto 140 60 lineto 140 30 lineto 170 50 closepath stroke showpage
%%EOF
Hi tkbd, I was taking a look on this to see if I'm able to do something about (still, not sure I can).

Checking the wpc_ps.erl code and some specifications I noticed two things related to your sample:
1) The %%BoundingBox tag is used for nothing by Wings3D. It calls internal bbox function after process the .ps file in order to get that information.

2) The %%Pages is absent in the sample file;
Specification:
"The file should be a single page image (in DSC terms, the %%Pages comment must have a value of 0 or 1)."
Wings3D code note for after_end_setup_ps/1:
% skip until after %%Page: 1 1 line, as we currently use nothing before that,
% then convert rest of binary to list of characters

as it's never found, that results in a null list ([]) which is the initial reason for the crash.

So, it seems like the exporter ins't creating a proper .ps file.

Anyway, maybe we need a better feedback to the user, instead of a single crash.


RE: When Import any ps/eps file,Output error log. - tkbd - 12-08-2016

Thank you.
I see,that information will be of great help.
It need to find a pattern of discription that can be imported somehow.
If there is one file that can be read normally, probably it will be easier to test and reserch.

I found some links for EPS/PS.
Reference or tutorial for EPS file
https://web.archive.org/web/20160528181353/http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf

Red Book (PDF 7.6M) PostScript Language Reference Manual,
https://web.archive.org/web/20160323070214/http://partners.adobe.com/public/developer/en/ps/PLRM.pdf
http://paulbourke.net/dataformats/postscript/
https://en.wikibooks.org/wiki/PostScript_FAQ


RE: When Import any ps/eps file,Output error log. - micheus - 12-08-2016

(12-07-2016, 04:50 PM)micheus Wrote: So, it seems like the exporter ins't creating a proper .ps file.
When I wrote this I was not talking about Wings3D's exporter, but the one you used to create that sample file.


RE: When Import any ps/eps file,Output error log. - tkbd - 12-09-2016

I'm sorry,I misinterpreted that...


RE: When Import any ps/eps file,Output error log. - micheus - 12-09-2016

No problem. I didn't mention where the "%%Pages' tag was missing (item 2, text fixed).

If you have a file with respect the Adoble specification and that Wings3D fail to read it I can try to take a look on that. Otherwise, I'm going only add some better message to the user and avoid the crash.


RE: When Import any ps/eps file,Output error log. - micheus - 12-13-2016

(12-06-2016, 09:16 AM)tkbd Wrote: This is simple EPS Test data,You can this copy and paste the data and to save named with "test.eps".
(This data simply draw a triangle.)
Quote:%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 240 90
newpath 170 50 moveto 140 60 lineto 140 30 lineto 170 50 closepath stroke showpage
%%EOF
tkbd, besides the Page token absent, there is some extra data (in red).

The file fixed works fine:
Quote:%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 240 90
%%Page: 1 1
newpath 170 50 moveto 140 60 lineto 140 30 lineto closepath stroke showpage
%%EOF

If you have any other file correctly defined (valid tokens) and it isn't load, please share it so I can check the plugin again.


RE: When Import any ps/eps file,Output error log. - tkbd - 12-13-2016

Micheus,thank you very much !
I installed your fixed plugin.
Now,The simple ps file could be importedBiggrin

Then,I tried several PostScript commands to work well.

However, there are some strange things.
It will be read upside down in 3D space.
Also reading this file, the rectangle is drawn very small than actualy.

Test EPS file is here(This file could import )
Quote:%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 800 800
%%Page: 1 1

newpath 170 50 % Comment test
moveto 140 60 % コメント
lineto 140 30 % ÄäËëḦḧÏïN̈nÖöT̈ẗÜüẄẅẌẍŸÿ
lineto % 评论
closepath
.5 setgray
fill
stroke

% The rectangle
newpath
400 400 moveto 400 600 lineto
600 600 lineto 600 400 lineto 400 400 lineto
closepath
stroke

% Polygon (Experimental for rlineto)
newpath
200 350 moveto 100 110 rlineto
50 -20 rlineto % rlineto, In currently not support
35 -80 rlineto % rlineto, In currently not support
10 200 lineto
closepath
stroke

% Circle
newpath
150 150 32 0 360 arc % Arc(Counterclockwise ) ,In currently not support
stroke

newpath
400 150 32 0 150 arc % Arc(Counterclockwise ) ,In currently not support
stroke

% The curved shape
newpath
40 40 moveto
10 10 75 45 38 25 curveto
20 20 35 0 4 5 curveto
closepath
stroke

showpage
%%EOF