KarolR Posted April 17, 2019 Posted April 17, 2019 For example y=(x^2)sin(x^0.5) Is there a way to input it into aotocad, or at least connect the drawing with an excel sheet from which i can extract (x,y) points? Quote
rkmcswain Posted April 17, 2019 Posted April 17, 2019 How about something like this lisp function? (defun c:foo ( / x y) (setq x 0.5) (repeat 22 (setq y (* (* x x) (sin (expt x 0.5)))) (vl-cmdf "point" (list x y)) (setq x (+ x 0.5)) ) ) 1 Quote
KarolR Posted April 17, 2019 Author Posted April 17, 2019 (edited) Good idea but i don't know much lisp Also in what language is vl-cmdf, and is there a lisp function to create a point instead of learning a new and other language? And also is there a method to select all the points together when i make a spline, or do i have to pick them one by one? Edited April 17, 2019 by KarolR Quote
rkmcswain Posted April 17, 2019 Posted April 17, 2019 You don't have to know any, in order to run this function. Even so, it's not difficult to pick it up. I added a function to draw the spline, found here. If you don't want to draw the points you can comment out that line with a semicolon. (defun myspline ( arg) (command "_SPLINE") ;start the command (foreach thePoint arg ;parse points list (command thePoint) ) (command "" "" "") ;accept default tangents & end the command ) (defun c:foo ( / x y) (setq x 0.5 new '()) (repeat 22 (setq y (* (* x x) (sin (expt x 0.5)))) (vl-cmdf "point" (list x y)) (setq new (cons (list x y) new)) (setq x (+ x 0.5)) ) (myspline new) ) Quote
BIGAL Posted April 17, 2019 Posted April 17, 2019 You could compare the three they are the same thing used to make something (command (entmake (vl-cmdf There is a difference in the way they work an entmake is generally faster than a command but requires more lines of code You may also want to turn on the points so you can see them use "ptype" A few more comments (defun myspline ( arg) ; a function called myspline passed a variable value to it arg (command "_SPLINE") ; start the command spline (foreach thePoint arg ; parse points list foreach loops through the list of points in arg (command thePoint) ; create an acad point the point has x & y values ) (command "" "" "") ; accept default tangents & end the command ) (defun c:foo ( / x y) ; a function foo with local variables x & y (setq x 0.5 new '()) ; set x to 0.5 and make a list of points new but set to empty (repeat 22 ; do it 22 times (setq y (* (* x x) (sin (expt x 0.5)))) ; the forumla (vl-cmdf "point" (list x y)) ; draw an acad point (setq new (cons (list x y) new)) ; add the x y of the points to the list new (setq x (+ x 0.5)) ; increase x by 0.5 ) (setvar 'pdmode 35) ; turn on the points so you can see them and set style (setvar 'pdsize 0) ; size of the point use ptype to see other information (myspline new) ; call the defun myspline and pass it the list of points new ) Quote
SEANT Posted April 18, 2019 Posted April 18, 2019 Often, the use of a trigonometric function implies polar graphing. If that were the case, and I limited the evaluation interval between 0 and 2PI, the Sin(SQRT(x)) never reaches the negative zone. In other words, with just one complete turn, the polar value of y never decreases. The function would graph to something like this: Quote
lrm Posted April 25, 2019 Posted April 25, 2019 (edited) In the following Excel sheet B2 contains your equation: =(A2^2)*SIN(A2^0.5) ] and C2 has =CONCATENATE(A2,",",B2) Copy cells C2 through the end value of column C to the Windows clipboard (Ctrl-C). Then in AutoCAD give the pline command and do a paste (Ctrl-V) Edited April 25, 2019 by lrm 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.