jscgvnc Posted November 26, 2014 Share Posted November 26, 2014 All, I'm new here, so first off, hello. I have a need to draw the output of equations in AutoCAD, and I'm assuming I would need to do that through ALISP. I don't know a lot of lisp, but I'm working on it. Mostly things like exponential functions, and equations for electrical filter responses. Anyone have any ideas? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 26, 2014 Share Posted November 26, 2014 Welcome to CADTutor! You could try the following (novelty) program: ;; Dynamic Function Plotter - Lee Mac (defun c:dynfun ( / f i o p q x ) (setq f sin ;; Function to evaluate i 0.1 ;; Increment (i > 0) ) (or (setq o (getpoint "\nSpecify Origin for Function <0,0>: ")) (setq o '(0.0 0.0 0.0)) ) (princ "\nMove cursor to alter x-range...") (while (= 5 (car (setq p (grread t 13 0)))) (redraw) (setq x (abs (- (caadr p) (car o))) x (- x (rem x i)) q (mapcar '+ o (list x (f x))) ) (repeat (fix (/ x i 0.5)) (grdraw q (setq q (mapcar '+ o (list (setq x (- x i)) (f x)))) 3) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
jscgvnc Posted December 2, 2014 Author Share Posted December 2, 2014 Hey Lee, That is pretty interesting, thank you for replying! I do get a funny result: When I've drawn it and it's done, it's there on the screen, but if I move or zoom or try to click on it, it disappears. Isn't that strange? Thanks again. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 2, 2014 Share Posted December 2, 2014 That is pretty interesting, thank you for replying! You're welcome! I do get a funny result: When I've drawn it and it's done, it's there on the screen, but if I move or zoom or try to click on it, it disappears. Isn't that strange? To produce the dynamic visual effect, the program displays the graphed function using vector graphics (grdraw) as opposed to AutoCAD objects (e.g. Lines, Polylines, Arcs etc.), and therefore the graphics are only displayed until the screen is redrawn or regenerated (the dynamic effect is achieved as a result of this behaviour). If you are looking for the function to remain, perhaps one of the programs posted in this thread may help, particularly the code posted by Stefan BMR. I hope this helps, Lee Quote Link to comment Share on other sites More sharing options...
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.