Software Companions Support Forum
Register Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
softcomp

Administrator
Registered:
Posts: 126
Reply with quote  #1 
The following sample code will load 7 different Gerber layers and then draw them all on an image using the ConvertGerberLayersToImageEx method.

Dim myconverter As scConverterLib.Converter = New scConverterLib.Converter

myconverter.SetSerialNumber("Your Serial Number")

'Set black background color and add all layers
myconverter.BackgroundColor = 0

myconverter.AddGerberLayer("http://www.gerbview.com/demo/gerbview/LAYER1.gbx", &HFF, 0)
myconverter.AddGerberLayer("http://www.gerbview.com/demo/gerbview/LAYER2.gbx", &HFF00, 0)
myconverter.AddGerberLayer("http://www.gerbview.com/demo/gerbview/LAYER3.gbx", &HFF0000, 0)
myconverter.AddGerberLayer("http://www.gerbview.com/demo/gerbview/LAYER4.gbx", &HFF00FF, 0)
myconverter.AddGerberLayer("http://www.gerbview.com/demo/gerbview/CMASK.gbx", &HFFFF00, 0)
myconverter.AddGerberLayer("http://www.gerbview.com/demo/gerbview/SMASK.gbx", &HFFFF, 0)
myconverter.AddGerberLayer("http://www.gerbview.com/demo/gerbview/SILK.gbx", &HAA, 0)
'Create image with all layers

Dim mypicture As stdole.IPictureDisp = Nothing
myconverter.ConvertGerberLayersToImageEx(1.0, 24, 150, 0, mypicture)

Dim image As System.Drawing.Image = Nothing
image = image.FromHbitmap(mypicture.Handle, mypicture.hPal)

At this point you have an Image that can be used for display and/or saving.
E.g.:

PictureBox1.Image = image

or 
image.Save("c:\temp\test.png")


A complete VB.Net sample can be downloaded here (VS2010):

http://www.softwarecompanions.no/dev/ConvertGerberLayersToImageExVB.zip

Previous Topic | Next Topic
Print
Reply

Quick Navigation: