×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Involute profile in autocad

Involute profile in autocad

Involute profile in autocad

(OP)
I'm looking a highly accurate way to draw the involute. Any suggestion?
I'm using AutoCad 2004. In the past in AutoCad 12 I used a nice LISP program  IMPORT-3D-POLY  written by Tony Hotchkiss, 2003 program which has converted from Excell Spreadhseet the involute cordinates into polyline in Autocad. Right now when I try to do same in Acad 2004, i always have a message:

    IMPORT-3D-POLY - Error: bad argument type: FILE nil

what's the problem?

The lsp program looks like this:

;;; Cadalyst April 2003 AutoLISP Solutions
;;; import-3d-poly.lsp imports x,y,z coordinates
;;; from Excel spreadsheet into AutoCAD.
;;; Program (c) Tony Hotchkiss, 2003
;;;
(defun err (s)
  (if (= s "Function cancelled")
    (princ "IMPORT-3D-POLY - cancelled: ")
    (progn (princ "IMPORT-3D-POLY - Error: ")
       (princ s)
       (terpri)
    ) ;_ progn
  ) ; if
  (resetting)
  (princ "SYSTEM VARIABLES have been reset\n")
  (princ)
) ; err
(defun setv (systvar newval)
  (setq x (read (strcat systvar "1")))
  (set x (getvar systvar))
  (setvar systvar newval)
) ; setv
(defun setting ()
  (setq oerr *error*)
  (setq *error* err)
  (setv "CMDECHO" 0)
  (setv "BLIPMODE" 0)
) ; end of setting
(defun rsetv (systvar)
  (setq x (read (strcat systvar "1")))
  (setvar systvar (eval x))
) ; restv
(defun resetting ()
  (rsetv "CMDECHO")
  (rsetv "BLIPMODE")
  (setq *error* oerr)
) ; end of resetting

(defun poly3D ()
  (setq    ptlist1    (get-ptlist))
  (make-3dpolyline ptlist1)
) ;_ poly3D

(defun get-ptlist ()
  (setq    fn    (getfiled "3D points file" "" "txt" 8)
    f     (open fn "r")
    str   (read-line f)
    plist nil
  ) ;_ end of setq
  (while (/= str EOF)
    (setq str (read-line f))
    (if    str
      (progn
    (setq pt (get-pt str))
    (setq plist (append plist (list pt)))
      ) ;_ end of progn
    ) ;_ end of if
  ) ;_ end of while
  (setq f (close f))
  plist
) ;_ get-ptlist

(defun get-pt (str1)
  (setq    comma (chr 44)
    str2  ""
    count 1
    i     0
  ) ;_ end of setq
  (repeat 2
    (repeat (strlen str1)
      (setq char (substr str1 (setq i (1+ i)) 1))
      (if (/= char comma)
    (setq str2 (strcat str2 char))
    (progn
      (if (= count 1)
        (progn
          (setq x (atof str2))
          (setq str1 (substr str1 (1+ i)))
          (setq i 0)
          (setq count 2)
          (setq str2 "")
        ) ;_ end of progn
        (progn
          (setq y (atof str2))
          (setq str1 (substr str1 (1+ i)))
          (setq z (atof str1))
        ) ;_ end of progn
      ) ;_ end of if
    ) ;_ end of progn
      ) ;_ end of if
    ) ;_ end of repeat
  ) ;_ end of repeat
  (setq pt (list x y z))
) ;_ end of get-pt

(defun make-3dpolyline (ptlist)
  (entmake (list '(0 . "POLYLINE")
         '(100 . "AcDbEntity")
         '(100 . "AcDb3dPolyline")
         '(70 . 8)
       ) ;_ list
  ) ;_ entmake
  (repeat (length ptlist)
    (setq pt     (car ptlist)
      ptlist (cdr ptlist)
    ) ;_ setq
    (entmake (list '(0 . "VERTEX")
           '(100 . "AcDb3dPolylineVertex")
           (cons 10 pt)
           '(70 . 32)
         ) ;_ list
    ) ;_ entmake
  ) ;_ repeat
  (entmake '((0 . "SEQEND")))
) ;_ make-3dpolyline

(defun c:pl3 ()
  (setting)
  (poly3D)
  (resetting)
  (princ)
) ;_ c:pl3

(prompt "Enter PL3 to start")

RE: Involute profile in autocad

As far as I can tell the routine you posted imports 3d points from a text file, then creates a 3dpolyline through these points. So I  assume you are doing the involute calculations in Excel, saving the points to a text file, then you run the routine and select the text file.  At what point in running the routine do you get the error message?

If you have the point coordinates (in the format x1,y1,z1) in a text file or in a column in Excel you don't need to use lisp to create the 3dpolyline.  Just start the 3dpoly command, then copy and paste the point data to the command line.

In a quick search I found a lisp to draw involute/gear, you might see if this does the trick.

http://www.xanadu.cz/en/download.asp?file=truegear&sort=

RE: Involute profile in autocad

(OP)
yes, i have a txt file i made from excell spreadsheet, with x,y,z coordinates.
NO, i can't use the command line to enter the coordinates, becasue i have more then 1000 points with cordinates, so the lisp program cant help me only.
I can load the lisp program in Autocad succesfully.
When i start it running with entering PL3 in command line, the window appers to choose the file I'm loading the coordinates from.
I can choose the file, and then the error occurs:
 
IMPORT-3D-POLY - Error: bad argument type: FILE nil

What's the problem?

RE: Involute profile in autocad

I don't know what the problem is, I'll try it out when I get a chance.

Did you try to copy and paste the text data?  I didn't sugest "entering" the points in the command line.  I have done this before in 1 step for close to 100 points, perhaps it will work with more than 1000.  Or you can paste a few groups of 100's at a time.

RE: Involute profile in autocad

(OP)
I'm not sure why didn['t work yesterday, but i tried to open a new empty cad file, and this time succeeded. Loaidng the Txt file with Lisp command PL3, all 1000 points were connected into the polyline.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close