Lisp?

I am a Landscape Architect. I have a very large irrigation project that I need to add the total gallons per minute (gpm) of selected head (sprinkler) symbols. Each symbol has an attribute with the gpm value already. I want to make a selection of heads, add up all the values from the gpm attribute then take the total and update another block with that total. The block with the total gpm is a tag for the specific valve that is operating the heads. I would have to be able to select the particular valve tag to update in the middle of the operation.

I have been using the Express tools export attribute information and opening in Excel then getting the sum then going back to Acad and manually updating the valve tag...very tedious...over 300 valves need to be done!

Any ideas?

Reply to
Yardz
Loading thread data ...

Yardz a écrit :

It looks like you need a specific application LISP or VBA, I don't think a generic AutoCAD command or procedure would achieve that.

Reply to
Patrick

I had similar problems with other tables I needed for my final construction documents. About 3 years ago I found this program that converts from ACAD to Excel and back again.

formatting link
You can d/l a free trial version that will work for 30 days. This is just a very simple and easy to use program.

What I do now is create a block. Each block that has a unique value that I want Excel to associate to it is on a seperate layer. I can group many block or just one. Once in Excel, I can associate the blocks and layers to a numerical reference. Create a formula if needed and do the calculations. This then saves back to ACAD. Everytime I add a new block to the drawing, it updates the table. If I open the table again in Excel and then go back to ACAD, the table has all the new information contained. This is the fastest and easiest table or schedule builders I have found. Well worth the $.

Good luck,

-Rob

Reply to
Rob

Could you send me a part of your drawing for example? So I can see what I can do for you. I think, from you words, it's possible to create a program LISP for your require, I hope it will be so...

Happy new year!

Max

"Yardz" ha scritto nel messaggio news:RIhtf.1859$aB1.21@trnddc02...

Reply to
Max

This is possible with a custom lisp routine. If you do this a lot it may be worth it to you to write it. After you learn how to write this one, you'll be on the look out for other ways to improve your productivity through lisp. Then you will write others, and wonder how you ever managed without this new skill set.

Reply to
Michael Bulatovich

I wrote programs LISP for head sprinkler...

What's you mail?

Max

"Yardz" ha scritto nel messaggio news:RIhtf.1859$aB1.21@trnddc02...

Reply to
Max

Program for head sprinkler:

(defun C:GPMHEAD (/ gru totalgpm index count sumGPM) (setq gru (ssget) totalgpm (car (entsel "\nSelect block total GPM: ")) index 0 sumGPM 0 count 0 ) (if gru (progn (repeat (sslength gru) (setq ent (ssname gru index) entn(entnext ent) ) (if (and (= (cdr (assoc 0 (entget ent))) "INSERT") entn (= (cdr (assoc 0 (entget (entnext ent)))) "ATTRIB") ) (progn (setq sumGPM (+ sumGPM (atof (cdr (assoc 1 (entget (entnext ent)))))) count(1+ count) ) ) ) (setq index (1+ index)) ) ) ) (setq b1 (subst (cons 1 (rtos sumGPM 2 2)) (assoc 1 (entget (entnext totalgpm))) (entget (entnext totalgpm)))) (entmod b1) (entupd totalgpm) (cond ((= count 1)(alert (strcat "Found " (itoa count) " head."))) ((> count 1)(alert (strcat "Found " (itoa count) " heads."))) ) (princ) )

"Yardz" ha scritto nel messaggio news:RIhtf.1859$aB1.21@trnddc02...

Reply to
Max

If you are doing sprinklers in AutoCAD, you may be interested in this program: Autopipes

formatting link
FP

Reply to
flixpeer

Thanks to everyone for responding...sorry I have not checked since I posted.

I am going to check out the suggestions and will be back.

Thanks again.

Reply to
Yardz

This lisp almost works. It is adding up the wrong attribute, then updating the wrong attribute in the target block.

I need it to give the sum of the second attribute of the first block(s) then return that number to the second attribute of the target block.

The first block has two attributes: model, gpm. The target block has three attributes: number, gpm, size. I need to be able to pick the first block (many at a time by any method and have the gpm's totaled and update the gpm attribute in the target block.

What needs to be edited in the lisp below to achieve that?

Thanks!

Reply to
Yardz

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.