以下源码把SPL线转换成圆弧,怎么合并一起?
本帖最后由 qianyi0710 于 2019-10-15 22:44 编辑(defun C:qa(/ HOLDECHO OS SSS NUMPT N
ED ED1 PTSTPTEND SS2 PT1 PT2
PT3 J ENT NNO SS SSL
)
(defun VAL1 (N SS INDEX)
(cdr (assoc N (entget (ssname SS INDEX))))
)
(defun CH_IT (NOS)
(if (assoc NOS ED)
(progn
(if (assoc NOS ENT)
(setq ENT (subst (assoc NOS ED) (assoc NOS ENT) ENT))
(setq ENT (append ENT (list (assoc NOS ED))))
)
(entmod ENT)
)
)
)
(setq HOLDECHO (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command "_.undo" "group")
(setq OS (getvar "osmode"))
(setvar "osmode" 0)
(prompt "\nPlease pick the spline: ")
(setq SSS (ssget '((0 . "spline"))))
(if SSS
(progn
(initget (+ 1 2 4))
(setq NUMPT
(getint
"\nPlease specify the accuracy of conversion: "
)
)
(setq N 0)
(setq SSL (sslength SSS))
(repeat SSL
(prompt (strcat "\r余 " (itoa (- SSL N)) " 个物件 "))
(setq ED1 (ssname SSS N))
(setq ED (entget ED1))
(setq PTST(cdr (assoc 10 ED))
PTEND (cdr (assoc 10 (reverse ED)))
)
(command "_.divide" ED1 (* 2 NUMPT))
(setq SS2 (ssget "p"))
(if (= (logand (cdr (assoc 70 ED)) 1) 1)
(setq J 1)
(setq J 0)
)
(setq PT3 PTST)
(setq SS (ssadd))
(repeat NUMPT
(setq PT2 (VAL1 10 SS2 J))
(if (/= NUMPT (/ (+ J 2) 2))
(setq PT1 (VAL1 10 SS2 (+ 1 J)))
(setq PT1 PTEND)
)
(command "_.arc" PT3 PT2 PT1)
(ssadd (entlast) SS)
(setq PT3 PT1)
(setq J (+ 2 J))
)
(command "_.pedit" (ssname SS 1) "" "j" SS "" "")
(setq ENT (entget (entlast)))
(foreach NNO '(6 8 62 48)
(CH_IT NNO)
)
(command "_.erase" SS2 ED1 "")
(setq N (1+ N))
)
(prompt (strcat "\r完成转换 ")
)
)
(alert "Nothing selected!!")
)
(setvar "osmode" OS)
(command "_.undo" "end")
(setvar "cmdecho" HOLDECHO)
(princ)
)
页:
[1]