📄 rctr.lsp
字号:
;;; ;
;;; RCTR.LSP ;
;;; ;
;;; Copyright 1987, 1988, 1990, 1992, 1994, 1996, 1997, 1998, 1999 ;
;;; by Autodesk, Inc. All Rights Reserved. ;
;;; ;
;;; You are hereby granted permission to use, copy and modify this ;
;;; software without charge, provided you do so exclusively for ;
;;; your own use or for use by others in your organization in the ;
;;; performance of their normal duties, and provided further that ;
;;; the above copyright notice appears in all copies and both that ;
;;; copyright notice and the limited warranty and restricted rights ;
;;; notice below appear in all supporting documentation. ;
;;; ;
;;; Incorporation of any part of this software into other software, ;
;;; except when such incorporation is exclusively for your own use ;
;;; or for use by others in your organization in the performance of ;
;;; their normal duties, is prohibited without the prior written ;
;;; consent of Autodesk, Inc. ;
;;; ;
;;; Copying, modification and distribution of this software or any ;
;;; part thereof in any form except as expressly provided herein is ;
;;; prohibited without the prior written consent of Autodesk, Inc. ;
;;; ;
;;; AUTODESK PROVIDES THIS SOFTWARE "AS IS" AND WITH ALL FAULTS. ;
;;; AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF ;
;;; MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, ;
;;; INC. DOES NOT WARRANT THAT THE OPERATION OF THE SOFTWARE ;
;;; WILL BE UNINTERRUPTED OR ERROR FREE. ;
;;; ;
;;; Restricted Rights for US Government Users. This software ;
;;; and Documentation are provided with RESTRICTED RIGHTS for US ;
;;; US Government users. Use, duplication, or disclosure by the ;
;;; Government is subject to restrictions as set forth in FAR ;
;;; 12.212 (Commercial Computer Software-Restricted Rights) and ;
;;; DFAR 227.7202 (Rights in Technical Data and Computer Software), ;
;;; as applicable. Manufacturer is Autodesk, Inc., 111 McInnis ;
;;; Parkway, San Rafael, California 94903. ;
;;; ;
(vl-load-com)
;;;--------------------------------------------------------------------;
;;; General Note: THIS FILE IS A MEMBER OF THE RCTR-TST PROJECT ;
;;;--------------------------------------------------------------------;
;;; This file contains various examples that will enable you to: ;
;;; ;
;;; 1. Create circles with the same radii. ;
;;; 2. Are placed on a curve with equal spacing ;
;;; 3. And a reactor is attached to the arc (or more precise a curve), ;
;;; that will notify an event to re-space the circles ;
;;; according to the new shape of the curve. ;
;;;--------------------------------------------------------------------;
;;; Globals defined: ;
;;; ;
(setq *use-persistent-reactor* nil)
(setq *use-dialog* nil)
(setq *previous-radius* 1.0)
(setq *previous-circle-number* 2)
(setq *previous-color* 1)
;;;--------------------------------------------------------------------;
;;; Function: GET-DIST ;
;;; ;
;;; Description: This function prompts the user for a distance ;
;;; from known point. User input is curtailed via a ;
;;; call to initget whose sum of the bit values ;
;;; determine the behavior of this function. ;
;;; ;
;;; Bit value Description ;
;;; ;
;;; 1 Prevents the user from responding ;
;;; to the request by entering ;
;;; only ENTER. ;
;;; ;
;;; 2 Prevents the user from responding ;
;;; to the request by entering zero. ;
;;; ;
;;; 4 Prevents the user from responding ;
;;; to the request by entering a ;
;;; negative value. ;
;;; ;
;;; 32 Uses dashed lines when drawing ;
;;; rubber-band line or box. For those ;
;;; functions with which the user can ;
;;; specify a point by selecting a ;
;;; location on the graphics screen, ;
;;; this bit value causes the ;
;;; rubber-band line or box to be ;
;;; dashed instead of solid. ;
;;; (Some display drivers use a ;
;;; distinctive color instead of ;
;;; dashed lines.) ;
;;; If the system variable POPUPS ;
;;; is 0, AutoCAD ignores this bit. ;
;;; ;
;;; 64 Prohibits input of a Z ;
;;; coordinate to the getdist ;
;;; function; lets an application ;
;;; ensure that this function returns ;
;;; a 2D distance. ;
;;; ;
;;; Arguments: ;
;;; point = a list of three reals that denotes where the ;
;;; rubber-banding visual aid will commence. ;
;;; msg = a string value to print on the Command: prompt. ;
;;; ;
;;; Returned Value: a real number denoting a distance ;
;;; ;
;;; Usage: (get-dist '(0 0 0 ) "\nSelect a Point:") ;
;;;--------------------------------------------------------------------;
(defun get-dist (point msg)
(if (null msg) (setq msg ""))
(initget 103) ;(+ 1 2 4 32 64)
(if point
(getdist point msg)
(getdist msg)
)
)
;;;--------------------------------------------------------------------;
;;; Function: GET-INTEGER ;
;;; ;
;;; Description: This function prompts the user for an integer ;
;;; value. ;
;;; User input is curtailed via a call to initget ;
;;; whose sum of the bit values determine the ;
;;; behavior of this function. ;
;;; ;
;;; Bit value Description ;
;;; ;
;;; 1 Prevents the user from responding ;
;;; to the request by entering ;
;;; only ENTER. ;
;;; ;
;;; 2 Prevents the user from responding ;
;;; to the request by entering zero. ;
;;; ;
;;; 4 Prevents the user from responding ;
;;; to the request by entering a ;
;;; negative value. ;
;;; ;
;;; ;
;;; Arguments: ;
;;; msg = a string value to print on the Command: prompt. ;
;;; ;
;;; Returned Value: an integer. ;
;;; ;
;;; Usage: (get-integer "\nEnter a Number:") ;
;;;--------------------------------------------------------------------;
(defun get-integer (msg / circl-number)
(initget 7) ;;(+ 1 2 4)
(setq circl-number (GETINT msg))
)
;;;--------------------------------------------------------------------;
;;; Function: GET-YES/NO ;
;;; ;
;;; Description: This function prompts the user for a response. ;
;;; Yes is default. ;
;;; User input is curtailed via a call to initget ;
;;; whose sum of the bit values determine the ;
;;; behavior of this function. ;
;;; ;
;;; Bit value Description ;
;;; ;
;;; 1 Prevents the user from responding ;
;;; to the request by entering ;
;;; only ENTER. ;
;;; ;
;;; 2 Prevents the user from responding ;
;;; to the request by entering zero. ;
;;; ;
;;; 4 Prevents the user from responding ;
;;; to the request by entering a ;
;;; negative value. ;
;;; ;
;;; ;
;;; Arguments: ;
;;; msg = a string value to print on the Command: prompt. ;
;;; ;
;;; Returned Value: T if Yes yes or a enter is selected. ;
;;; Nil otherwise. ;
;;; ;
;;; Usage: (get-Yes/No "\nDo you want to play a game?: ") ;
;;;--------------------------------------------------------------------;
(defun get-Yes/No (msg)
(initget "Yes No")
(setq ans (getkword (strcat msg " <[Yes]/No> ")))
(setq ans (or (null ans)
(= (ascii ans) 89 ;|Y|;)
(= (ascii ans) 121 ;|y|;)
)
)
)
;;;--------------------------------------------------------------------;
;;; Function: GET-NO/YES ;
;;; ;
;;; Description: This function prompts the user for a response. ;
;;; No is default. ;
;;; User input is curtailed via a call to initget ;
;;; whose sum of the bit values determine the ;
;;; behavior of this function. ;
;;; ;
;;; Bit value Description ;
;;; ;
;;; 1 Prevents the user from responding ;
;;; to the request by entering ;
;;; only ENTER. ;
;;; ;
;;; 2 Prevents the user from responding ;
;;; to the request by entering zero. ;
;;; ;
;;; 4 Prevents the user from responding ;
;;; to the request by entering a ;
;;; negative value. ;
;;; ;
;;; ;
;;; Arguments: ;
;;; msg = a string value to print on the Command: prompt. ;
;;; ;
;;; Returned Value: T if No no or a enter is selected. ;
;;; Nil otherwise. ;
;;; ;
;;; Usage: (get-No/Yes "\nDo you want to play a game?: ") ;
;;;--------------------------------------------------------------------;
(defun get-No/Yes (msg)
(initget "Yes No")
(setq ans (getkword (strcat msg " <Yes/[No]> ")))
(setq ans (or (null ans)
(= (ascii ans) 78 ;|N|;)
(= (ascii ans) 110 ;|n|;)
)
)
)
;;;--------------------------------------------------------------------;
;;; Function: GET-RADIUS-FROM-POINT ;
;;; ;
;;; Description: This function prompts the user for a radius from ;
;;; a known point. ;
;;; ;
;;; Required Functions: ;
;;; get-dist ;
;;; ;
;;; Arguments: ;
;;; point = a list of three reals that denotes where the ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -