Jump to content

Recommended Posts

Posted

Thanks Lee, you'll get there too.

 

David produces some nice code as well. :)

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    13

  • CAB

    4

  • johnengineer

    3

  • ReMark

    2

Posted

Yeah he does, I like the way he shows his knowledge of the LISP functions - like using (while (not (minusp... instead of (while (> ... 0)

Posted

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

Posted

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>)

Posted

Ahh, I understand it now - so its just a cool way to retrieve the entity name.

 

Very nice CAB

  • 14 years later...
Posted (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 by SoftvnBin

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...