您好,亲爱的大师们,
我的名字叫肖恩,我对Lisp编程非常陌生。现在已经两周了,我开始对自己的代码无法正常工作感到沮丧。第一件事,我能够使lisp计算块被选中,我很高兴它。然后我决定也命名被选中的块。我知道“BCOUNT”命令,但AutoCAD的旧版本还没有BCOUNT命令(AutoCAD 2010)。我真的很想学习LISP,但每次都被卡住了。请帮我输入这个代码。我去过很多网站,仍然不知道下一步该做什么。提前感谢各位大师。
这是我的密码
- (defun c:BL (/ ssblks ssblks2 en ctr blk ent enlist) ;define funcntion
- (vl-load-com)
-
- (if (setq ssblks (ssget))) ;|selects blocks|;
- (prog
-
- (setq blk (sslength ssblks)) ;|get number of blocks|;
- (setq ct 0) ;|set counter to zero|;
- (repeat (ssget ssblks2)) ;|repeat the selecting blocks|;
- (ssadd (ssname ssblks2 ct) ssblks) ;|add ssname froms ssblks selection|;
- (setq en (car(entsel ssblks2)) ;|gets entity from ssblks2|;
- (setq enlist(cdr (assoc 2 (entget en)))) ;|get the dxf group codes of the entity;|
- (alert (strcat "\n There are " (itoa blk) " blocks and these are: " (vla-get-effectivename (vlax-ename->vla-object enlist)) )) ;|display result|;
- ) ;end prog
- (princ)
- ) ;end if
- (princ)
- );end defun
- (princ)
|