Count tool - How to create a custom expression that sums the block attribute values of the blocks it is counting.

Count tool - How to create a custom expression that sums the block attribute values of the blocks it is counting.

NateSarles
Advocate Advocate
1,941 Views
13 Replies
Message 1 of 14

Count tool - How to create a custom expression that sums the block attribute values of the blocks it is counting.

NateSarles
Advocate
Advocate

Hello,

 

I am looking to take a selection of block references, that each contain a numerical attribute value, and sum the attribute values in the most streamlined way possible. I have attached a file to give an example of what I am trying to achieve.

 

I had previously posted regarding this same task I hope to streamline, my previous post however, found here, was requesting a Lisp routine to handle this.

 

Since that previous post, I have discovered the 'Count' tool and am confident there is a way to write a custom expression that will read each block's attribute value, add the attributes, and produce a total value for the counted blocks. this expression could then be added as a field to the count table.

 

Can someone who knows coding better than I lend a hand in this? 

C3D 2022
Experienced Civil Site Designer/Drafter
Windows 11, 64 GB RAM
13th Gen Intel(R) Core(TM) i7-13850HX
0 Likes
Accepted solutions (2)
1,942 Views
13 Replies
Replies (13)
Message 2 of 14

brian.strandberg
Advisor
Advisor
Accepted solution

There is a lisp routine that can do this.  Check out: https://www.lee-mac.com/countattributevalues.html

 

I tried this on your drawing, and it generated this:

brianstrandberg_0-1720714396327.png

 

You can then add a SUM in the lowest column, and link that to your other table.  

 

 

Check out my Civil 3d blog at: http://c3dk.com/
Favorite Posts: Use Dynamo For Surface Analysis: https://youtu.be/eJNdX6guMP8
Fast Track your site grading with the new Corridor Workflow: https://youtu.be/Gg7u9-LgIL0
Message 3 of 14

NateSarles
Advocate
Advocate

Thanks @brian.strandberg ,

I thought I had already exhausted the wonderful resources of LeeMac but it appears I missed one of his gems! Now if only I knew enough code to add that sum cell to the table his LISP produces... maybe one day lol

C3D 2022
Experienced Civil Site Designer/Drafter
Windows 11, 64 GB RAM
13th Gen Intel(R) Core(TM) i7-13850HX
0 Likes
Message 4 of 14

NateSarles
Advocate
Advocate
Accepted solution

Well, well, well,

 

Chat GPT came in clutch... I was able to have Chat GPT modify the code to output exactly what I needed and nothing more! Thank you @brian.strandberg  for pointing me in the right direction!

 

Please enjoy this modified LISP that outputs a total attribute value for selected blocks.

C3D 2022
Experienced Civil Site Designer/Drafter
Windows 11, 64 GB RAM
13th Gen Intel(R) Core(TM) i7-13850HX
Message 5 of 14

brian.strandberg
Advisor
Advisor

Normally Chat GPT will start inventing lisp functions that don't exist.  So thats a hassle.

Check out my Civil 3d blog at: http://c3dk.com/
Favorite Posts: Use Dynamo For Surface Analysis: https://youtu.be/eJNdX6guMP8
Fast Track your site grading with the new Corridor Workflow: https://youtu.be/Gg7u9-LgIL0
Message 6 of 14

NateSarles
Advocate
Advocate

Yes, I have noticed that getting ChatGPT to produce functional results can be rather tedious, but I am seeing improvements... Especially when I cross reference AI sites, I will ask ChatGPT to write a lisp, then ask Claude.ai to fix it or vice versa. then usually, if my ask is simple enough, I can get something that works to come out of it all... Much like this situation.

 

At the very least AI tools are allowing me to slowly better understand the language so that maybe one day I can write my own code. @brian.strandberg 

C3D 2022
Experienced Civil Site Designer/Drafter
Windows 11, 64 GB RAM
13th Gen Intel(R) Core(TM) i7-13850HX
0 Likes
Message 7 of 14

brian.strandberg
Advisor
Advisor

That's awesome @NateSarles!  Keep the efforts going.

Check out my Civil 3d blog at: http://c3dk.com/
Favorite Posts: Use Dynamo For Surface Analysis: https://youtu.be/eJNdX6guMP8
Fast Track your site grading with the new Corridor Workflow: https://youtu.be/Gg7u9-LgIL0
0 Likes
Message 8 of 14

Joe-Bouza
Mentor
Mentor

DATAEXTRACTION does this OOTB

Joe Bouza
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 9 of 14

NateSarles
Advocate
Advocate

@Joe-Bouza, Yes, I am sure it does, but that is a rather tedious process, all I am trying to do is add up the total parking stalls for a given project... so exporting data to an external file and going through that whole process is a bit more than I was bargaining for in this specific case.

In the scenario where more complex data was being evaluated then DATAEXTRACTION is definitely the way to go!

C3D 2022
Experienced Civil Site Designer/Drafter
Windows 11, 64 GB RAM
13th Gen Intel(R) Core(TM) i7-13850HX
0 Likes
Message 10 of 14

Joe-Bouza
Mentor
Mentor

I get that. Once the dxe file is made it a little quicker but still some effort.

 

Do you have AVT? It has a great parking tool with continuous count. Even ADA stalls can be inserted on the fly and broken out it the count 

Joe Bouza
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 11 of 14

Joe-Bouza
Mentor
Mentor

I get that. Once the dxe file is made it a little quicker but still some effort.

 

Do you have AVT? It has a great parking tool with continuous count. Even ADA stalls can be inserted on the fly and broken out it the count 

Joe Bouza
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 12 of 14

NateSarles
Advocate
Advocate

@Joe-Bouza , I do have AVT, I just have not yet mastered the parking tool. We mostly just use it for truck turning, (fire, refuse, deliveries.)

 

Learning the parking tool is definitely something on my to-do list!

C3D 2022
Experienced Civil Site Designer/Drafter
Windows 11, 64 GB RAM
13th Gen Intel(R) Core(TM) i7-13850HX
0 Likes
Message 13 of 14

Joe-Bouza
Mentor
Mentor

Like many of us. Its a tool that should have more focus. unfortunately, the style configuring is myriad boxes and settings.

 

The one lame thing about it is the end cap geometry if used has not geometric labeling

Joe Bouza
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 14 of 14

rl_jackson
Mentor
Mentor

I've used data extraction for years to create simple spreadsheets to calculate parking on ALTA surveys, I had a block for regular/HC spaces, extracted the block attributes to a spreadsheet and computed the totals in the spreadsheet to show on the survey. Worked like a charm.


Rick Jackson
Survey CAD Technician VI

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes