所需Lisp增量值(w
你好我想知道是否有人能帮我。我做了很多动作,其中有一些数字(例如100)。然后我需要复制这个数字,再放一个(101)和下一个102,以此类推。我发现了一个很好用的LISP代码,但唯一的问题是我还需要围绕这个数字的框架。所以我需要自己的块,在增量数内。谢谢你的帮助。 您可以使用“tcircle”(快速工具)命令在多个文本对象周围放置“帧”(矩形)。 谢谢.但现在我需要用的不一样了。我是说喜欢这个节目http://www.eng-tips.com/viewthread.cfm?qid=138436&page=1 ( 您可以附加一个包含文本和框架的样例DWG吗?
一些伪代码怎么样
如果dwg中没有块
生成块,获取用户输入的起始编号
否则获取属性,下一个数字是最高数字+1
endif
获取用户点以插入块
插入块并更新属性
重复插入,直到用户退出 这是我的旧的,希望这是
也为你工作
(defun C:INN (/ gap hg inum ip p1 p2 tb wd)
(setq inum (getint "\n\tEnter a number to start with: "))
(while (setq ip (getpoint "\n\tSpecify text insertion point (Enter to stop): "))
; entmake text
(entmake
(list
'(0 . "TEXT")
'(100 . "AcDbEntity")
'(100 . "AcDbText")
(cons 1 (itoa inum));string
(cons 7 "Standard");style
(cons 8 "0");layer
(cons 62 256);color
(cons 10 ip);insertion point
(cons 11 ip);alignment point
(cons 40 (getvar "dimtxt"));text height - change by suit
(cons 41 1.0);text width
(cons 50 0.0);1.5708 - vertical, 0.0 - horizontal
(cons 51 0.0);oblique angle
'(71 . 0);alignment
'(72 . 1);alignment
'(73 . 2);alignment
)
)
(setq tb (textbox (entget (entlast))))
(setq gap (/ (getvar "dimtxt") 4)
p1 (car tb)
p2 (cadr tb)
hg (abs (- (cadr p1)(cadr p2)))
wd (abs (- (car p1)(car p2)))
p1 (list (- (car ip) (/ wd 2) gap)(- (cadr ip) (/ hg 2) gap))
p2 (list (+ (car ip) (/ wd 2) gap)(+ (cadr ip) (/ hg 2) gap))
)
; entmake frame
(entmake
(list '(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
'(100 . "AcDbPolyline")
'(90 . 4);number of vertices
'(70 . 1);closed flag
(cons 8 "0");layer
(cons 62 2);color (256 - ByLayer)
(cons 10 p1)
(list 10 (car p2) (cadr p1))
(cons 10 p2)
(list 10 (car p1) (cadr p2))
(cons 43 0.0);polyline width
)
)
(setq inum (1+ inum))
)
(prin1)
)
(prompt "\nType INN to execute ...")
(princ)
~'J'~
我希望这能奏效。将在dwg中显示我的区块。。。
662palokartanilmaisinnumero。图纸 >janisa我用这个{Smirnoff}rountines
Num-插入具有增量值的文本
Renum-在维度、文字、多行文字、属性、ATTDEF、ACAD_表格中重新编号文字
TTC-文本到文本的复制。将文字从维度、文字、多行文字、属性、ATTDEF、ACAD_表复制到一个
RENUM命令可以更改尺寸、文字、多行文字、块中的ATTRIB、ATTDEF、ACAD_表格中的编号。
选择块时,需要在属性上指定。
数字LSP
662palokartanilmaisinnumero。图纸 我修改了c:num以按具有单个属性的块进行编号。
无前缀和后缀:
(defun c:atnum (/ oldStart oldEcho oldSize oldBlock temBl *error*)
(defun *error* (msg)
(setvar "CMDECHO" oldEcho)
(princ)
); end *error*
(if(not atnum:Size)(setq atnum:Size 1.0))
(if(not atnum:Num)(setq atnum:Num 1))
(setqoldStart atnum:Num
oldSize atnum:Size
oldEcho(getvar "CMDECHO")
); end setq
(setvar "CMDECHO" 0)
(setq atnum:Num
(getint
(strcat "\nSpecify start number <"(itoa atnum:Num)">: ")))
(if(null atnum:Num)(setq atnum:Num oldStart))
(setq atnum:Size
(getreal
(strcat "\nSpecify block scale <"(rtos atnum:Size)">: ")))
(if(null atnum:Size)(setq atnum:Size oldSize))
(if atnum:Block(setq oldBlock atnum:Block))
(setq temBl
(entsel(strcat "\nSelect block <"
(if atnum:Block atnum:Block "not difined") "> > "))); end setq
(cond
((and atnum:Block(not temBl)(tblsearch "BLOCK" atnum:Block))
(setq atnum:Block oldBlock)
); end condition #1
((= 1(cdr(assoc 66(entget(car temBl)))))
(setq atnum:Block(cdr(assoc 2(entget(car temBl)))))
); end condition #2
(t
(princ "\nBlock not contains attribute! ")
(setq atnum:Block nil)
); end condition #3
); end cond
(if atnum:Block
(progn
(princ "\n>>> Pick insertion point or press Esc to quit <<<\n ")
(while T
(command "-insert" atnum:Block "_s" atnum:Size pause "0"(itoa atnum:Num))
(setq atnum:Num(1+ atnum:Num))
); end while
); end progn
); end if
(princ)
); end of c:atnum
~'J'~
你的程序最适合我使用(带前缀和后缀)。唯一的问题是,代码可以在Autocad 2004(在家中)上正常工作,但不能在我的其他计算机(Autocad 2006)上工作。你知道我能做什么吗? 好啊我将在今天晚上访问AutoCAD 2006,并尝试解决此问题。
页:
[1]
2