Jump to content

simple graph with lisp


hakanli

Recommended Posts


Hi, everyone

I am trying to draw a simple graph with lisp, but with very small lengths values, start points are the previous ones

can anybody help?


 

(defun c:simp ()
(setq start (getpoint "\n select point"))

(setq n (getint "enter n:"))
(setq deltalist nil)


(repeat n
(setq delta (getdist "/lengths"))
(setq deltalist (append deltalist (list delta)))
)
(setq ct 0)


(repeat n
(setq deltax (nth ct deltalist))
(setq pt1 (list (+ (car start) deltax) (cadr start)))
(setq pt2 (list (+ (car start) deltax) (+ (cadr start) 3)))
(command "line" start pt1 "")
(command "line" pt1 pt2 "")
(setq ct (+ 1 ct))
)
)

 

Edited by CADTutor
Code moved to code block
Link to comment
Share on other sites

and what do you want the graph to look like?

 

You might have written the perfect code to draw this graph, but i suspect it isn't the one you want it to draw.. maybe if you can attach a file showing an example,

Link to comment
Share on other sites

The obvious missing is setting "osmode" your home work,  else you may end up with zero length lines as osnap will cause problems snapping points when you dont want them to. 

 

Y= 4x^2 + 3X + 5 

Link to comment
Share on other sites

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