Author Topic: Circular cutting problem  (Read 165 times)

0 Members and 1 Guest are viewing this topic.

myloveflyer

  • Newt
  • Posts: 128
Circular cutting problem
« on: August 13, 2019, 04:02:10 AM »
After running the program recently, the circle will be lost and the cutting will not be complete. See the attached figure!After running the program recently, the circle will be lost and the cutting will not be complete. See the attached figure! Which friend can help me solve it?
Code: [Select]
(defun c:test(/ wj-s wjq-s wjg-s)
(start-dwg)
(wj1)
(wj2)
(princ)
(princ)
)
(defun start-dwg()
(setvar "osmode" 0)
(setvar "blipmode" 0)
(setvar "cmdecho"  0)
)
(defun wj1()
(setq wj-con1   (getpoint "\nF_Point:")
      wj-con2   (getcorner wj-con1 "\nS_Point:")
);end of wj-con.
(setq wj-s      (ssget "w" wj-con1 wj-con2 '((0 . "CIRCLE")))
      wj-sn     (sslength  wj-s)
      wjq-index  0
);end of setq
(command "change" wj-s "" "p" "c" "3" "")
(repeat wj-sn
                (setq wjq-s   (ssname wj-s wjq-index)
      wjq-e   (entget(ssname wj-s wjq-index))
      wjq-c   (cdr(assoc 10 wjq-e))
      wjq-r   (cdr(assoc 40 wjq-e))      
      wjq-e   (subst(cons 40 60)(assoc 40 wjq-e)wjq-e)
                )
                (entmod wjq-e)
                (command "extend" wjq-s "" "f")
(setq f-n 0)
                (repeat 180
                (command (polar wjq-c(/ (* 2 f-n pi) 180)(+ wjq-r 300)))
                (setq f-n (+ f-n 1))
                )
                (command "" "")
                (setq wjq-index (+ wjq-index 1))
);end of repeat
);end of wj1
(defun wj2()
(setq  wjg-s      (ssget "w" wj-con1 wj-con2 '((0 . "LINE")))
       wjg-n      (sslength wjg-s)
       wjg-index  0
);end of setq-g.
(repeat wjg-n
(setq   wjg-s1      (ssname wjg-s wjg-index)
        wjg-e       (entget wjg-s1)
        wjg-e-s     (cdr(assoc 10 wjg-e))
wjg-e-e     (cdr(assoc 11 wjg-e))
wjg-len     (distance wjg-e-s wjg-e-e)
wjg-len-n1  (+ 120.0 wjg-len)
wjg-len-n2  (- wjg-len 74.0)
wjg-e-s-x   (car  wjg-e-s)
wjg-e-s-y   (cadr wjg-e-s)
wjg-e-e-x   (car  wjg-e-e)
wjg-e-e-y   (cadr wjg-e-e)
wjg-mid     (list (/(+ wjg-e-s-x wjg-e-e-x)2.0) (/(+ wjg-e-s-y wjg-e-e-y)2.0))
wjg-s-a     (angle wjg-e-e wjg-e-s)
        wjg-e-a     (angle wjg-e-s wjg-e-e)
        wjg-a-str1  (strcat "@-60<"(rtos(/(* 180 wjg-e-a)pi)2))
wjg-a-str2  (strcat "@60<"(rtos(/(* 180 wjg-e-a)pi)2))
wjg-of1-st  (strcat "@10<90")
wjg-of2-st  (strcat "@10<-90")
);end of setq
(command "change" wjg-s1 "" "p" "c" "7" "")
(command "copy" wjg-s1 "" "0,0" "@")
(command "scale" "p" "" wjg-mid "r" wjg-len wjg-len-n1)
(command "change" "p" "" "p" "c" "8" "")
(command "change" "p" "" "p" "lt" "ACAD_ISO04W100" "S" "30" "")
(command "scale" "l" "" wjg-mid "r" wjg-len wjg-len-n2)
(command "offset" "24" wjg-mid wjg-of1-st "")
(command "erase" "P" "")
(command "mirror" "l" "" wjg-e-s wjg-e-e "")
(command "line" wjg-e-s wjg-a-str1 "")
(setq fz-line       (entlast)
      fz-line-e     (cdr(assoc 11(entget fz-line)))
)
(command "erase" "l" "")
(command "insert" "d:/Test/120-GJ" fz-line-e "" "" (rtos(/(* 180 wjg-e-a)pi)2))
(command "explode" "l")
(command "insert" "d:/Test/120_Line" fz-line-e "" "" (rtos(/(* 180 wjg-e-a)pi)2))
(command "explode" "l")
(setq pm-li         (entlast)
      pm-tr1        (strcat "@59<"(rtos(+ 2.0(/(* 180 wjg-e-a)pi))2))
      pm-tr2        (strcat "@61<"(rtos(+ 2.0(/(* 180 wjg-e-a)pi))2))
);end of trim's cond
(command "trim" pm-li "" "f" pm-tr1 pm-tr2 "" "")
(command "line" wjg-e-e wjg-a-str2 "")
(setq fz-line       (entlast)
      fz-line-e     (cdr(assoc 11(entget fz-line)))
)
(command "erase" "l" "")
(command "insert" "d:/Test/120-GJ" fz-line-e "" "" (rtos(/(* 180 wjg-s-a)pi)2))
(command "explode" "l")
(command "insert" "d:/Test/120_Line" fz-line-e "" "" (rtos(/(* 180 wjg-s-a)pi)2))
(command "explode" "l")
(setq pm-li         (entlast)
      pm-tr1        (strcat "@59<"(rtos(+ 2.0(/(* 180 wjg-s-a)pi))2))
      pm-tr2        (strcat "@61<"(rtos(+ 2.0(/(* 180 wjg-s-a)pi))2))
)
(command "trim" pm-li "" "f" pm-tr1 pm-tr2 "" "")
(setq  wjg-index  (1+ wjg-index))
);end of repeat
);end of wj2
Never give up !