看板 Cad_Cae 關於我們 聯絡資訊
因為AutoCAD沒有反轉聚合線的指令,故為經典Lisp新手的入門習題,以下是我的解答: =============================================================== ;_Reverse a polyline extreme simply, written by Suny 2009.06.01 (DEFUN c:revpl(/ ent head rvpl aLs aIt nls n cp np n40 n41 n42) (SETQ ent(ENTGET(CAR(ENTSEL"Pick a polyline to reverse:"))) head(REVERSE(MEMBER(ASSOC 39 ent)(REVERSE ent))) rvpl '() aLs '() n 0 ) (FOREACH aIt (MEMBER(ASSOC 10 ent)ent) (SETQ aLs(APPEND aLs(LIST aIt))n(1+ n)) (IF(=(REM n 4)0)(SETQ rvpl(APPEND rvpl(list aLs))aLs'()))) (SETQ rvpl(REVERSE rvpl) rvpl(append rvpl(list(CONS(CAR(LAST rvpl))(cdar rvpl)))) nls'() n 0 ) (WHILE(<(1+ n)(LENGTH rvpl)) (SETQ cp(NTH n rvpl) np(NTH(1+ n)rvpl) n40(CONS 40( CDR(ASSOC 41 np)) ) n41(CONS 41( CDR(ASSOC 40 np)) ) n42(CONS 42(-(CDR(ASSOC 42 np)))) nls(APPEND nls(LIST(CONS(CAR cp)(list n40 n41 n42)))) n(1+ n)) ) (ENTMOD(APPEND head(APPLY'APPEND nls)))(PRINC) );_eo revpl -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.169.202.80
ftc693:幫推 大大你太認真了.....我最近都顧著聯誼 哀 輸了 06/04 10:17
suny999:聯誼真好~~^^ 06/04 22:44