Can you provide an example of the strings to pass to set drawing units to inches in the resulting SVG? I'm passing '-g' but the units in the resulting SVG file do not have the correct units.
The documentation does not make this very clear.
https://qcad.org/en/products/qcad-command-line-tools
dwg2svg - Example
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.
Re: dwg2svg - Example
The SVG output unit is the same as the drawing unit if possible (mm, cm, in).
If the input drawing is unitless or has the wrong unit, you can use the -u in switch to tell dwg2svg to interpret the units as Inches.
If the coordinates are wrong in the input drawing or you want to convert the unit, you can use the -s switch to scale the output.
Let's say you have a drawing in mm that you want to output in Inches, you could convert using:
This means:
- interpret the coordinates as Inches (and output in Inches)
- scale output by factor 1/25.4
If the input drawing is unitless or has the wrong unit, you can use the -u in switch to tell dwg2svg to interpret the units as Inches.
If the coordinates are wrong in the input drawing or you want to convert the unit, you can use the -s switch to scale the output.
Let's say you have a drawing in mm that you want to output in Inches, you could convert using:
Code: Select all
dwg2svg -u in -s 1/25.4 -o output.svg input.dxf
- interpret the coordinates as Inches (and output in Inches)
- scale output by factor 1/25.4
-
- Newbie Member
- Posts: 3
- Joined: Thu May 09, 2019 5:35 am
Re: dwg2svg - Example
Thanks for the example. I'm still having trouble though. I think because the source file does not have drawing units specified. This output file does not open with the expected size in vector programs like Adobe Illustrator.
Input File:
Output File:
Input File:
Code: Select all
dwg2svg -f -g -u in -s 1/71.94 -o output.svg input.dxf
Re: dwg2svg - Example
Which version of QCAD are you using?
If not the latest, does dwg2svg -h report the -u switch? If not, that was added in a later version.
The SVG files you've attached does not specify a unit which means that size would default to pixels (i.e. the SVG is 12 pixels wide).
If not the latest, does dwg2svg -h report the -u switch? If not, that was added in a later version.
The SVG files you've attached does not specify a unit which means that size would default to pixels (i.e. the SVG is 12 pixels wide).
-
- Newbie Member
- Posts: 3
- Joined: Thu May 09, 2019 5:35 am
Re: dwg2svg - Example
I'm using qcadds-3.20.1.6-pro-linux-x86_64
Re: dwg2svg - Example
I'm assuming the expected size is about 12 inches wide (11.5").
Since the drawing unit is also inches, you'd only have to specify the input being inches (i.e. no scale):
You can see if the SVG is correct by opening it in a text editor. Its header should look like this:
If an application displays it at a different scale or size, the error or configuration error would be with that application.
Since the drawing unit is also inches, you'd only have to specify the input being inches (i.e. no scale):
Code: Select all
dwg2svg -f -g -u in -o 12.svg 12.dxf
Code: Select all
<svg width="11.5472in" height="2.0409in" ...>