注意:(setq NUMPT 1000)此句可修改精度。- ;from 明经通道(defun C:wsa (/ HOLDECHO OS SSS NUMPT N
- ED ED1 PTST PTEND 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 "
- Please pick the spline: ")
- (setq SSS (ssget '((0 . "spline"))))
- (if SSS
- (progn
- (initget (+ 1 2 4))
- (setq NUMPT 1000);;精度
- (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)
- )
|