CAB Posted December 22, 2008 Posted December 22, 2008 Thanks Lee, you'll get there too. David produces some nice code as well. Quote
Lee Mac Posted December 22, 2008 Posted December 22, 2008 Yeah he does, I like the way he shows his knowledge of the LISP functions - like using (while (not (minusp... instead of (while (> ... 0) Quote
Lee Mac Posted December 22, 2008 Posted December 22, 2008 CAB, I was just analyzing the code you posted for the min, max, average LISP and happened to stumble across this line: (setq lst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) [/code] I have tried experimenting with this line to see what you are trying to achieve, by using the below code and analysing the results of each selection: (defun c:test2 (/ ss) (setq ss (ssget '((0 . "TEXT,MTEXT")))) (listp (mapcar 'cadr (ssnamex ss))) ) ;_ end defun But it seems whatever text I select the result is always T. Which makes me wonder what this line of code is actually used for? Any help or advice would be much appreciated Thanks Lee Quote
CAB Posted December 23, 2008 Posted December 23, 2008 When you use a windowed selection method a sub list is returned with ssnamex like this: (setq ss (ssget '((0 . "TEXT,MTEXT")))) (setq lst (mapcar 'cadr (ssnamex ss))) <Selection set: 84> (<Entity name: 1c93b18> (0 (1788.41 2356.59 0.0231568))) To remove the unwanted list you use this: (vl-remove-if 'listp lst) (<Entity name: 1c93b18>) Quote
Lee Mac Posted December 23, 2008 Posted December 23, 2008 Ahh, I understand it now - so its just a cool way to retrieve the entity name. Very nice CAB Quote
SoftvnBin Posted April 16, 2023 Posted April 16, 2023 (edited) I am working with Attribute objects and need to calculate the Max, min, Average values of several same Attribute objects selected from Select. I don't understand much about Lisp, so I hope you can help me with the following Lisp: 1. Commad: MaxminAve 2. Pick select Block Att template 3. Choose to pick Block Att's sample Tag 4. Select the Select area 5. Pick the resulting text setpoint For example: - In the drawing there are many different Block Att, in which there are also many Block Att "FFFFFFFF" 1. Command: MaxminAve 2. Pick to select Block "FFFFFFFF" 3. Pick the tag "CCoss" of Block "FFFFFFFF" 4. Select Block selection area (For example, I can Select in an area with 5 blocks Att "FFFFFFFF") 5. Pick the result set point The result will be the Mtext with the current Layer and Mtext present in the drawing: "- Number Select Att = 5 blocks Att - Number max = ???? - Number Min = ???? - Number Ave = ???" Can someone help me? Thank you very much in advance (My English is very bad, I hope everyone can understand) Edited April 16, 2023 by SoftvnBin Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.