由于管理层的一些新指示,我正在尝试创建旧lisp的新.Net版本。下面的代码仅供参考,我也不能因此获得任何荣誉。我想做的基本上是模仿口齿不清的领导人的鬼影和“之字形”。我从基恩的跳汰示例开始,但我还没有做过类似的事情,所以有点不知所措。我知道在C3D中,创建一个样式并继续下去是很容易的,但为此,我的目标是Vanilla AutoCAD
我开始研究是否可能使用MLeader,但发现它并不太好用。如果有人能给我一些指导,我将不胜感激。我并不担心文字、方位或其他任何东西,主要是指引导者,并在用户决定位置时让其预览
- ;-------------------------------- C:RL --------------------------------------
- ;
- ; Description: Creates a radial line label for a point on a curve
- ;
- ; Written By: Robert P. Ehrman
- ;
- ; Operation: When you run the program, it will ask you for the "End point
- ; you are describing", this point is the point that you creating
- ; a radial line for. Then it askes you to "Point on the arc",
- ; this point is automatically snapped to the CENTER OF THE ARC
- ; Finally It will ask you for the location of the label, at this
- ; point you have three options, pick a point, using the ghost
- ; outline supplied as a guide to accurately place the label, or
- ; strike any of the four keys 'I', 'O', {space}, or {enter}.
- ; 'I', {space}, and {enter} denote "Inside", 'O' denotes
- ; "Outside". If you pick Inside or Outside, the radial line will
- ; originate at the point you are describing and the label will be
- ; on the appropriate side. If you pick a point, the label will
- ; originate at the point you pick, and the label will appear at
- ; the location shown on the ghost image.
- ;
- ;----------------------------------------------------------------------------
- (defun C:RL (/ End Ghost Osmode Cmde Osmode Clayr Cstyle Olderr Ltscale Pt1
- Pt2 Pt3 Cntr Brng1 Ns Ew Degree Minute Second Oldtrk Flag
- Track Temp Angl Angl2 Midtxt)
- (defun End (strng)
- (princ strng)
- (command "LAYER" "S" Clayr "")
- (command "TEXT" "S" Cstyle) (command)
- (setvar "CMDECHO" Cmde)
- (setvar "OSMODE" Osmode)
- (setq *error* olderr)
- (princ)
- )
-
- (defun Ghost (p1 / Temp Angl2 p2 p3 p4 p5 p7 p8 p9)
- (if (> (distance Cntr P1)
- (distance Cntr Pt1))
- (setq P6 (polar P1 (angle Cntr Pt1) (* Ltscal 1.2)))
- ;else
- (setq P6 (polar P1 (angle Pt1 Cntr) (* Ltscal 1.2))))
- (setq Angl2 (angle P1 P6))
- (if (and ( Angl2 (* 0.5 pi)))
- (setq Side 1.0)
- ;else
- (setq Side -1.0))
- (setq P9 (polar Pt1 Angl2 (+ (abs (- (distance P1 Cntr) (distance Pt1 Cntr)))
- (* Ltscal 0.1)))
- P2 (polar P1 Angl2 (* Ltscal 0.6))
- P3 (polar P2 (+ Angl2 (* Side 0.5 pi)) (* Ltscal 0.12))
- P4 (polar P3 Angl2 (* Ltscal 0.2))
- P5 (polar P4 (- Angl2 (* Side 0.5 pi)) (* Ltscal 0.12))
- P7 (polar P6 (- Angl2 (* Side 0.5 pi)) (* Ltscal 0.12))
- P10 (polar P1 Angl2 (* Ltscal 0.2))
- P8 (polar P10 (- Angl2 (* Side 0.5 pi)) (* Ltscal 0.12)))
- (grdraw Pt1 P9 -1)
- (grdraw P9 P1 -1)
- (grdraw P1 P6 -1)
- (grdraw P2 P3 -1)
- (grdraw P3 P4 -1)
- (grdraw P4 P5 -1)
- (grdraw P6 P7 -1)
- (grdraw P7 P8 -1)
- (grdraw P8 P10 -1)
- (setq p9 p9)
- )
-
- (setq Cmde (getvar "CMDECHO")
- Osmode (getvar "OSMODE")
- Clayr (getvar "CLAYER")
- Cstyle (getvar "TEXTSTYLE")
- Olderr *error*
- *error* End
- Ltscal (* 0.86 (getvar "LTSCALE"))
- )
- (setvar "CMDECHO" 0)
- (if (not (tblsearch "LAYER" "V-RADL"))
- (progn
- (princ "\nPlease wait while I create the layer.")
- (if (not (tblsearch "LTYPE" "G-EXIST"))
- (command ".LINETYPE" "load" "G-EXIST" "original" ""))
- (command ".LAYER" "N" "V-RADL"
- "C" "2" "V-RADL"
- "LT" "G-EXIST" "V-RADL" "")))
- (command ".LAYER" "S" "V-RADL" "")
- (setvar "OSMODE" 1025)
- (setq Pt1 (getpoint "\nPick end point on the arc : "))
- (setvar "OSMODE" 0)
- (while Pt1
- (setvar "OSMODE" 1028)
- (setq Cntr (getpoint "\nPick the arc : "))
- (setvar "OSMODE" 0)
- (setq Pt2 (polar Pt1 (angle Pt1 Cntr) (* Ltscal 1.2)))
- (setq Brng1 (angle Pt2 Pt1))
- (setq Brng1 (* 180.0 (/ Brng1 pi)))
- (cond ( (and ( 90 Brng1))
- (setq ns "N"
- ew "E"
- Brng1 (- 90.0 Brng1)))
- ( (and ( 180 Brng1))
- (setq ns "N"
- ew "W"
- Brng1 (- Brng1 90.0)))
- ( (and ( 270 Brng1))
- (setq ns "S"
- ew "W"
- Brng1 (- 270.0 Brng1)))
- ( (and ( 360 Brng1))
- (setq ns "S"
- ew "E"
- Brng1 (- Brng1 270.0))))
- (setq Degree (fix Brng1))
- (setq Brng1 (* 60.0 (- Brng1 (float (fix Brng1)))))
- (setq minute (fix Brng1))
- (setq Brng1 (* 60.0 (- Brng1 (float (fix Brng1)))))
- (setq second (fix Brng1))
- (setq Brng1 (- Brng1 (float (fix Brng1))))
|