Blocks counting

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

Moderator: andrew

Blocks counting

Postby 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 !
Seb Riou
Newbie Member
 
Posts: 3
Joined: Fri Jan 31, 2014 1:51 pm

Re: Blocks counting

Postby 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
andrew
Site Admin
 
Posts: 2658
Joined: Fri Mar 30, 2007 6:07 am

Re: Blocks counting

Postby 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
Husky
Moderator
 
Posts: 690
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Blocks counting

Postby 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.
User avatar
andrew
Site Admin
 
Posts: 2658
Joined: Fri Mar 30, 2007 6:07 am

Re: Blocks counting

Postby 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 !
Seb Riou
Newbie Member
 
Posts: 3
Joined: Fri Jan 31, 2014 1:51 pm

Re: Blocks counting

Postby 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 91 times
User avatar
andrew
Site Admin
 
Posts: 2658
Joined: Fri Mar 30, 2007 6:07 am

Re: Blocks counting

Postby 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 1412 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 1412 times
User avatar
Husky
Moderator
 
Posts: 690
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Blocks counting

Postby 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 1405 times
Clive
User avatar
Clive
Moderator
 
Posts: 955
Joined: Thu Aug 25, 2011 9:28 pm
Location: UK

Re: Blocks counting

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

Thanks Andrew,it works great and does exactly what I meant it too.
Thumbs up !
Seb Riou
Newbie Member
 
Posts: 3
Joined: Fri Jan 31, 2014 1:51 pm


Return to QCAD 3 'How Do I' Questions

Who is online

Users browsing this forum: No registered users and 3 guests