blagojer Posted June 26, 2010 Posted June 26, 2010 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 Quote
ReMark Posted June 28, 2010 Posted June 28, 2010 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. Quote
blagojer Posted June 28, 2010 Author Posted June 28, 2010 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... Quote
blagojer Posted June 29, 2010 Author Posted June 29, 2010 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) ) Quote
blagojer Posted June 30, 2010 Author Posted June 30, 2010 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? Quote
CALCAD Posted June 30, 2010 Posted June 30, 2010 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) ) Quote
blagojer Posted July 1, 2010 Author Posted July 1, 2010 CALCAD, I have ane error: Unknow command "df2", wich pop-up after I put all values... Can this LISP calculate minimum of these function? Quote
scj Posted July 1, 2010 Posted July 1, 2010 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 Quote
blagojer Posted July 1, 2010 Author Posted July 1, 2010 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? Quote
scj Posted July 1, 2010 Posted July 1, 2010 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 Quote
blagojer Posted July 1, 2010 Author Posted July 1, 2010 I maked that way!! I understand drawing, but WHAT IS DERIVATION??? There is no in my math... :) Quote
scj Posted July 1, 2010 Posted July 1, 2010 Hmmm, I should read more math texts in original English... (not my mother language). http://en.wikipedia.org/wiki/First_derivative Never mind - happy math! Jochen Quote
blagojer Posted July 1, 2010 Author Posted July 1, 2010 English not my mother language, too!!! Thanks very much! Quote
Crones Posted July 6, 2010 Posted July 6, 2010 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. Quote
Recommended Posts
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.