Author Topic: ABOUT (GETPOINT)  (Read 1856 times)

0 Members and 1 Guest are viewing this topic.

aicr317

  • Guest
ABOUT (GETPOINT)
« on: March 12, 2010, 11:38:07 AM »



1.WHEN (setq crd '(0 0)) ,RIGHT
 2.WHEN (SETQ CRD (GETPOINT)) ,WRONG


 


 

(setq crd '(0 0))
;(SETQ CRD (GETPOINT))

 

(command "-layer" "make" "aicr317" "c" 1 "" "")

 


(setq x (nth 0 crd))

;;;;;(setq x 0) ;;;WHEN USE (GETPOINT) AND (SETQ X 0) ,IT IS ALSO RIGHT

(setq y (nth 1 crd))

(setq A0 (list (- x 37.5) (+ y 2)))
(setq A1 (list (- x 37.5) (+ y 12)))
(setq A2 (list (- x 25 5.5) (+ y 12)))
(setq A3 (list (- x 25) (+ y 12)))
(setq A4 (list (+ (- x 25) 5.5) (+ y 12)))
(setq A5 (list (- x 9) (+ y 12)))
(setq A6 (list (- x 0) (+ y 12)))
(setq A7 (list (+ x 9) (+ y 12)))
(setq A8 (list (- (+ x 25) 5.5) (+ y 12)))
(setq A9 (list (+ x 25) (+ y 12)))
(setq A10 (list (+ x 25 5.5) (+ y 12)))
(setq A11 (list (+ x 37.5) (+ y 12)))
(setq A12 (list (+ x 37.5) (+ y 2)))
(setq A13 (list (+ x 25 5.5) (+ y 2)))
(setq A14 (list (+ x 25) (+ y 2)))
(setq A15 (list (- (+ x 25) 5.5) (+ y 2)))
(setq AA (/ (- 25 9 5.5) 2))  ;;;;;;;A7和A8的中点
(setq A16 (list (+ 9 AA) (+ y 2)))
(setq A17 (list (+ 9 AA) (+ y 0)))
(setq A18 (list (+ x 9) (+ y 0)))
(setq A19 (list (- x 9) (+ y 0)))
(setq A20 (list (- (+ 9 AA)) (+ y 0)))
(setq A21 (list (- (+ 9 AA)) (+ y 2)))
(setq A22 (list (+ (- x 25) 5.5) (+ y 2)))
(setq A23 (list (- x 25) (+ y 2)))
(setq A24 (list (- x 25 5.5) (+ y 2)))
;;中心线
(setq A25 (list (- x 25) (+ y 17)))
(setq A26 (list (- x 25) (- y 5)))
(setq A27 (list (- x 0) (+ y 22)))
(setq A28 (list (- x 0) (- y 10)))
(setq A29 (list (+ x 25) (+ y 17)))
(setq A30 (list (+ x 25) (- y 5)))


;;填充部分
(SETQ TC1 (POLAR A0 (* 45 (/ pi 180)) 2))
(SETQ TC2 (POLAR A22 (* 45 (/ pi 180)) 2))
(SETQ TC3 (POLAR A18 (* 45 (/ pi 180)) 2))
(SETQ TC4 (POLAR A13 (* 45 (/ pi 180)) 2))

 


 

(command "cecolor" 3) ;绿色
(COMMAND "LINE" A0 A1 A11 A12 a16  a17 a20 a21 "c");外轮廓,以下为从左到右
(command "line" a2 a24 "")
(command "line" a4 a22 "")
(command "line" a5 a19 "")
(command "line" a7 a18 "")
(command "line" a8 a15 "")
(command "line" a10 a13 "")

(command "zoom" "e")

(command "_.bhatch" "p" "ansi31" 1 0 tc1 tc2 tc3 tc4 "")


(command "cecolor" 1) ;红色
(command "line" a25 a26 "")
(command "line" a27 a28 "")
(command "line" a29 a30 "")


(princ)


aicr317

  • Guest
Re: ABOUT (GETPOINT)
« Reply #1 on: March 12, 2010, 11:42:04 AM »
IT IS RIGHT

aicr317

  • Guest
Re: ABOUT (GETPOINT)
« Reply #2 on: March 12, 2010, 11:45:25 AM »
WHEN USE (SETQ CRD '(0 0)) AND IF (0 0) ALREADY HAD SOMETHING ,THE "-BHATCH" IS WRONG

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: ABOUT (GETPOINT)
« Reply #3 on: March 12, 2010, 01:23:33 PM »
See if you can use this:
Code: [Select]
(defun eMake ()
  (list
  (entmakex '((0 . "HATCH")(100 . "AcDbEntity")(67 . 0)(8 . "aicr317")(62 . 3)(100 . "AcDbHatch")(10 0.0 0.0 0.0)(210 0.0 0.0 1.0)
   (2 . "ANSI31")(70 . 0)(71 . 0)(91 . 4)(92 . 7)(72 . 0)(73 . 1)(93 . 4)(10 -37.5 2.0 0.0)(10 -30.5 2.0 0.0)(10 -30.5 12.0 0.0)(10 -37.5 12.0 0.0)
  (97 . 0)(92 . 7)(72 . 0)(73 . 1)(93 . 6)(10 -14.25 2.0 0.0)(10 -14.25 -3.55271e-015 0.0)(10 -9.0 -3.55271e-015 0.0)(10 -9.0 12.0 0.0)(10 -19.5 12.0 0.0)(10 -19.5 2.0 0.0)
  (97 . 0)(92 . 7)(72 . 0)(73 . 1)(93 . 6)(10 14.25 -3.55271e-015 0.0)(10 14.25 2.0 0.0)(10 19.5 2.0 0.0)(10 19.5 12.0 0.0)(10 9.0 12.0 0.0)(10 9.0 -3.55271e-015 0.0)
  (97 . 0)(92 . 7)(72 . 0)(73 . 1)(93 . 4)(10 37.5 2.0 0.0)(10 37.5 12.0 0.0)(10 30.5 12.0 0.0)(10 30.5 2.0 0.0)
  (97 . 0)(75 . 0)(76 . 1)(52 . 0.0)(41 . 5.0)(77 . 0)(78 . 1)(53 . 0.785398)(43 . 0.0)(44 . -3.55271e-015)(45 . -0.441942)(46 . 0.441942)(79 . 0)(47 . 0.0642946)
  (98 . 4)(10 -36.0858 3.41421 0.0)(10 -18.0858 3.41421 0.0)(10 10.4142 1.41421 0.0)(10 31.9142 3.41421 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 3) (10 -37.5 12.0 0.0) (11 37.5 12.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 3) (10 14.25 0.0 0.0) (11 -14.25 0.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 1) (10 0.0 22.0 0.0) (11 0.0 -10.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 1) (10 -25.0 17.0 0.0) (11 -25.0 -5.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 3) (10 -14.25 2.0 0.0) (11 -37.5 2.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 3) (10 -30.5 12.0 0.0) (11 -30.5 2.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 3) (10 -19.5 12.0 0.0) (11 -19.5 2.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 3) (10 -14.25 0.0 0.0) (11 -14.25 2.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 3) (10 -9.0 12.0 0.0) (11 -9.0 0.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 1) (10 25.0 17.0 0.0) (11 25.0 -5.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 3) (10 37.5 2.0 0.0) (11 14.25 2.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 3) (10 19.5 12.0 0.0) (11 19.5 2.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 3) (10 9.0 12.0 0.0) (11 9.0 0.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 3) (10 14.25 2.0 0.0) (11 14.25 0.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 3) (10 30.5 12.0 0.0) (11 30.5 2.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 3) (10 -37.5 2.0 0.0) (11 -37.5 12.0 0.0)))
  (entmakex '((0 . "LINE") (67 . 0) (8 . "aicr317") (62 . 3) (10 37.5 12.0 0.0) (11 37.5 2.0 0.0)))
  )
) ; end eMaker

(defun c:test(/ pt)
    (defun GroupMove (objects p1 p2)
      (setq p1 (vlax-3D-point p1)
            p2 (vlax-3D-point p2))
      (mapcar(function(lambda(x)
        (vl-catch-all-apply 'vla-move (list x p1 p2))))
       Objects)
  )
  (if (setq pt (getpoint "\nPick point."))
    (GroupMove (mapcar 'vlax-ename->vla-object (emake)) '(0 0 0) pt)
  )
  (princ)
)
« Last Edit: March 12, 2010, 01:33:09 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.