MathGroup Archive 2009

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

Search the Archive

Re: how to use to export a dxf file

  • To: mathgroup at
  • Subject: [mg101849] Re: how to use to export a dxf file
  • From: "Hans Michel" <hmichel at>
  • Date: Sun, 19 Jul 2009 07:15:31 -0400 (EDT)
  • References: <h3pesb$ohj$> <h3s1up$63u$>


We need more information. And in the end it may be fuitile without that 

What version of Mathematica, what version of .NETLink? Are you sure .NETLink 
is properly installed.

see this message from the group "[mg55482] Re: [mg55466] Re: using 
Mathematica to plot in visual studio". So from the first line code depending 
on the version of NETLink your will get an an error.

Are your using Visual Studio? Can you set break points? What errors are you 
getting if any.
And please don't just copy paste the errors (Doing so simply means you did 
not read the errors nor care to see if they are simple errors).

Your goals are admirable but this is not about who knows VB. This is about 
MathLink and in particular here NETLink. You could have asked how to do this 
using C or C++ and those who know how could contribute.

When you export from the mathematica front end, the front end and the kernel 
communicate in ways WRI have set out.

I don't have NETLink installed anymore and I am relying on memory. But there 
are some Commands that won't run in NETLink as those command require the 
front end to start some process. For example SetDirectory maybe one of those 
commands. Is SetDirectory telling the Kernel or the FrontEnd where to put 
things? Comment out that line and hard code to your root drive "C:\". This 
is what I would do,  because the goal is to export to DXF, the secondary 
goal is to place it where you want. Keep the path stuff simple at first 
doing this avoids typo in a path.

Pleasw note that instead of exporting a DXF file fist just see if you can 
export a string to a text file. I can't recall if Export even works in this 
environment. That is the greater question. Can you use Export in the 
..NETLink or MathLink without the Front End?

When one write a application that use MathLink, J/Link NETLLink to interface 
with the Mathematica Kernel. You are in essence replacing the Front End. So 
all the things the front end handles and you need you will have to take care 


"jonk" <jkontuly at> wrote in message 
news:h3s1up$63u$1 at
> On Jul 17, 5:05 am, Bill <WDWNORW... at> wrote:
>> Hi:
>> I'm not familiar with VB code, but the following may be of furthur 
>> interest to you...
>> You can do more than just draw pretty pictures with this, it'll output 
>> parametric sets of equations that you can use to calculate intersections, 
>> tangents and the like. It's written in Mathematica 5.2 code, but 
>> shouldn't be too difficult to translate to a latter version, if desired.
>> Regards,
>> Bill
> Bill,
> Thanks for bringing this to my attention. It does indeed look very
> interesting.
> If anyone does know VB. I would still love to hear why this does work.
> In general I am trying to call Mathematica from a vb program,evaluate
> something that produces a plot and then export that plot as a dxf to
> my desktop. Sounds easy and I know you can do it if you are working in
> Mathematica but for some reason I can not get it to work. And again
> thanks Bill for the response.
> ' This launches the Mathematica kernel:
> Dim ml As IKernelLink = MathLinkFactory.CreateKernelLink()
> ml.Evaluate("SetDirectory[\""C:/Documents And Settings/User/Desktop/
> \""]")
> ml.WaitForAnswer()
> ml.Evaluate("gr = Plot[ Sin[x], {x, 0, 2*Pi}]")
> ml.Evaluate("Export[\""testMATH.dxf\"",gr, \""DXF\""]")
> ml.Close()

  • Prev by Date: Re: Standard deviations and Confidence intervals with respect to
  • Next by Date: Re: Player Pro Limitations
  • Previous by thread: Re: how to use to export a dxf file
  • Next by thread: Problems with Complie and generating a nested list