Discussion forum for contributors and developers who are using the QCAD version 3 ECMAScript development platform or the C++ plugin interface or who are otherwise looking to contribute to QCAD (translations, documentation, etc).

I am a new user to QCad and cad development, I have a good few years of C++, C# etc under my belt but little JavaScript.

I have been asked to create a plugin for a customer which talks to a database, I send information to the backend which is used to search the database and return results.

The idea is the customer will only need to drop items onto the drawing I provide via the QCad Library.

I worked my way through the user guide today and can see we can add a custom properties to an entity then selecting multiple entites create a Library Item, would it be possible to add custom properties to a Library item rather than the entites contained in the Library item?

There may be a reason why this is not worth while or even technically possible but I thought for my needs (and maybe others) it might be a worth while feature as I can search the document for certain properties on the Library item rather than individual entites?

The plan for the plugin I am writing is once the customer has placed the Library Items onto the drawing they will click a button which will tell the plugin to search through the drawing for items the backend is interested in, once a list is built up we can search the database. I can work around not having the custom property but thought it my be worth adding it in the future?

Thanks,

Andrew.

Last edited by Taygete on Thu May 22, 2014 10:56 am, edited 1 time in total.

Taygete wrote:would it be possible to add custom properties to a Library item rather than the entites contained in the Library item?

That's not possible at the moment since QCAD creates a block and block reference for the library item at the time when it is inserted. I.e. those objects don't exist before the insertion.

I can think of the following solution:- A library item could contain a block definition with the same name as the file name and a single block reference to that block. That block reference could have custom properties assigned to it.- QCAD could then copy that block reference with custom properties when inserting an item.

This functionality would have to be implemented first. At this point, QCAD would create a block recursion if a library item contains a block with the same name as the file name.

Do you think the above solution would solve the problem for your use case?

The expected structure of a part library item with custom properties is:- File name is for example 'myitem.dxf'.- Contains a block definition with name 'myitem'.- Contains a block reference to that block, typically at position 0/0. That block reference may have custom properties assigned to it.