Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
Redraiderr2009
Posts: 164
Registered: ‎04-09-2008
Message 1 of 7 (557 Views)

Best way to keep blocks and Notes linked

557 Views, 6 Replies
09-13-2011 01:33 PM

I have been racking my brain trying to figure out how to link the blocks quantities to a lables. Here is the senario. I have 5 tree blocks. I label them and the label contains the count of 5 in an attribute. That part works fine, but lets say I delete one. Now I have 4 blocks and 5 labeled. I am tring to figure the best possible way to link the blocks to a label so that it updates as I delete one. I have taken several approaches to this.

 

1. Just the way I explained it above and it is done with a lisp routine.

2. I have used fields to verify the plant counts. if one is deleted the quantity is updated or shows a #### in the area.

3. Now I am thinking a reactor might be the best way, but that seems like a lot of work to make a reactor. I haven't made one work consistantly yet.

 

Any ideas would be great.

 

Thanks,

 

*Expert Elite*
scot-65
Posts: 2,124
Registered: ‎12-11-2003
Message 2 of 7 (549 Views)

Re: Best way to keep blocks and Notes linked

09-13-2011 03:23 PM in reply to: Redraiderr2009

Perhaps a poor-man's reactor?

 

Undefine the PLOT command (or QSAVE).

In it's place gather the counts that you have and update the values (table) before issuing .PLOT...

 

(My scenario involves the first occurrence of QSAVE to do file maintenance).

 

???

Scot-65
Dyslexia is a permanent physical disability that cannot be seen.
*Expert Elite*
Lee_Mac
Posts: 1,101
Registered: ‎12-29-2009
Message 3 of 7 (542 Views)

Re: Best way to keep blocks and Notes linked

09-13-2011 04:32 PM in reply to: Redraiderr2009

This looked like a fun program to put together, so I challenged myself to see what I could come up with.

 

The result:

 

AutoLabel.gif

 

The attached program will automatically label a specific attribute in a set of blocks, renumbering when a block is inserted, copied or deleted. I plan to add the program and a full description to my website soon.

 

To set the program to work for your blocks, change the block name & attribute tag at the top of the source code:

 

(setq *blockname* "block"  ;; Name of Block to be Updated
      *blocktag*  "tag"    ;; Attribute Tag to be Updated
)

 

( These values are not case-sensitive )

There is no syntax for this program, it just needs to be loaded.

 


Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)
Expert Elite
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Valued Mentor
Shneuph
Posts: 311
Registered: ‎11-26-2007
Message 4 of 7 (502 Views)

Re: Best way to keep blocks and Notes linked

09-14-2011 07:16 PM in reply to: Lee_Mac

Thanks Lee, I look forward to figuring out how you handled reactor owner objects in this program.  I was trying to figure out a good way for another program I'm writing and got hung up. At first glance it looks like you've handled the UNDO issues with reactors too so I'll have to figure out how you did that as well.

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
*Expert Elite*
Lee_Mac
Posts: 1,101
Registered: ‎12-29-2009
Message 5 of 7 (482 Views)

Re: Best way to keep blocks and Notes linked

09-15-2011 10:09 AM in reply to: Shneuph

Thanks Shneuph :smileyhappy:  I'm sure there are a few more bugs to be ironed out, but I shall probably update the program further before I add it to my site. Of course, if you have any questions about the code, let me know.

Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)
Expert Elite
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Contributor
elderla
Posts: 16
Registered: ‎02-04-2008
Message 6 of 7 (394 Views)

Re: Best way to keep blocks and Notes linked

12-08-2012 09:19 AM in reply to: Redraiderr2009

dear redraiderr:

I wonder if I could pick your brains a bit here:

I use AutoCAD LT 2012, which means I am limited by not being able to use lisp routines. I am trying to develop a note that will do something like what you are talking about . That is, I am labeling plants by counting them in groups, and then entering the count (and symbol) into a note as an attribute.  You mention you use fields for count. can you tell me how, precisely? Is there a way to get a field to return a count and plant block attribute  on a selection of more than one block?   I can't seem to find the correct options when I create fields in my note block.

 

I am not so worried about changes, I am willing to reselect if I change plants in one spot.

 

thanks so much for your help!

Donna

 

 

Contributor
elderla
Posts: 16
Registered: ‎02-04-2008
Message 7 of 7 (390 Views)

Re: Best way to keep blocks and Notes linked

12-08-2012 09:21 AM in reply to: Redraiderr2009

dear redraiderr:

I wonder if I could pick your brains a bit here:

I use AutoCAD LT 2012, which means I am limited by not being able to use lisp routines. I am trying to develop a note that will do something like what you are talking about . That is, I am labeling plants by counting them in groups, and then entering the count (and symbol) into a note as an attribute.  You mention you use fields for count. can you tell me how, precisely? Is there a way to get a field to return a count and plant block attribute  on a selection of more than one block?   I can't seem to find the correct options when I create fields in my note block.

 

I am not so worried about changes, I am willing to reselect if I change plants in one spot.

 

thanks so much for your help!

Donna

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community