Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Using Mathematica 5.2 and 7.01 with separate settings

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104325] Re: Using Mathematica 5.2 and 7.01 with separate settings
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Wed, 28 Oct 2009 04:04:52 -0500 (EST)
  • References: <h9ab6s$mmv$1@smc.vnet.net> <ha20tu$n2g$1@smc.vnet.net> <hc6gc1$5m0$1@smc.vnet.net>

Alexey wrote:
> On 25 Oct, 08:18, Albert Retey <a... at gmx-topmail.de> wrote:
>> since this has come up more than once, I would like to mention that
>> actually I think everything is still there, it is just not documented
>> and of course deprecated, but for most purposes it is probably not
>> necessary to have a Version 5 installed in parallel. E.g. you can export
>> a Graphics3D as a 2D-Vector-Graphic just as Version 5 did doing the
>> following:
>>
>> Get["Version5`Graphics`"]
>>
>> Plot3D[x, {x, 0, 1}, {y, 0, 1}]
>>
>> now select the graphics, 'do save selection as' and choose a filename
>> ending in e.g. eps. Of course one could try to automate the process and
>> have a function do all that in one go. Of course you are limited to the
>> graphics functionality of version 5. Oh, and don't forget to:
>>
>> Get["Version6`Graphics`"]
>>
>> to get back the new default behaviour.
>>
>> hth,
>>
>> albert
> 
> Hello,
> As I have mentioned before, I need internal 2D-representation of
> Graphics3D as Graphics for having an ability to optimize 2D-vector
> representation of Graphics3D before exporting in vector format.
> Unfortunately, v.7 have no ability to transform Graphics3D into
> Graphics, try the following:
> 
> In[1]:= << Version5`Graphics`
> g = Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}]
> Graphics[g]
> 
> During evaluation of In[1]:= GraphicsData["PostScript", "\<\
> %!
> %%Creator: Mathematica
> %%AspectRatio: .81114
> MathPictureStart
> ....................
> % End of Graphics
> MathPictureEnd
> \
> \>"]
> 
> Out[2]= - SurfaceGraphics -
> 
> During evaluation of In[1]:= Graphics3D::optx: Unknown option
> DefaultAxesStyle in Options[Graphics3D]. >>
> 
> Out[3]= - Graphics -
> 
> The result of evaluation of Graphics[g] is an empty graphics instead
> of 2D-representation of 'g' as it is in v.5.

you will just need select the graphics in the notebook and use the save
selection as menu entry to save it as EPS. The following does automate
the process:

SetAttributes[exporteps,HoldRest]
exporteps[filename_,graphicscmd_]:=Module[{nb,ds,g},
nb=CreateDocument[{
ExpressionCell[Defer[Get["Version5`Graphics`"]],"Input"],
ExpressionCell[Defer[graphicscmd],"Input"],
ExpressionCell[Defer[Get["Version6`Graphics`"]],"Input"],
ExpressionCell[Defer[
NotebookFind[EvaluationNotebook[],"Graphics",All,CellStyle];
FE`Evaluate[
FrontEnd`SaveSelectionAs[filename,EvaluationNotebook[],"EPS"]
];
NotebookClose[EvaluationNotebook[]]
],"Input"]
},
"ClosingSaveDialog"->False,
Visible->False
];
FrontEndTokenExecute[nb,"EvaluateNotebook"]
]

(* use it like this: *)

exporteps[
FileNameJoin[{$HomeDirectory,"Desktop","test.eps"}],
Plot3D[x*y,{x,0,1},{y,0,1}]
]


  • Prev by Date: Re: old vs new(V7) BarChart3D
  • Next by Date: Re: presentations
  • Previous by thread: Re: Using Mathematica 5.2 and 7.01 with separate settings
  • Next by thread: Re: Incorrect symbolic improper integral