Blocks counting

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
Seb Riou
Newbie Member
Posts: 3
Joined: Fri Jan 31, 2014 1:51 pm

Blocks counting

Post by Seb Riou » Sat Feb 01, 2014 9:08 pm

Hey all,
Does anyone know if there's a way to sort selected blocks inserted in a file and count them in an xl type of table ? Autocad and vectorworx do that very well, and that's very helpful to keep a trace of how many "this "or "that" you have in your plan.

Thanks !

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Blocks counting

Post by andrew » Tue Feb 04, 2014 9:57 am

It shouldn't be a lot of effort to whip up such a solution as a simple script that creates a CSV file which can be imported into spreadsheet applications.

If you can post an example of what you have in mind (e.g. an example table with a brief description of the table columns), it would likely be very feasible to create a script to create a CSV file.

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4935
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Blocks counting

Post by Husky » Tue Feb 04, 2014 8:42 pm

andrew wrote:It shouldn't be a lot of effort ...
Yep - but I guess it needs time ... :cry:
http://www.ribbonsoft.com/bugtracker/in ... ask_id=555

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Blocks counting

Post by andrew » Wed Feb 05, 2014 10:34 am

Husky wrote:Yep - but I guess it needs time ... :cry:
Here are the keys to a success with feature requests:

1. A clear, unambiguous specification (attach example drawing, provide example for expected output format, list expected step by step usage of the tool).
2. Keep it simple for a first version to start with. I.e. provide a request for a simple tool that will do the most important part of the job and will be the most useful with the least amount of effort. It will then be possible to gather feedback based on such a simple tool and incrementally improve and extend it.

Example usage spec:
1. Start tool "Export block list"
2. Choose file name (.csv)
3. QCAD exports the complete block list in CSV format with the columns "Count", "Name"

Possibilities for extension:
- Limit export to selected blocks
- Specify CSV format (comma separated, tab separated, ...)
- ...

This is just an example. I don't know if that is even approximately what you had in mind.

Seb Riou
Newbie Member
Posts: 3
Joined: Fri Jan 31, 2014 1:51 pm

Re: Blocks counting

Post by Seb Riou » Wed Feb 12, 2014 3:57 pm

Hello Andrew,
This exactly what I had in mind , no more no less !

A simple table (I had an excel picture in mind but .csv file is good enough ) with block name and count , that's it !

When you say that it shouldn't be difficult to write the script, you mean i could do it even if I have no knowledge pf programming at all ?

Thanks anyway for the answer !

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Blocks counting

Post by andrew » Thu Feb 13, 2014 10:03 am

Seb Riou wrote:When you say that it shouldn't be difficult to write the script, you mean i could do it even if I have no knowledge pf programming at all ?
No, but this is straight-forward to implement for me since the requirements of the output are clear and simple.

You can find a simple implementation attached to this post.

Installation:

Extract the ZIP file into folder
scripts/Misc
of your QCAD installation.

If done correctly, this will create the path
scripts/Misc/MiscBlock/BlockListExport
You should then have a new menu under
Misc > Block > Export Block List
Please post any bug reports or additional feature requests to our task tracker at:
http://www.qcad.org/bugtracker/index.ph ... 1&do=index
Attachments
MiscBlock.zip
Block list export to CSV
(2.8 KiB) Downloaded 575 times

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4935
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Blocks counting

Post by Husky » Fri Feb 14, 2014 9:13 am

Nice! Thank you Andrew!

I have only one problem :oops: :oops: :oops:
I would like to use the csv file in Excel but in my European Windows version Excel can't understand the Tabulator as a "List Separator" - which means I have all data in one column.

If I save the csv as a txt and open it then in Excel every thing works fine - I have as desired the data separated in different columns.

Can I change something in the script to get a file what would work in first place with Excel and will ask me to separate in columns?

Result with the actual csv output:
Husky-2014.02.13-01.png
Husky-2014.02.13-01.png (16.96 KiB) Viewed 17211 times
Result with the csv saved as a txt:
Husky-2014.02.13-02.png
Husky-2014.02.13-02.png (15.67 KiB) Viewed 17211 times

User avatar
Clive
Moderator
Posts: 1329
Joined: Thu Aug 25, 2011 9:28 pm
Location: UK

Re: Blocks counting

Post by Clive » Fri Feb 14, 2014 11:02 am

@Andrew, yes thank you for this, it is very useful :D

@Husky, I actually found that opening the .csv file with Notepad (or Wordpad) gives me a better result.
Notepad.png
Notepad.png (6.01 KiB) Viewed 17028 times
For the best support please state your operating system, QCAD version and add any supporting DXF/DWG files, screenshots etc...

Seb Riou
Newbie Member
Posts: 3
Joined: Fri Jan 31, 2014 1:51 pm

Re: Blocks counting

Post by Seb Riou » Fri Feb 14, 2014 3:25 pm

Thanks Andrew,it works great and does exactly what I meant it too.
Thumbs up !

Post Reply

Return to “QCAD 'How Do I' Questions”