Page 1 of 1

Blocks counting

Posted: Sat Feb 01, 2014 9:08 pm
by Seb Riou
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 !

Re: Blocks counting

Posted: Tue Feb 04, 2014 9:57 am
by andrew
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.

Re: Blocks counting

Posted: Tue Feb 04, 2014 8:42 pm
by Husky
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

Re: Blocks counting

Posted: Wed Feb 05, 2014 10:34 am
by andrew
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.

Re: Blocks counting

Posted: Wed Feb 12, 2014 3:57 pm
by Seb Riou
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 !

Re: Blocks counting

Posted: Thu Feb 13, 2014 10:03 am
by andrew
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

Re: Blocks counting

Posted: Fri Feb 14, 2014 9:13 am
by Husky
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 17228 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 17228 times

Re: Blocks counting

Posted: Fri Feb 14, 2014 11:02 am
by Clive
@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 17045 times

Re: Blocks counting

Posted: Fri Feb 14, 2014 3:25 pm
by Seb Riou
Thanks Andrew,it works great and does exactly what I meant it too.
Thumbs up !