加急!!有谁知道如何在cad中画缓和曲线
急需在cad中画缓和曲线的方法,各位高人帮帮我吧。多谢!! 缓和曲线?没听过,样条曲线?抛物线? 你是否问spline 晕 什么是缓和曲线? 缓和曲线是用于公路上的一种曲线,曲线上每一点的半径都不相同。曲线特点是:从缓和曲线与直线的衔接点开始算起,缓和曲线的长度L与长度所对应的点的半径R的乘积为常数。即L*R=A(A为常数) 这个没有直接的画法。河伯做的市政软件提供了这方面的程序(可能现在叫“天正市政”吧)。 这个我就不知道了,不是搞哪个专业的 ;;; 3DSPIRAL.LSP<BR>;;; Copyright (C) 1993 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.1415926535 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 "_pline" 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> 你是什么单位的,搞道路的吧,我的qq66832783,有什么可以共同探讨一下吧 可以用Lisp编一个,用Align可以代替坐标变换的编程。
页:
[1]
2