plot function

Discussion in 'AutoCAD' started by Bernhard Hidding, Jul 26, 2004.

  1. Hi,
    I want to plot a function like f(x) = x^2. How can I do that with autoCAD?
    Thanks in advance,
    Bernhard
     
    Bernhard Hidding, Jul 26, 2004
    #1
  2. How accurate does it have to be?
     
    Michael Bulatovich, Jul 26, 2004
    #2
  3. Very accurate. I also have an according truth table (value chart) with
    approx. 1000 xy-coordinates which resemble the function, but I would not
    like to set all these coordinates manually and join them by a polyline...
    I have plotted my function with Origin as well as Excel, but I failed in
    importing that data from one of those programs..

    Bernhard
     
    Bernhard Hidding, Jul 26, 2004
    #3
  4. Bernhard Hidding

    Paul Turvill Guest

    There are LISP routines for plotting such functions. They're not too
    difficult to write, but you may also find some of these via a Google search.

    Also, if you have a comma-delimited list of the points, it could be easily
    converted to a script. For example if your list is something like this x,y
    format:

    0,0
    0.1,0.01
    0.2,0.04
    ....
    <etc.>

    you can simply prefix it with
    PLINE
    then end it with an extra blank line to close the pline command. Save it
    with a .scr extension, and run it in AutoCAD.
    ___
     
    Paul Turvill, Jul 26, 2004
    #4
  5. Depend on who you ask, a polyline connecting a bunch of accurate points is
    NOT that accurate, i.e. perfect.
    Like Paul said, a script will do it if a polyline is "accurate" enough.
     
    Michael Bulatovich, Jul 26, 2004
    #5
  6. Bernhard Hidding

    Paul Turvill Guest

    .... and splining the pline makes it a bit more accurate.
     
    Paul Turvill, Jul 26, 2004
    #6
  7. Bernhard Hidding

    Paul Turvill Guest

    Sorry ... Actually, that should be "curve fitting" ... splining may pull the
    result off of the plotted points.
    ____
     
    Paul Turvill, Jul 26, 2004
    #7
  8. Bernhard Hidding

    Randy Jones Guest

    I use Excel to create these kinds of scripts because you can import comma
    delimited source data into columns and then insert the necessary columns
    (commands, semi-colons, etc.) and then export the data back to comma
    delimited. Some pre-planning while working in Excel will lend itself to
    search and replace once the data is sent back out and opened in Word for
    example. As in replacing the commas in the CDF file or tabs in a tab
    delimited file with AutoCAD's return character, the semi-colon.
     
    Randy Jones, Jul 26, 2004
    #8
  9. What kind of work are you doing?
     
    Michael Bulatovich, Jul 27, 2004
    #9
  10. Thanks for your help,
    now I have generated an ASCII file with .scr suffix that looks like this:

    _pline
    0.00273,0.00747
    0.00636,0.00744
    0.01,0.00742
    0.01364,0.0074
    0.01727,0.00738
    0.02091,0.00735
    0.02455,0.00733
    0.02818,0.00731
    0.03182,0.00728
    0.03545,0.00726
    0.03909,0.00723
    0.04273,0.00721
    0.04636,0.00719
    0.05,0.00716


    Note that I had to use an underscore "_pline" instead of "pline" in order to
    make the script work. However, AutoCAD demands a 2D starting point now.. How
    do I specify this?

    When I do not use the script file but type in the commands directly in the
    command line, I have to specify each next plot-point manually, it seems not
    to be able to paste a row of points there?

    Thanks again,
    Bernhard
     
    Bernhard Hidding, Jul 27, 2004
    #10
  11. Bernhard Hidding

    Paul Turvill Guest

    Your script should work as shown; 0.00273,0.00747 *is* your first 2D point.
    Be sure there are no extra spaces at the end of any of the lines. Also
    "_.pline" is the programmer preferred format, since it ensures that the
    "native" form of the pline command is used, even if it has been redefined.
    ___
     
    Paul Turvill, Jul 27, 2004
    #11
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.