BlackBox 发表于 2022-7-6 09:27:09

我在想这样一个框架:
 
10
 
:眨眼:

pman860507 发表于 2022-7-6 09:31:49

谢谢李,我还意识到,如果我要使用lambda,我也可以提供首字母(sssdd)作为参数。

BlackBox 发表于 2022-7-6 09:33:07

我还没看你贴什么还吃我的鸡蛋,我想说谢谢李。
 
我访问了你的网页,将DCL的屏幕点合并到我的命令中,效果很好。

pman860507 发表于 2022-7-6 09:38:00

BlackBox 发表于 2022-7-6 09:38:50

 
You are correct that lambda is an anonymous function, but that is not important. TO remove confusion, let's just use this:
 
Edit: Guess it would help if I post that revised code, huh!? LoL
 

(defun c:FOO(/ ss e typ eData) (vl-load-com) (if (setq ss (ssget "_:L"                     '((-4 . ""))))   (progn   (setq e (entlast))   (command "._copy" ss "" '(0 0 0) '(0 0 0))   (while (/= nil (setq e (entnext e)))       (cond         ((= "INSERT"             (setq typ (cdr (assoc 0 (setq eData (entget e))))))          ;;origin, i.e., no displacement) once... instead of multiple times, once for each entity. That's all.</p> 
 
This I find to be strange. The preceding period, and underscore "._" simply mean that the English version of the core AutoCAD command are to be used, as any AutoCAD command can be redefined. I do not yet have 2012 software installed, or I would test. But I can assure you that that should pose no issue.

pman860507 发表于 2022-7-6 09:44:29

I think i understand it now.
 
where you have
;;
is where you will go the edata and pull out what you need correct?

BlackBox 发表于 2022-7-6 09:44:34

 
Correct. That is where you should include your code, which takes action(s) on that entity type ("INSERT", or "MTEXT,TEXT") respectively.

Lee Mac 发表于 2022-7-6 09:48:52

 
A quick FYI, SelectionSets, like Entity Names and VLA-Objects, act like 'pointers' in that you don't have to reassign the variable when the data is manipulated, e.g.
 

(defun c:foo ( / en s1 s2 )   (if (setq s1 (ssget "_:L"))       (progn         (setq en (entlast) s2 (ssadd))         (command "_.copy" s1 "" "_non" '(0. 0. 0.) "_non" '(0. 0. 0.))         (while (setq en (entnext en)) (ssadd en s2))         (sssetfirst nil s2)       )   )   (princ))
 
:wink:

BlackBox 发表于 2022-7-6 09:52:35

Thanks Lee, I also realized that if I was going to use lambda, I could also have supplied the initial (sssdd) as an argument.

pman860507 发表于 2022-7-6 09:54:47

I have not looked at what you have posted still eating my eggs, i wanted to say Thanks to Lee Mac.
 
I went to your webpage and incorporated the screenpoint for DCL into my command it works great.
页: 1 [2]
查看完整版本: 复制并替换objec文本