Page 1 of 1

Strange line weight on line type

Posted: Tue Jun 11, 2019 7:10 pm
by garciadelcastillo
Hi there!

Problem: when I "dwg2bmp" a file with special line types, they render very thick!

Description: running into a strange issue with line weights for non-continuous line types. If I try to rasterize the following file:
01-07a55.dwg
(30.87 KiB) Downloaded 535 times
I get this:
01-07a55.dwg.png
01-07a55.dwg.png (9.94 KiB) Viewed 7945 times
But as far as I can tell inspecting the file with a GUI, neither the lines nor the layers have any line weight associated to it. Furthermore, if I simply resave the same file with a different software and "dwg2bmp" it, I get the right rasterization:
raster.png
raster.png (9.44 KiB) Viewed 7945 times
Which property is making the line render so thick? What am I missing?

Using the following call:

Code: Select all

qrun.bat scripts\Pro\Tools\Dwg2Bmp\Dwg2Bmp.js -background=white -width=1024 -height=1024 -force -antialiasing -monochrome -color-correction -zoom-all -no-weight-margin -outfile="raster.png" .\01-07a55.dwg

Re: Strange line weight on line type

Posted: Tue Jun 11, 2019 8:15 pm
by Husky
garciadelcastillo wrote:
Tue Jun 11, 2019 7:10 pm
Which property is making the line render so thick? What am I missing?
That is a Polyline with customized width. That's not the layer line weight.

Husky-2019.06.11-01.png
Husky-2019.06.11-01.png (29.47 KiB) Viewed 7941 times

Re: Strange line weight on line type

Posted: Tue Jun 11, 2019 9:41 pm
by garciadelcastillo
Ooooh, I see, that makes sense. So, how could I change that through ECMAScript? I only see getters for the vertices on the RPolylineEntity class:

https://www.qcad.org/doc/qcad/latest/de ... 473dbad57c
https://www.qcad.org/doc/qcad/latest/de ... be84f33925

Thanks!

Re: Strange line weight on line type

Posted: Wed Jun 12, 2019 10:02 am
by andrew
I can confirm the setter methods are not exposed to the entity class.

You'd have to do this (where e is your RPolylineEntity object):

Code: Select all

e.castToShape().setStartWidthAt(0,7);

Re: Strange line weight on line type

Posted: Fri Jun 14, 2019 8:45 am
by garciadelcastillo
Sounds good.

In your code, are 0 the vertex index and 7 the line width in drawing units? Should I then iterate over all vertices in the polyline, setting Start and EndWidth? How about using RPolyline.setWidth(double) to set the width of the whole thing?

Thanks a lot!

Re: Strange line weight on line type

Posted: Fri Jun 14, 2019 10:28 pm
by andrew
garciadelcastillo wrote:
Fri Jun 14, 2019 8:45 am
In your code, are 0 the vertex index and 7 the line width in drawing units?
Yes.
garciadelcastillo wrote:
Fri Jun 14, 2019 8:45 am
How about using RPolyline.setWidth(double) to set the width of the whole thing?
That would be setGlobalWidth(double).