Skip to content

GerberToImage bug #163

@icewenwu

Description

@icewenwu

hello,
1、CreateImageForSingleFile, SaveGerberFileToImageUnsafe, when BoardLayer.Outline

if (State.Layer == BoardLayer.Outline)
{
// PLS.PreCombinePolygons = true;
// forcezero = true;
}
if (FileType == BoardFileType.Drill)
{
PLS = PolyLineSet.LoadExcellonDrillFile(log, GerberFilename); ;
}
else
{
PLS = PolyLineSet.LoadGerberFile(log, GerberFilename, forcezero, Gerber.WriteSanitized, State);

}
double WidthInMM = PLS.BoundingBox.BottomRight.X - PLS.BoundingBox.TopLeft.X;
double HeightInMM = PLS.BoundingBox.BottomRight.Y - PLS.BoundingBox.TopLeft.Y;
int Width = (int)(Math.Ceiling((WidthInMM) * (dpi / 25.4)));
int Height = (int)(Math.Ceiling((HeightInMM) * (dpi / 25.4)));

PLS.BoundingBox
Image

2、GIC.WriteImageFiles, DrawBoard, when BoardLayer.Outline

scale = dpi / 25.4d; // dpi
var OutlineBoundingBox = GetOutlineBoundingBox();

double bw = Math.Abs(OutlineBoundingBox.BottomRight.X - OutlineBoundingBox.TopLeft.X);
double bh = Math.Abs(OutlineBoundingBox.BottomRight.Y - OutlineBoundingBox.TopLeft.Y);
int width = (int)((bw * scale));
int height = (int)((bh * scale));

//if (width > scale * 100) width = (int)(scale * 100);
//if (height > scale * 100) height = (int)(scale * 100);

int w = width + 3;
int h = height + 3;

Image

same Outline file ,value different,pic w and h different,why?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions