Re: Processing graphics from C programme with MathLink
- To: mathgroup at smc.vnet.net
- Subject: [mg60815] Re: Processing graphics from C programme with MathLink
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Thu, 29 Sep 2005 05:41:38 -0400 (EDT)
- Organization: Uni Leipzig
- References: <dhavf3$jff$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, exporting graphics from the Kernel may need a FrontEnd to get the font metrics. Have a look at the J/Link package (J/Link 2.10.6) how to run the FrontEnd as a service. Regards Jens "Robert Cussons" <r.cussons at gsi.de> schrieb im Newsbeitrag news:dhavf3$jff$1 at smc.vnet.net... |I have a C programme that reads data from a number of files and arranges them | into a list for Mathematica to access and then plot, Mathematica then exports | this plot as an .eps to ghostview. This works when I run the code direct from | Mathematica, but now I have tried to transport the code into the C programme | to fully automate the process and I cannot get it to work. As you can | imagine, I have a number of set commands to produce the required tables. But | I don't know how to check whether these are being processed correctly. The | most puzzling thing is I don't know why, even if other things are wrong, why | ghostview doesn't launch. Shown below is a section of code including the | attempt to launch ghostview. I have been at this solidly for a few days now | and would be very grateful for some help!! Thanks, Rob. | | MLINK lp; | int pkt; | MLEnvironment env; | | env = MLInitialize(NULL); | if(env == NULL) | { | return 1; | } | lp = MLOpen(argc, argv); | if(lp == NULL) | { | return 1; | } | | MLPutFunction(lp, "EvaluatePacket", 1); | MLPutFunction(lp, "ToExpression", 1); | MLPutString(lp, | "Put[Export[\"~fmd/program/Be7/AV18gamma-cp-wb-ls-ic/energylevels.eps\", | Join[pllist, labels], Rule[PlotRange, All], Rule[FrameTicks, List[Automatic, | Automatic, None, Automatic]], Rule[AxesLabel, List[\"\", \"Energy/MeV\"]], | Rule[ImageSize, List[1000, 1000]]], \"!gv energylevels.eps &\"]"); | while((pkt = MLNextPacket(lp)) && pkt != RETURNPKT) | MLNewPacket(lp); | MLNewPacket(lp); | MLEndPacket(lp); | | MLClose(lp); | MLDeinitialize(env); |