阿基米德螺旋线的画法
阿基米德螺旋线怎么样画?平面的。 在AUTOCAD中不能直接画出,可以编程或者用EXCEL输入。 EXCEL怎么做?谢谢Autodesk提供的源程序
;;; 3DSPIRAL.LSP<BR>; Copyright (C) 1992 by Autodesk, Inc.<BR>;<BR>; Permission to use, copy, modify, and distribute this software <BR>; for any purpose and without fee is hereby granted, provided <BR>; that the above copyright notice appears in all copies and that <BR>; both that copyright notice and this permission notice appear in <BR>; all supporting documentation.<BR>;<BR>; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED<BR>; WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR<BR>; PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.<BR>;;; --------------------------------------------------------------------------;<BR>;;; DESCRIPTION<BR>;;;<BR>;;; This is a programming example.<BR>;;;<BR>;;; Designed and implemented by Kelvin R. Throop in January 1985<BR>;;;<BR>;;; This program constructs a spiral. It can be loaded and called <BR>;;; by typing either "spiral", "3dspiral" or the following:<BR>;;; (cspiral <# rotations> <base point> <horiz growth per rotation><BR>;;; <points per circle> <start radius> <BR>;;; <vert growth per rotation>).<BR>;;;<BR>;;; --------------------------------------------------------------------------;(defun myerror (s) ; If an error (such as CTRL-C) occurs<BR> ; while this command is active...<BR> (if (/= s "Function cancelled")<BR> (princ (strcat "\nError: " s))<BR> )<BR> (setvar "cmdecho" ocmd) ; Restore saved modes<BR> (setvar "blipmode" oblp)<BR> (setq *error* olderr) ; Restore old *error* handler<BR> (princ)<BR>)
(defun cspiral (ntimes bpoint hfac lppass strad vfac<BR> / ang dist tp ainc dhinc dvinc circle dv)
(setvar "blipmode" 0) ; turn blipmode off<BR> (setvar "cmdecho" 0) ; turn cmdecho off<BR> (setq circle (* 3.141596235 2))<BR> (setq ainc (/ circle lppass))<BR> (setq dhinc (/ hfac lppass))<BR> (if vfac (setq dvinc (/ vfac lppass)))<BR> (setq ang 0.0)<BR> (if vfac<BR> (setq dist strad dv 0.0)<BR> (setq dist 0.0)<BR> )<BR> (if vfac <BR> (command "3dpoly") ; start spiral ...<BR> (command "mline" bpoint) ; start spiral from base point and...<BR> )<BR> (repeat ntimes <BR> (repeat lppass <BR> (setq tp (polar bpoint (setq ang (+ ang ainc))<BR> (setq dist (+ dist dhinc))<BR> )<BR> )<BR> (if vfac<BR> (setq tp (list (car tp) (cadr tp) (+ dv (caddr tp)))<BR> dv (+ dv dvinc)<BR> )<BR> )<BR> (command tp) ; continue to the next point...<BR> )<BR> ) <BR> (command "") ; until done.<BR> (princ)<BR>)
;;;<BR>;;; Interactive spiral generation<BR>;;;
(defun C:SPIRAL (/ olderr ocmd oblp nt bp cf lp) <BR> ;;;;(setq olderr *error*<BR> ;;;; *error* myerror)<BR> (setq ocmd (getvar "cmdecho"))<BR> (setq oblp (getvar "blipmode"))<BR> (setvar "cmdecho" 0)<BR> (initget 1) ; bp must not be null<BR> (setq bp (getpoint "\nCenter point: "))<BR> (initget 7) ; nt must not be zero, neg, or null<BR> (setq nt (getint "\nNumber of rotations: "))<BR> (initget 3) ; cf must not be zero, or null<BR> (setq cf (getdist "\nGrowth per rotation: "))<BR> (initget 6) ; lp must not be zero or neg<BR> (setq lp (getint "\nPoints per rotation <30>: "))<BR> (cond ((null lp) (setq lp 30))) <BR> (cspiral nt bp cf lp nil nil)<BR> (setvar "cmdecho" ocmd)<BR> (setvar "blipmode" oblp)<BR> (setq *error* olderr) ; Restore old *error* handler<BR> (princ)
)
;;;<BR>;;; Interactive spiral generation<BR>;;;
(defun C:3DSPIRAL (/ olderr ocmd oblp nt bp hg vg sr lp) <BR> ;;;;(setq olderr *error*<BR> ;;;; *error* myerror)<BR> (setq ocmd (getvar "cmdecho"))<BR> (setq oblp (getvar "blipmode"))<BR> (setvar "cmdecho" 0)<BR> (initget 1) ; bp must not be null<BR> (setq bp (getpoint "\nCenter point: "))<BR> (initget 7) ; nt must not be zero, neg, or null<BR> (setq nt (getint "\nNumber of rotations: "))<BR> (initget 7) ; sr must not be zero, neg, or null<BR> (setq sr (getdist bp "\nStarting radius: "))<BR> (initget 1) ; cf must not be zero, or null<BR> (setq hg (getdist "\nHorizontal growth per rotation: "))<BR> (initget 3) ; cf must not be zero, or null<BR> (setq vg (getdist "\nVertical growth per rotation: "))<BR> (initget 6) ; lp must not be zero or neg<BR> (setq lp (getint "\nPoints per rotation <30>: "))<BR> (cond ((null lp) (setq lp 30))) <BR> (cspiral nt bp hg lp sr vg)<BR> (setvar "cmdecho" ocmd)<BR> (setvar "blipmode" oblp)<BR> (setq *error* olderr) ; Restore old *error* handler<BR> (princ)
)
;;; --------------------------------------------------------------------------;<BR>(princ "\n\tC:SPIRAL and C:3DSPIRAL loaded. ")<BR>(princ)<BR>
页:
[1]