我已经转发了你的代码,建议做一些小改动。
-
- (defun c:front2 ()
- ;Start of Save Settings
- (setq oldsnap (getvar "osmode"))
- (setq oldblipmode (getvar "blipmode"))
- ;end of Save Settings
-
- ;Start of Get User Input
- (setq s (getreal "\nOffset of your front from outside cabinet: "))
- (setq d (getreal "\nThickness of the Front: "))
- (setq h (getreal "\nHeight of the Front: "))
- (setq b (getreal "\nWidth of the Front: "))
- (setq ip (getpoint "\nInsertion Point: "))
- ;End of Get User Input
- (setvar "osmode" 0);Turn off snaps
- (setvar "cmdecho" 1); For debugging purposes???
- ;Start of Polar Calculations
-
- (setq p2 ip) ;ip = p2
- (setq p3 (polar ip 0 b)) ; From p2 to p3 = Width of the Front
- (setq p4 (polar p3 (* 1.5 pi) d)) ; From p3 to p4 = Thickness of the Front
- (setq p5 (list (car p2) (cadr p2) (+ (caddr p2) h))) ; p5 = x & y of p2 and z of p2 + Height of the Front
- (setq p6 (list (car p5) (cadr p5) (- (caddr p5) 160))) ; p6 = x & y of p5 and z of p5 - 160 units
- (setq r1 (list (car p2) (cadr p2) (+ (caddr p2) s))) ; r1 = x & y of p2 and z of p2 + Offset of your front from outside cabinet
- (setq p7 (polar p2 0 s)); From p2 to p7 = Offset of your front from outside cabinet
- (setq p8 (list (car p7) (cadr p7) (+ (caddr p7) s))); p8 = x & y of p7 and z of p7 + Offset of your front from outside cabinet
- (setq p9 (polar r1 0 b));From r1 to p9 = Width of the Front
- (setq p10 (polar p9 pi s)) ;From p9 to p10 = Offset of your front from outside cabinet
- (setq p11 (list (car p7) (cadr p7) (+ (caddr p7) h))); p11 = x & y of p7 and z of p7 + Height of the Front
- (setq p12 (list (car p11) (cadr p11) (- (caddr p11) s))); p12 = x & y of p11 and z of p11 - Offset of your front from outside cabinet
- (setq p13 (polar p10 (* 1.5 pi) d)) ;From p10 to p13 = Thickness of the Front
- ;End of Polar Caclulations
-
- (command "ucs" "w") ;Make sure that the ucs is in world???
- ;This should maybe be before the Get User Inputs???
-
- (command "box" p8 p13 p12)
- ;Create a 3d Solid using p8, p13 & p12
-
- (command "-Insert" "listscharnier" "_non" ip "" "" "0")
- (command "-Insert" "listscharnier" "_non" p6 "" "" "0")
- ;Insert the block at the ip (p2) & p6
-
- ;Start Reset Old Settings
- (setvar "osmode" oldsnap)
- (setvar "blipmode" oldblipmode)
- ;End Reset old Settings
-
- (princ "\nDone!") ;Let User Know Command is finished
- (princ) ; Finish Clean
- )
-
-
|