Jump to content

Recommended Posts

Posted

How can I draw functions in CAD? I found some LISP programs, but I'm not happy...

 

 

I would like draw, example, y=ax^3+bx^2+c, where a,b,c, "start point", end "end point" I put in command line. And I would like second option: When I put any value for x of this function, can program calculate y value?

 

 

Sorry for my bad English, I hope that You understand me.

 

Thanks in advance.

Blagojer

Posted

Does 2006 have the QuickCalc calculator? From AutoCAD 2010 Help file:

 

Functions. Any expression entered in the Value or Expression text entry box is stored as text. Functions are evaluated when used in the QuickCalc Input box.

Posted
When I put any value for x of this function, can program calculate y value?

 

Yes, with quickcalc in CAD 2010 I resolved this problem...

Posted

I have LISP, but with error...

(defun coef (/ aaa bbb ccc)

(setvar "CMDECHO" 0)

(setq aaa (getreal "\nvalue a: "))

(setq bbb (getreal "\nvalue b: "))

(setq ccc (getreal "\nvalue c: "))

)

 

(defun mfc (x)

(+ 0 (* aaa x x) (* bbb x) ccc)

)

 

(defun drawfc ()

(command "._pline")

(while (

(command (list start (mfc start)))

(setq start (+ start delta))

)

(command (list ende (mfc ende)) "")

)

 

(defun c:drawfunc (/ start ende delta)

(setvar "CMDECHO" 0)

(setq start (getreal "\nStart value (X): "))

(setq ende (getreal "\nEnd value (X): "))

(setq delta (getreal "\nPrecision: "))

(coef)

(drawfc)

(princ)

)

Posted

Functions. Any expression entered in the Value or Expression text entry box is stored as text. Functions are evaluated when used in the QuickCalc Input box.

 

Why QuickCalc can't read values from LISP? When I put any values for example aaa or bbb in LISP above, quickcalc cant't read...

 

And, how can I run QuickCalc from LISP?

Posted

blagojer,

I don't know about quickcalc, but I played around with your lisp and came up with this one :

 

(defun coef (/)
(setq aaa (getreal "\nvalue a: "))
(setq bbb (getreal "\nvalue b: "))
(setq ccc (getreal "\nvalue c: "))
)

(defun mfc (x)
(+ (* aaa x x) (* bbb x) ccc)
)

(defun drawfc (/ pt ptlist)
(while (< start ende)
(setq pt (list start (mfc start)))
(setq start (+ start delta))
(setq ptlist (append (list pt) ptlist))
)
(command "._pline" ptlist "")
)

(defun c:df2 (/ ce start ende delta)
(setq ce (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(setq start (getreal "\nStart value (X): "))
(setq ende (getreal "\nEnd value (X): "))
(setq delta (getreal "\nPrecision: "))
(coef)
(drawfc)
(setvar "CMDECHO" ce)
(princ)
)

Posted

CALCAD,

 

I have ane error: Unknow command "df2", wich pop-up after I put all values...

 

 

Can this LISP calculate minimum of these function?

Posted

Hi blagojer,

I recommend to use a template drawing giving a 2D-UCS.

After drawing the function you can use my DERIVATION.lsp

You will find (nearly) the extrema of the function at these points, where the

DERIVATION-function is crossing the x-axis. (You can get higher derivation of the derivation ...)

Good luck and happy math!

Jochen

derivation.lsp

Posted

After drawing the function you can use my DERIVATION.lsp

You will find (nearly) the extrema of the function at these points, where the

DERIVATION-function is crossing the x-axis.

 

Yes, thanks

 

You can get higher derivation of the derivation ...

 

How?

 

And, I can't understand what is "derivation function"? Which function your LISP draw?

Posted

First : Draw the graph of a function y=f(x) as a 2d-Polyline consisting of (small) linear segments or a 2D-Spline at the correct position in the 2D-WorldCoordinateSystem (better use a template).

Then run the DERIVATION.lsp (Usefull setting a new color befor running).

Pick the graph of a function (2DPolyline or -SPLINE) and the derivation will be drawn.

You can use this curve (fist derivation) to get the second derivation and so on...

Regards Jochen

derivation.dwg

Posted

I maked that way!! I understand drawing, but WHAT IS DERIVATION???

 

There is no in my math... :):):)

Posted

English not my mother language, too!!!

 

Thanks very much!

Posted
Does 2006 have the QuickCalc calculator? From AutoCAD 2010 Help file:

 

Functions. Any expression entered in the Value or Expression text entry box is stored as text. Functions are evaluated when used in the QuickCalc Input box.

 

How do you use this quickcalc to draw? 2008 has it, however I don't get how to use it to draw.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...