CAD Forum - Database of tips, tricks and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 17425
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

 

HelpCAD discussion

 
CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.

How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic Closedrunning a function in autocad

 Post Reply Post Reply
Author
Frank98 View Drop Down
Newbie
Newbie


Joined: 15.Feb.2017
Location: Bahamas
Using: autocad 2015
Status: Offline
Points: 4
Direct Link To This Post Topic: running a function in autocad
    Posted: 18.Feb.2017 at 10:53

Hello, i have tried to save the code bellow as a lisp, the i loaeded it and in the vommand line i wrote the name of the lisp file and nohing happened,if you could help me understand how  run function in outocad ,i have attache my cad menu in the photo bellow

thanks




(defun curve ()
 (prompt "Routine to draw the basic sinuous curve ") (terpri)
 (setq start (getpoint "Pick the start point ")) (terpri)
 (setq rl (getreal "Enter the minimum radius ")) (terpri)
 (setq r2 (getreal "Enter the maximum radius ")) (terpri)
 (setq s (getreal "Enter the incremental step ")) (terpri)
 (setq tau (getreal "Enter the value of tau ")) (terpri)
    (while (< rl (- r2 s))
     (setq fl (* (/ pi 4) (sin (* pi (/ (log (/ rl r2)) (log tau))))))
     (setq x 1 (+ (* rl (cos fl)) (car start)))
     (setq yl (+ (* rl (sin fl)) (cadr start)))
     (setq rl (+ rl s))
     (setq f2 (* (/ pi 4) (sin (* pi (/ (log (I r 1 r2)) (log tau))))))
     (setq x2 (+ (* rl (cos f2)) (car start)))
     (setq y2 (+ (* rl (sin f2)) (cadr start)))
      (command "line"
        (setq p (list xl y1))
        (setq p (list x2 y2))
        ""
       )
      )
)
Back to Top
Vladimir Michl View Drop Down
Moderator Group
Moderator Group

Arkance Systems CZ

Joined: 26.Jul.2007
Location: Czech Republic
Using: Autodesk software
Status: Offline
Points: 2015
Direct Link To This Post Posted: 18.Feb.2017 at 16:55
The name of the LISP function is "curve" so you can invoke it by typing the "(curve)" command - note the parenthesis.
 
If you want to make it a custom command (invoked by name), defun it as "C:Curve" - i.e.:
 
(defun C:Curve ( ....
Vladimir Michl (moderator)
Arkance Systems - arkance-systems.cz - Autodesk reseller
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,344 seconds.