Easiest way to link data to an object?
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
-
- Newbie Member
- Posts: 9
- Joined: Fri Oct 21, 2016 9:52 pm
Easiest way to link data to an object?
I'm using QCAD to create simple garden plans, and I'm curious about the easiest way to link data about a plant to that object.
I've used JSON a bit in designing websites, and it seems an ideal way to store the information.
Any tips gratefully received before I bolt down the rabbit hole!
I've used JSON a bit in designing websites, and it seems an ideal way to store the information.
Any tips gratefully received before I bolt down the rabbit hole!
Re: Easiest way to link data to an object?
You can add custom properties (key / value pairs) to entities using the property editor (View > Property Editor):
-
- Newbie Member
- Posts: 9
- Joined: Fri Oct 21, 2016 9:52 pm
Re: Easiest way to link data to an object?
Thank you for swift reply (I didn't get notification so only just noticed).
The custom properties would be good for one or two pairs but I have about 11. Was thinking of creating simple database/JSON file to keep track, and hoping that this data could be linked easily. If not, I'll fallback to using custom properties for the binomial name.
thanks, Jake
The custom properties would be good for one or two pairs but I have about 11. Was thinking of creating simple database/JSON file to keep track, and hoping that this data could be linked easily. If not, I'll fallback to using custom properties for the binomial name.
thanks, Jake
Re: Easiest way to link data to an object?
You would typically add a new script tool to assign those properties (i.e. My Menu > Mark Selection as Tree XY) or even a dialog to add / edit these properties.growdigital wrote:The custom properties would be good for one or two pairs but I have about 11.
If you are looking for an ID to use as reference, you can use the object handle for this (see property editor). The handle of an object is persistent (stored to DXF/DWG).growdigital wrote:Was thinking of creating simple database/JSON file to keep track, and hoping that this data could be linked easily.
-
- Newbie Member
- Posts: 9
- Joined: Fri Oct 21, 2016 9:52 pm
Re: Easiest way to link data to an object?
Brilliant, thank you for this, will have play with it.
On a related note, is it easy to /export/ the data from Custom Properties?
many thanks, Jake
On a related note, is it easy to /export/ the data from Custom Properties?
many thanks, Jake
Re: Easiest way to link data to an object?
Custom properties are automatically saved to DXF/DWG files. Export to other formats would have to be implemented. The effort for this greatly depends on the complexity on the desired format. Accessing / listing custom properties is straightforward (RObject::getCustomPropertyTitles, RObject::getCustomPropertyKeys, RObject::getCustomProperty).growdigital wrote:On a related note, is it easy to /export/ the data from Custom Properties?
-
- Newbie Member
- Posts: 9
- Joined: Fri Oct 21, 2016 9:52 pm
Re: Easiest way to link data to an object?
Fantastic, thank you
- dfriasb
- Senior Member
- Posts: 119
- Joined: Thu Mar 10, 2016 1:08 pm
- Location: Calafell, Tarragona, Spain
Re: Easiest way to link data to an object?
So entity Id only works on dxf, do it?
Re: Easiest way to link data to an object?
DXF and DWG.
- dfriasb
- Senior Member
- Posts: 119
- Joined: Thu Mar 10, 2016 1:08 pm
- Location: Calafell, Tarragona, Spain
Re: Easiest way to link data to an object?
I have made a function that prints into command line all Custom Properties from selected entities. I hope someone can find it useful. I'm planning to write some similar function to print this data into csv in order to export to spreadsheets.
Best regards, David.
Best regards, David.
- dfriasb
- Senior Member
- Posts: 119
- Joined: Thu Mar 10, 2016 1:08 pm
- Location: Calafell, Tarragona, Spain
Re: Easiest way to link data to an object?
By the way, is there any way to create Custom Properties with Tittle different from "QCAD" inside QCAD application? And any idea of how could it be outside?
Re: Easiest way to link data to an object?
QCAD properties are stored as column separated key / value pair strings and QCAD needs to know which properties it can handle when loading a file (those stored with the "QCAD" app ID).
You can use another app ID, but then properties will be stored the Autocad way (number code + value of type int, double, string, ...).
You can use another app ID, but then properties will be stored the Autocad way (number code + value of type int, double, string, ...).