Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

List of all block definitions

24 REPLIES 24
Reply
Message 1 of 25
Anonymous
534 Views, 24 Replies

List of all block definitions

Using LISP, how can I make a list of all block definitons in the drawing?

I know I can use the (command -insert "?" "*") to return a list of block definitions and then cut and paste the list, but what is the equivalent of this command using lisp to just return a nice neat list of block definitions only for using in a list? Thanks!!!
24 REPLIES 24
Message 21 of 25
Anonymous
in reply to: Anonymous

I don't mind, though I probably wouldn't bother myself: the law of diminishing returns starts to come into play when you try to make functions "too generic". Where that line is varies of course. If I were going to go add a function like this to my library I'd probably omit the sort code, as 99 times out of 100 you probably don't require a sorted result, thus paying an unnecessary performance hit the majority of the time. One option might be to add sorting as an option via a flag (parameter): (table name mask sorted) One potential problem is that all of a table entry's various statii are encoded to the 70 group, so a general 'LOGical AND' may not always work the way you envision it might, that is, sometimes you'll be interested in the entry if the 'AND'ed result is 0, other times when it is non zero or worse, combinations. Still DOable of course, it just requires more flexibility in your code (back to my first comment). Anyway, play with it -- if it helps or contributes to your coding great. Thanks again for asking. "Don Butler" wrote in message news:4075be16$1_3@newsprd01... > Michael: > > I hope you don't mind, but I have created a general purpose routine > utilizing your code.
Message 22 of 25
Anonymous
in reply to: Anonymous

Thanks for the nice simple code Michael - I like the use of null - solves that rewind thing nicely. And I wouldn't bother to add sorting either - if you need to sort the list it's very simple to insert the function call into a setq sort thing. -- Jamie Duncan "How wrong it is for a woman to expect the man to build the world she wants, rather than to create it herself." - Anais Nin (1903-1977) "michael puckett" wrote in message news:40770532_3@newsprd01... > I don't mind, though I probably wouldn't bother myself: the law > of diminishing returns starts to come into play when you try to > make functions "too generic". Where that line is varies of course. > > If I were going to go add a function like this to my library I'd > probably omit the sort code, as 99 times out of 100 you probably > don't require a sorted result, thus paying an unnecessary performance > hit the majority of the time. One option might be to add sorting > as an option via a flag (parameter): (table name mask sorted) > > One potential problem is that all of a table entry's various statii > are encoded to the 70 group, so a general 'LOGical AND' may not > always work the way you envision it might, that is, sometimes you'll > be interested in the entry if the 'AND'ed result is 0, other times > when it is non zero or worse, combinations. Still DOable of course, > it just requires more flexibility in your code (back to my first > comment). > > Anyway, play with it -- if it helps or contributes to your coding > great. > > Thanks again for asking. > > "Don Butler" wrote in message news:4075be16$1_3@newsprd01... > > Michael: > > > > I hope you don't mind, but I have created a general purpose routine > > utilizing your code. > >
Message 23 of 25
Anonymous
in reply to: Anonymous

I believe that kind of brevity is something I picked up along the way from seniors Tanzillo, Nesterovsky, Broad ... just to mention a few. Anything more verbose actually annoys me unless there is a performance or read-ability gain to be realized. Anyway, thank you Jamie :) "Jamie Duncan" wrote in message news:4077eb7e_1@newsprd01... > Thanks for the nice simple code Michael - I like the use of null - solves > that rewind thing nicely. > > And I wouldn't bother to add sorting either - if you need to sort the list > it's very simple to insert the function call into a setq sort thing. > > > -- > Jamie Duncan > > "How wrong it is for a woman to expect the man to build the world she wants, > rather than to create it herself." > - Anais Nin (1903-1977)
Message 24 of 25
Anonymous
in reply to: Anonymous

Thanks Mike. I usually leave it up to the calling function to do the sorting. Basically I was playing with a new toy, as it were, to see what the possibilities were. Anyway, the brevity of your code and the degree of efficiency is a great lesson. Just wanted to let you, as well as the many others that contribute to this group, know that your help is appreciated. Thanks again, Don "michael puckett" wrote in message news:40770532_3@newsprd01... > I don't mind, though I probably wouldn't bother myself: the law > of diminishing returns starts to come into play when you try to > make functions "too generic". Where that line is varies of course. > > If I were going to go add a function like this to my library I'd > probably omit the sort code, as 99 times out of 100 you probably > don't require a sorted result, thus paying an unnecessary performance > hit the majority of the time. One option might be to add sorting > as an option via a flag (parameter): (table name mask sorted) > > One potential problem is that all of a table entry's various statii > are encoded to the 70 group, so a general 'LOGical AND' may not > always work the way you envision it might, that is, sometimes you'll > be interested in the entry if the 'AND'ed result is 0, other times > when it is non zero or worse, combinations. Still DOable of course, > it just requires more flexibility in your code (back to my first > comment). > > Anyway, play with it -- if it helps or contributes to your coding > great. > > Thanks again for asking. > > "Don Butler" wrote in message news:4075be16$1_3@newsprd01... > > Michael: > > > > I hope you don't mind, but I have created a general purpose routine > > utilizing your code. > >
Message 25 of 25
Anonymous
in reply to: Anonymous

Thank you Don. It's an amazing resource for all us. No one, well except maybe the EXTREMELY gifted, passes thru here without picking up something useful. --> Michael <-- "Don Butler" wrote in message news:40781fb8_3@newsprd01... > Thanks Mike. > > I usually leave it up to the calling function to do the sorting. Basically I > was playing with a new toy, as it were, to see what the possibilities were. > > Anyway, the brevity of your code and the degree of efficiency is a great > lesson. > > Just wanted to let you, as well as the many others that contribute to this > group, know that your help is appreciated. > > Thanks again, > > Don

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost