TrueTable(破解) .
本帖最后由 429014673 于 2021-4-12 11:12 编辑TrueTable(破解),niubi 威武霸气。。牛逼啊 威武霸气,牛逼啊 本帖最后由 作者 于 2010-6-5 7:24:38 编辑 <br /><br /> <font face="Verdana">(defun c:q2()<br/> (setq var1 (getvar "osmode")<br/> var2 (getvar "dimassoc" ))<br/> (setvar "cmdecho" 0 )(setvar "osmode" 0)(setvar "dimassoc" 2)<br/> di (getreal":\nInput The Distance Between The Object And Dimension Line...")<br/> n (1- (sslength sg))<br/> )<br/> (while (setq sn (ssname sg n)<br/> ent (entget sn)<br/> )<br/> (cond ((= (cdr(assoc 0 ent)) "LINE") (diml))<br/> ((= (cdr(assoc 0 ent)) "ARC" ) (progn(dimr)(dimarc)))<br/> ((= (cdr(assoc 0 ent)) "POLYLINE" ) (dimsp sn di))<br/> )<br/> (setq n (1- n))<br/> )<br/> .........</font> 本帖最后由 作者 于 2010-6-5 7:24:15 编辑 <br /><br /> <p>再放一条</p>
<p><font face="Verdana">查找手動修改過的尺寸(RF)</font></p>
<p><font face="Verdana"> ;-----------------------------------------------------------------<br/> (defun c:RF ( ) ;Real Find,用于查找客戶原圖中手動修改過的尺寸<br/> (COMMAND "UCS" "W")<br/> (princ "查找手動修改過的尺寸")<br/> (SETQ COUNTOR 0)<br/> (SETQ DIMSTRING "here")<br/> (PROMPT "\n指示查找區域(確認對象不是一個塊!):")<br/> (SETVAR "OSMODE" 0)(SETVAR "ORTHOMODE" 0)<br/> (SETQ ENTGRP (SSGET))<br/> (SETQ COUNT 0) <br/> .........</font></p> 剖視&放大(CCS)
--------------------------------------------------------------
(defun c:ccs (/ sym ssy sc snum systr scstr txtpnt numstr n cnt i txtlst oldtxt oldlay ent scpnt diment dimn measur
newtxt prec dimtyp
)
(setvar "cmdecho" 0)
(grtext -1 "該程序是用以將剖視圖(或放大圖)的尺寸自動從默認值變成實測值,再放大它並插入標示.")
(setq ssy (getstring "\nThe section symbol is:"))
(setq systr nil
scstr nil
numstr nil
) ;_ 結束setq
;;If no section symbol,then just make the measurement of the dimension.
(IF (/= ssy "")
(progn
;;(initget 128 "Detail Section")
(setq sym (getstring "\n是剖視圖還是放大圖?Detail/<Section>:"))
(if (or (= sym "") (= sym "s")) ;presume it as section view
(setq systr (strcat "SECTION " ssy "-" ssy)
systr (strcase systr) ;|insure the input cha. is uppercase.|;
) ;_ 結束setq
(setq systr (strcat "DETAIL " ssy)
systr (strcase systr)
) ;_ 結束setq
) ;_ 結束if
(setq sc (getstring "\nThe section scale?(needed to be integers)"))
;| access the number of places to be scaled.|;
(setq snum (getstring "\nHow many places?(needed to be integers)"))
(if (> (atoi snum) 1)
(setq numstr (strcat snum "PLS")
numstr (strcase numstr)
) ;_ 結束setq
) ;_if just 1 place,not display it.
) ;_ 結束progn
) ;_ 結束IF
(grtext -1 "Please select the dimension object...")
(setq ent (ssget))
(setq diment (ssget "p" '((0 . "dimension")))
n (sslength diment)
) ;_ 結束setq
(princ (strcat "\n*** Total " (itoa n) " dimensions to be selected. ***"))
(setq cnt 0
i 0
) ;_reset countor and list NO.
(while (PROGN (grtext -1 "OK.Modifying the dimension...")
(< i n)
) ;逐一搜索標注實體.
(setq dimn (entget (ssname diment i))) ;取得實體.
;;;->(setq dimn (entget (car (entsel)))) ;取得實體數據表.
(setq oldtxt (cdr (assoc 1 dimn))
dimtyp (cdr (assoc 100 (reverse dimn)))
) ;_ 結束setq
(if (and (or (wcmatch oldtxt "*<>*") (= oldtxt ""))
(wcmatch dimtyp "~*Angular*")
) ;_ 結束and
;|只有是非角度尺寸,才用實測值代替默認值. |;
(progn
(setq measur (C42 dimn) ;|***調用函數c42(ent).|;
prec (getvar "dimdec")
measur (rtos measur 2 prec) ;|將測量值從實數變成字串|;
) ;_ 結束setq
(cond ((wcmatch dimtyp "*Diametric*") (setq measur (strcat "%%c" measur)))
; _若是直徑,則在數字前加直徑符號"%%c"
((wcmatch dimtyp "*Radial*") (setq measur (strcat "R" measur))) ;_若是半徑,則在數字前加半徑符號R.
) ;_ 結束cond
(if (wcmatch oldtxt "*<>*")
(setq newtxt (subst_str measur "<>" oldtxt)) ;|只替代默認值部分.***調用函數subst_str(newstr oldstr str)|;
(setq newtxt measur)
) ;_ 結束if
(setq dimn (subst (cons 1 newtxt) (cons 1 oldtxt) dimn))
(entmod dimn)
(setq cnt (1+ cnt))
) ;_ 結束progn
) ;_ 結束if
(setq i (1+ i)) ;search the next dimension.
) ;_ 結束while
(princ (strcat "\n*** Just " (itoa cnt) " dimensions modified! ***"))
;;if the scale is 1:1,not to scale it.
(if (/= sc "")
(if (> (atoi sc) 1)
(progn (setq scpnt (getpoint "\nInput the scale center point:"))
(command "._scale" ent "" scpnt (atof sc))
(setq scstr (strcat "SCALE " sc ":1") ;_ if it's 1:1(no input),not to display it
scstr (strcase scstr)
) ;_ 結束setq
) ;_ 結束progn
) ;_ 結束if
) ;_ 結束IF
(if (or systr scstr numstr)
(progn
(setq txtpnt (getpoint "\nWhere to place the note?"))
(setq oldlay (getvar "clayer"))
(if (tblsearch "layer" "mark")
(setvar "clayer" "mark")
) ;_ 結束IF
(command "._text" "s" "standard" "j" "mc" txtpnt (* 2.5 (getvar "dimscale")) "0" systr "")
(if scstr
(command "._text" "" scstr)
) ;_ 結束if
(if numstr
(command "._text" "" numstr)
) ;_ 結束if
;(command)
(setvar "clayer" oldlay)
) ;_ 結束PROGN
) ;_ 結束IF
(setvar "cmdecho" 1)
(grtext)
(princ)
) ;_ 結束defun
;;;---------SUBPROGRAMM---------------
;;;This pro. is to make the linear dimension's measurement.
(defun c42 (ent / p1x p1y p2x p2y dy v ang dimtyp dx p1 p2 dimtyp)
(setq dimtyp (cdr (assoc 70 ent))
dimtyp (logand dimtyp 7)
) ;_ 結束setq
(cond
;;aligned&rotateddimension
((= dimtyp 0)
(progn
(setq p1(assoc 13 ent)
p2(assoc 14 ent)
p1x (nth 1 p1)
p1y (nth 2 p1)
p2x (nth 1 p2)
p2y (nth 2 p2)
dx(abs (- p1x p2x))
dy(abs (- p1y p2y))
ang (cdr (assoc 50 ent))
) ;_ 結束setq
(if (= ang 0)
(setq v dx)
(setq v dy)
) ;_ 結束if
) ;_ 結束progn
) ;_case 1
;;aligneddimension
((= dimtyp 1)
(setq p1 (assoc 13 ent)
p2 (assoc 14 ent)
v(distance (cdr p1) (cdr p2))
) ;_ 結束setq
) ;_case 2
;;radialdimension & diametricdimension
((or (= dimtyp 4) (= dimtyp 3))
(setq p1 (assoc 10 ent)
p2 (assoc 15 ent)
v(distance (cdr p1) (cdr p2)) ;取得數值v作為函數值.
) ;_ 結束setq
) ;_case 3
) ;_ 結束cond
) ;_ 結束defun
;;;;-SUBROTINE 2------
;;;This pro. is to substitute a new string for the old string in the source string.
(defun subst_str (newstr oldstr str / i k k1 k2 n tmpstr stre strf)
(setq k1 (strlen str)
k2 (strlen oldstr)
k(1+ (- k1 k2))
i1
nnil
) ;_ 結束setq
(while (<= i k)
(setq tmpstr (substr str i k2))
(if (= tmpstr oldstr)
(progn
(setq n i
i (1+ k)
) ;set the loop-off condition to end the loop
............
本帖最后由 作者 于 2010-6-5 7:25:35 编辑 <br /><br /> <font face="Verdana">圖元縮放,尺寸不變(RS)<br/>;-----------------------------------------------------------------<br/> (defun c:RS ( ) ;Real Scale,用于畫剖視圖縮放圖元時,維持標注尺寸不變<br/> (princ "圖元縮放,尺寸不變")<br/> (PROMPT "\n指示縮放區域:")<br/> (SETVAR "OSMODE" 0)(SETVAR "ORTHOMODE" 0)<br/> (setq scale (ssget ))<br/> (SETQ ENTGRP scale)<br/> (SETQ COUNT 0) <br/> (REPEAT (SSLENGTH ENTGRP)<br/> (SETQ ENTNAME (SSNAME ENTGRP COUNT))<br/> (SETQ ENT (ENTGET ENTNAME))<br/> (IF (AND (= (CDR (ASSOC 0 ENT)) "DIMENSION") <br/> (/= (cdr (ASSOC 1 ENT)) "")) <br/> (PROGN (PRINC "\n對象中不能有修改過的尺寸!") (EXIT)))<br/> (IF (and(= (CDR (ASSOC 0 ENT)) "DIMENSION") ;AlignedDimension<br/> (= (cdr (nth 19 ent)) "AcDbAlignedDimension")) <br/> (PROGN<br/> (setq P1 (assoc 13 ENT)) <br/> (setq P2 (assoc 14 ENT))<br/> (setq P1x (nth 1 P1)) <br/> (setq P1y (nth 2 P1)) <br/> (setq P2x (nth 1 P2)) <br/> (setq P2y (nth 2 P2)) <br/> (setq DX (ABS(- P1x P2x))) <br/> (setq DY (ABS(- P1y P2y))) <br/> (setq SS (assoc 10 ENT)) <br/> (setq TT (assoc 11 ENT)) <br/> (setq SSx (nth 1 SS)) <br/> (setq TTx (nth 1 TT)) <br/> (setq SSy (nth 2 SS)) <br/> (setq TTy (nth 2 TT)) <br/> (IF (= SSx TTx) <br/> (setq V Dy))<br/> (IF (and(/= SSx TTx)(= SSy TTy)) <br/> (setq V Dx)) ;取得數值V1<br/> (IF (and(/= SSx TTx)(/= SSy TTy)) <br/> (setq V (distance (cdr p1) (cdr p2)))) <br/> (SETQ W (rtos V 2 2))<br/> (SETQ ENT (SUBST (CONS 1 W) (ASSOC 1 ENT) ENT)) ;MODIFY<br/> (ENTMOD ENT) ;UPDATE<br/> )<br/> )<br/> (IF (and(= (CDR (ASSOC 0 ENT)) "DIMENSION") ;RadialDimension<br/> (= (cdr (nth 19 ent)) "AcDbRadialDimension"))<br/> (PROGN<br/> (setq P1 (assoc 10 ENT)) <br/> (setq P2 (assoc 15 ENT))<br/> (setq V (distance (cdr p1) (cdr p2))) ;取得數值V1 <br/> (SETQ W (strcat "R" (rtos V 2 2)))<br/> (SETQ ENT (SUBST (CONS 1 W) (ASSOC 1 ENT) ENT)) ;MODIFY<br/> (ENTMOD ENT) ;UPDATE<br/> )<br/> )<br/> (SETQ COUNT (1+ COUNT))<br/>..........</font> <p><font face="微软雅黑" color="#800080" size="6"><u><strong>..........</strong></u></font></p> <p> </p> <p><font face="Verdana"><font face="Verdana">标注弧长、半径、线段</font></font></p>
<p><font face="Verdana">(defun c:q2()<br/> (setq var1 (getvar "osmode")<br/> var2 (getvar "dimassoc" ))<br/> (setvar "cmdecho" 0 )(setvar "osmode" 0)(setvar "dimassoc" 2)<br/> (princ "\nChoose Objects You Want To Auto Make Dimensions...")<br/> (setq sg (ssget) <br/> di (getreal":\nInput The Distance Between The Object And Dimension Line...")<br/> n (1- (sslength sg))<br/> )<br/> (while (setq sn (ssname sg n)<br/> ent (entget sn)<br/> )<br/> (cond ((= (cdr(assoc 0 ent)) "LINE") (diml))<br/> ((= (cdr(assoc 0 ent)) "ARC" ) (progn(dimr)(dimarc)))<br/> ((= (cdr(assoc 0 ent)) "POLYLINE" ) (dimsp sn di))<br/> )<br/> (setq n (1- n))<br/> )<br/> (command)<br/> (setvar "cmdecho" 1)<br/> (setvar "dimassoc" var2 )<br/> (setvar "osmode" var1)<br/> (princ"\nByoend Ever You Thinking...") <br/> )</font></p> <font face="Verdana">(defun c:RF ( ) ;Real Find,用于查找客戶原圖中手動修改過的尺寸<br/> (COMMAND "UCS" "W")<br/> (princ "查找手動修改過的尺寸")<br/> (SETQ COUNTOR 0)<br/> (SETQ DIMSTRING "here")<br/> (PROMPT "\n指示查找區域(確認對象不是一個塊!):")<br/> (SETVAR "OSMODE" 0)(SETVAR "ORTHOMODE" 0)<br/> (SETQ ENTGRP (SSGET))<br/> (SETQ COUNT 0) <br/> (REPEAT (SSLENGTH ENTGRP)<br/> (SETQ ENTNAME (SSNAME ENTGRP COUNT))<br/> (SETQ ENT (ENTGET ENTNAME))<br/> (IF (AND (= (CDR (ASSOC 0 ENT)) "DIMENSION") <br/> (/= (cdr (ASSOC 1 ENT)) "")) <br/> (PROGN<br/> (SETQ TXTPT (CDR (ASSOC 11 ENT))) <br/> (SETQ OLDLAYER (GETVAR "CLAYER"))<br/> (COMMAND "-LAYER" "S" "MARK" "") <br/> (COMMAND "_.TEXT" "J" "C" TXTPT (* 5.0 (GETVAR "DIMSCALE")) "" (strcase DIMSTRING t))<br/> (COMMAND "-LAYER" "S" OLDLAYER "")<br/> (SETQ COUNTOR (1+ COUNTOR)) <br/> )<br/> )<br/> (SETQ COUNT (1+ COUNT))<br/> )<br/> (COMMAND "_UCS" "P")<br/> (PRINC "\n OK! 找到 ")(PRINC COUNTOR) (PRINC " 個手動修改過的尺寸!")<br/> (PRINC)<br/>)</font> <p><font face="Verdana">(defun c:ccs (/ sym ssy sc snum systr scstr txtpnt numstr n cnt i txtlst oldtxt oldlay ent scpnt diment dimn measur<br/> newtxt prec dimtyp<br/> )<br/> (setvar "cmdecho" 0)<br/> (grtext -1 "該程序是用以將剖視圖(或放大圖)的尺寸自動從默認值變成實測值,再放大它並插入標示.")<br/> (setq ssy (getstring "\nThe section symbol is:"))<br/> (setq systr nil<br/> scstr nil<br/> numstr nil<br/> ) ;_ 結束setq<br/> ;;If no section symbol,then just make the measurement of the dimension.<br/> (IF (/= ssy "")<br/> (progn<br/> ;;(initget 128 "Detail Section")<br/> (setq sym (getstring "\n是剖視圖還是放大圖?Detail/<Section>:"))<br/> (if (or (= sym "") (= sym "s")) ;presume it as section view<br/> (setq systr (strcat "SECTION " ssy "-" ssy)<br/> systr (strcase systr) ;|insure the input cha. is uppercase.|;<br/> ) ;_ 結束setq<br/> (setq systr (strcat "DETAIL " ssy)<br/> systr (strcase systr)<br/> ) ;_ 結束setq<br/> ) ;_ 結束if<br/> (setq sc (getstring "\nThe section scale?(needed to be integers)"))<br/> ;| access the number of places to be scaled.|;<br/> (setq snum (getstring "\nHow many places?(needed to be integers)"))<br/> (if (> (atoi snum) 1)<br/> (setq numstr (strcat snum "PLS")<br/> numstr (strcase numstr)<br/> ) ;_ 結束setq<br/> ) ;_if just 1 place,not display it.<br/> ) ;_ 結束progn<br/> ) ;_ 結束IF<br/> (grtext -1 "Please select the dimension object...")<br/> (setq ent (ssget))<br/> (setq diment (ssget "p" '((0 . "dimension")))<br/> n (sslength diment)<br/> ) ;_ 結束setq<br/> (princ (strcat "\n*** Total " (itoa n) " dimensions to be selected. ***"))<br/> (setq cnt 0<br/> i 0<br/> ) ;_reset countor and list NO.<br/> (while (PROGN (grtext -1 "OK.Modifying the dimension...")<br/> (< i n)<br/> ) ;逐一搜索標注實體.<br/> (setq dimn (entget (ssname diment i))) ;取得實體.<br/>;;;->(setq dimn (entget (car (entsel)))) ;取得實體數據表.<br/> (setq oldtxt (cdr (assoc 1 dimn))<br/> dimtyp (cdr (assoc 100 (reverse dimn)))<br/> ) ;_ 結束setq<br/> (if (and (or (wcmatch oldtxt "*<>*") (= oldtxt ""))<br/> (wcmatch dimtyp "~*Angular*")<br/> ) ;_ 結束and<br/> ;|只有是非角度尺寸,才用實測值代替默認值. |;<br/> (progn<br/> (setq measur (C42 dimn) ;|***調用函數c42(ent).|;<br/> prec (getvar "dimdec")<br/> measur (rtos measur 2 prec) ;|將測量值從實數變成字串|;<br/> ) ;_ 結束setq<br/> (cond ((wcmatch dimtyp "*Diametric*") (setq measur (strcat "%%c" measur)))<br/> ; _若是直徑,則在數字前加直徑符號"%%c"<br/> ((wcmatch dimtyp "*Radial*") (setq measur (strcat "R" measur))) ;_若是半徑,則在數字前加半徑符號R.<br/> ) ;_ 結束cond<br/> (if (wcmatch oldtxt "*<>*")<br/> (setq newtxt (subst_str measur "<>" oldtxt)) ;|只替代默認值部分.***調用函數subst_str(newstr oldstr str)|;<br/> (setq newtxt measur)<br/> ) ;_ 結束if<br/> (setq dimn (subst (cons 1 newtxt) (cons 1 oldtxt) dimn))<br/> (entmod dimn)<br/> (setq cnt (1+ cnt))<br/> ) ;_ 結束progn<br/> ) ;_ 結束if<br/> (setq i (1+ i)) ;search the next dimension.<br/> ) ;_ 結束while<br/> (princ (strcat "\n*** Just " (itoa cnt) " dimensions modified! ***"))<br/> ;;if the scale is 1:1,not to scale it.<br/> (if (/= sc "")<br/> (if (> (atoi sc) 1)<br/> (progn (setq scpnt (getpoint "\nInput the scale center point:"))<br/> (command "._scale" ent "" scpnt (atof sc))<br/> (setq scstr (strcat "SCALE " sc ":1") ;_ if it's 1:1(no input),not to display it<br/> scstr (strcase scstr)<br/> ) ;_ 結束setq<br/> ) ;_ 結束progn<br/> ) ;_ 結束if<br/> ) ;_ 結束IF<br/> (if (or systr scstr numstr)<br/> (progn<br/> (setq txtpnt (getpoint "\nWhere to place the note?"))<br/> (setq oldlay (getvar "clayer"))<br/> (if (tblsearch "layer" "mark")<br/> (setvar "clayer" "mark")<br/> ) ;_ 結束IF<br/> (command "._text" "s" "standard" "j" "mc" txtpnt (* 2.5 (getvar "dimscale")) "0" systr "")<br/> (if scstr<br/> (command "._text" "" scstr)<br/> ) ;_ 結束if<br/> (if numstr<br/> (command "._text" "" numstr)<br/> ) ;_ 結束if<br/> ;(command)<br/> (setvar "clayer" oldlay)<br/> ) ;_ 結束PROGN<br/> ) ;_ 結束IF<br/> (setvar "cmdecho" 1)<br/> (grtext)<br/> (princ)<br/>) ;_ 結束defun<br/>;;;---------SUBPROGRAMM---------------<br/>;;;This pro. is to make the linear dimension's measurement.<br/>(defun c42 (ent / p1x p1y p2x p2y dy v ang dimtyp dx p1 p2 dimtyp)<br/> (setq dimtyp (cdr (assoc 70 ent))<br/> dimtyp (logand dimtyp 7)<br/> ) ;_ 結束setq<br/> (cond<br/> ;;aligned&rotateddimension<br/> ((= dimtyp 0)<br/> (progn<br/> (setq p1 (assoc 13 ent)<br/> p2 (assoc 14 ent)<br/> p1x (nth 1 p1)<br/> p1y (nth 2 p1)<br/> p2x (nth 1 p2)<br/> p2y (nth 2 p2)<br/> dx (abs (- p1x p2x))<br/> dy (abs (- p1y p2y))<br/> ang (cdr (assoc 50 ent))<br/> ) ;_ 結束setq<br/> (if (= ang 0)<br/> (setq v dx)<br/> (setq v dy)<br/> ) ;_ 結束if<br/> ) ;_ 結束progn<br/> ) ;_case 1<br/> ;;aligneddimension<br/> ((= dimtyp 1)<br/> (setq p1 (assoc 13 ent)<br/> p2 (assoc 14 ent)<br/> v (distance (cdr p1) (cdr p2))<br/> ) ;_ 結束setq<br/> ) ;_case 2<br/> ;;radialdimension & diametricdimension<br/> ((or (= dimtyp 4) (= dimtyp 3))<br/> (setq p1 (assoc 10 ent)<br/> p2 (assoc 15 ent)<br/> v (distance (cdr p1) (cdr p2)) ;取得數值v作為函數值. <br/> ) ;_ 結束setq<br/> ) ;_case 3<br/> ) ;_ 結束cond<br/>) ;_ 結束defun</font></p>
<p><font face="Verdana">;;;;-SUBROTINE 2------<br/>;;;This pro. is to substitute a new string for the old string in the source string.<br/>(defun subst_str (newstr oldstr str / i k k1 k2 n tmpstr stre strf)<br/> (setq k1 (strlen str)<br/> k2 (strlen oldstr)<br/> k (1+ (- k1 k2))<br/> i 1<br/> n nil<br/> ) ;_ 結束setq<br/> (while (<= i k)<br/> (setq tmpstr (substr str i k2))<br/> (if (= tmpstr oldstr)<br/> (progn<br/> (setq n i<br/> i (1+ k)<br/> ) ;set the loop-off condition to end the loop<br/> ) ;_ 結束progn<br/> (setq i (1+ i))<br/> ) ;_ 結束if<br/> ) ;_ 結束while<br/> (setq k1 (1- n)<br/> k2 (+ k2 n)<br/> strf (substr str 1 k1)<br/> stre (substr str k2)<br/> ) ;_ 結束setq<br/> (setq str (strcat strf newstr stre))<br/>) ;_ 結束defun<br/>;;;~~~~~~~~~~end of CCS~~~~~~~~~~~~</font></p>