dwg2csv - export all available custom properties

Drop in here to discuss whatever you want.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
lowattila
Newbie Member
Posts: 3
Joined: Fri Mar 22, 2024 11:13 am
Location: Slovakia

dwg2csv - export all available custom properties

Post by lowattila » Fri Mar 22, 2024 12:21 pm

Hi i am an architect, and I am currently trying out the trial version of Qcad 3.29.4.0 on Windows 10.

I would like to make window, door, zone, etc. schedules using custom properties or block attributes (not sure which one to use yet).

I am experimenting with the dwg2csv command line tool to export these data.
I have no scripting background, but managed to export custom properties one by one. However there are 30-40 ish properties for a window, and there are other completely different ones for zones.

Is there an option in the dwg2csv tool to export all the available custom properties or attributes for blocks?

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

Re: dwg2csv - export all available custom properties

Post by andrew » Fri Mar 22, 2024 1:31 pm

To work with custom properties, you can list all of them using multiple -p switches.

For example, to list all values of custom properties "MyAttribute1" and "MyAttribute1"

Code: Select all

./dwg2csv -t "Block Reference" -p QCAD:MyProperty1 -p QCAD:MyProperty2 -f custom_properties.dxf; cat custom_properties.csv
This will output something in the format:

Code: Select all

QCAD:MyProperty1,QCAD:MyProperty2
7.5,34.5
4.2,45.5
...
With one row for each block reference in the file.

Using block attributes won't work as you would have to somehow connect the listed attribute entities back to the block reference they belong to which is currently not possible from the CSV output.

lowattila
Newbie Member
Posts: 3
Joined: Fri Mar 22, 2024 11:13 am
Location: Slovakia

Re: dwg2csv - export all available custom properties

Post by lowattila » Fri Mar 22, 2024 4:04 pm

Thank you andrew, hope i got it, I only dont understand the last part:

"Using block attributes won't work as you would have to somehow connect the listed attribute entities back to the block reference they belong to which is currently not possible from the CSV output."

I made a test file with both attributes and custom properties, and both the attributes and the custom properties could be written to the csv file.
I feel like making rather attributes and putting them on a hidden layer can give more control, as custom property names can not be modified after creating them.
What am I missing?
Attachments
oo.dxf
(153.82 KiB) Downloaded 10 times
oo.csv
(363 Bytes) Downloaded 8 times

CVH
Premier Member
Posts: 3480
Joined: Wed Sep 27, 2017 4:17 pm

Re: dwg2csv - export all available custom properties

Post by CVH » Fri Mar 22, 2024 4:23 pm

lowattila wrote:
Fri Mar 22, 2024 4:04 pm
I made a test file with both attributes and custom properties, and both the attributes and the custom properties could be written to the csv file.
Yes, of course, but Block Attributes exist on there own.
You also need to query the associated Block Reference ID to know to what Block Reference it is related to ...
... This doesn't work the other way around, the reference is upwards and not downwards.

Meaning that you can not query a certain Block Reference and export its associated Block Attributes ID's and content.
But you can query a certain Block Attribute and export its content and the associated Block Reference ID.

# EDIT # This was script based and Andrew explained that the delegated properties can be queried ...

Regards,
CVH
Last edited by CVH on Fri Mar 22, 2024 4:34 pm, edited 1 time in total.

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

Re: dwg2csv - export all available custom properties

Post by andrew » Fri Mar 22, 2024 4:25 pm

lowattila: Yes, you are right. I didn't realize that one can output attributes as part of the block reference record instead of their own records, so attributes will also work indeed.

lowattila
Newbie Member
Posts: 3
Joined: Fri Mar 22, 2024 11:13 am
Location: Slovakia

Re: dwg2csv - export all available custom properties

Post by lowattila » Fri Mar 22, 2024 4:57 pm

Thank you guys, really appreciate your quick answers. Qcad seems to be a very powerful tool.

Post Reply

Return to “Chat”