Jump to content

Recommended Posts

Posted

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?

Posted

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)
)

Posted

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.

Posted
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

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...