[solved] Get drawing unit from drawing through command line

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

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
mrohnstock
Newbie Member
Posts: 4
Joined: Thu Aug 04, 2022 8:06 am

[solved] Get drawing unit from drawing through command line

Post by mrohnstock » Tue Aug 09, 2022 1:46 pm

Hi,

Operation system: Archlinux
QCAD: 3.27.6.0 (3.27.6) Professional

I'm using the command line tools bbox to determine the drawing size of a drawing. This is working great, but I do receive some dxf files, where the drawing unit was (accidentally) changed from millimeter to centimeter by the designer. bbox always returns the size in the unit as it was used in the drawing - which is correct, but not wanted by me.

I can see the drawing unit through the GUI with the following steps:

1. Edit → Drawing Preferences
2. General → Drawing Unit

I've attached two samples:
1. car-in-cm.dxf → drawing unit was set to centimeter
2. car-in-mm.dxf → same drawing, but designer changed to drawing unit to millimeter

Using bbox the following sizes get returned:

car-in-cm.dxf: 22.468989987273325/9.728374755022282
car-in-mm.dxf: 224.68989987273324/97.28374755022281

Is there a way to get the used drawing unit from a dxf (or let bbox return the size incl. drawing unit) through command line so I'm somehow able to convert the unit manually?

Thank you very much!

Best regards

- Mathias
Attachments
car-in-mm.dxf
(190.35 KiB) Downloaded 156 times
car-in-cm.dxf
(191.25 KiB) Downloaded 155 times
Last edited by mrohnstock on Wed Aug 10, 2022 8:53 am, edited 1 time in total.

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

Re: Get drawing unit from drawing through command line

Post by CVH » Tue Aug 09, 2022 4:40 pm

Hi,

A shot in the dark.

Textual in the dxf file: $INSUNITS
For the mm drawing that is 70 ... 4
And for the cm drawing that is 70 ... 5

https://documentation.help/AutoCAD-DXF/ ... 9-7a6f.htm

Regards,
CVH

mrohnstock
Newbie Member
Posts: 4
Joined: Thu Aug 04, 2022 8:06 am

Re: Get drawing unit from drawing through command line

Post by mrohnstock » Wed Aug 10, 2022 8:53 am

Thanks CVH, on some checks, this looks promising :).

Issue is solved

Post Reply

Return to “QCAD 'How Do I' Questions”