Import custom graphics to silk

Making PCB Layouts, Manual routing, Auto-routing, Copper pouring, Updating from Schematic, Manufacturing Output
Message
Author
gschulz
Posts: 10
Joined: 22 Mar 2020, 19:32

Import custom graphics to silk

#1 Post by gschulz » 27 Mar 2020, 18:38

I've been using DipTrace since 2005 and have been very happy with it. Recently, I tried to do something I never did before, place custom graphics on the silk screen (company logo, etc). The tools in DipTrace were inadequate to generate the graphics I wanted, so I resorted to external third party tools (i.e. InkScape). The tool can generate DXF and I found other tools that could convert to Gerber. I tried almost 30 tools for the conversion and not one worked correctly with DipTrace. The problem is that when importing either DXF or Gerber (the only options) to the silk layer, the cutouts in objects are not honored. For example, the letter O has an outer object and an inner object that represents the hole. When importing a DXF, I get 2 separate objects with neither filled in. When importing Gerber, I get 2 separate filled in objects on different layers. In regards to Gerbers, a new layer is generated every time there is a %LPD*% or %LPC*% command. %LPC*% is supposed to set polarity to "clear", which is supposed to "undrawn" portions of the image (i.e. the hole in the center of the letter 'O'). Instead, I get a new layer with another filled object the shape of the hole. On a side note, of the 28 tools I tried for conversion, no 2 tools behaved the same. I thought this was supposed to be a standard.

Can anyone tell me how to successfully import external custom graphics to the silk layer? If I have to, I can generate a functional Gerber separately and include it in the stack up, but I would prefer to observe it with the other components in DipTrace and export it from the same source. It is also nice to view the project in the 3D viewer.

Alex
Technical Support
Posts: 3197
Joined: 14 Jun 2010, 06:43

Re: Import custom graphics to silk

#2 Post by Alex » 30 Mar 2020, 14:24

When you import DXF files please try to enable options "Fill Closed Areas" and "Embedded Polygons". If result is still bad, you can upload your files on the forum and we will try to import them in DipTrace.
In regards to Gerber files, DipTrace doesn't support multi-layer gerbers with negative layers.

gschulz
Posts: 10
Joined: 22 Mar 2020, 19:32

Re: Import custom graphics to silk

#3 Post by gschulz » 31 Mar 2020, 04:45

Yes, I checked the fill and embedded options. The inner and outer objects load as 2 separate outlines without fill. The DXF file is included in the attached ZIP file.

In regards to the Gerber, I attached a zip containing SquareTest.gbr. In it is a simple, very short gerber file that generates a square with a cutout. This is an example of a typical alpha character with a hole, such as the letter "O". If you view this test file in a gerber viewer, it displays properly, showing a square wilth a square hole in it. However, if you try to import it into DipTrace, it shows 2 separate squares, both filled in and placed on 2 separate layers. If I can export gerbers that work correctly, why cant I import gerbers correctly? I haven't tried it, but I'll bet I can't import gerbers that were generated by DipTrace.

To discuss the details of the gerber, here are excerpts from the gerber file:

%LPD*%---------------This sets the drawing mode to "Dark"
%ADD10C,0.010*%
D10*
G36*------------------This starts a new region
X0Y0D02*=----------- \
X500000Y0D01*--------\
Y500000D01*------------> Draw a square 5mm x 5mm
X0D01*------------------/
Y0D01*----------------/
G37*------------------This ends the region

%LPC*%---------------This sets the drawing mode to "Clear" to "Undraw"
G36*------------------This starts a new region
X100000Y100000D02*-\
X400000Y100000D01*--\
Y400000D01*-------------> Unraw a square 3mm x 3mm inside the other square
X100000D01*-----------/
Y100000D01*----------/
G37*-------------------This ends the region

When imported to DipTrace, an object 5mm x5mm is drawn and filled in and placed on a layer. An additional object is drawn 3mm x 3mm and filled in and placed on a second layer.

If there is something wrong with either of these formats, please let me know. If necessary, I can write a tool to make corrections to the files before importing.
You do not have the required permissions to view the files attached to this post.

Tomg
Expert
Posts: 1524
Joined: 20 Jun 2015, 14:39

Re: Import custom graphics to silk

#4 Post by Tomg » 31 Mar 2020, 16:43

For anyone who may be interested, here are a few observations which might help. I tried importing the DXF drawing into Alibre Design and this is what appeared...
A.png
Next, I imported the DXF drawing into the PCB Layout editor (v4-Beta.2) without enabling the fill options and the result was the expected outline drawing; but with some missing objects/letters...
D.png
Finally, I exported the flawed outline drawing from the PCB Layout editor as a DXF file, opened that file in Alibre Design and saved a small section. The illustration below shows the small section of the "Original" drawing on the left. I placed a modified version of the small-section drawing on the right to show what is needed for DipTrace to interpret it correctly when the fill options are enabled. Notice that the "Required" drawing consists of a closed polygon with no gaps or crossing lines...
R.png
It is possible that some of the problems are being caused by objects that are not closed polygons and/or have crossing lines. A quick glance suggests that objects exhibiting similar characteristics may have caused the problems in the first two screen shots above. Could be wrong, of course. These are just my observations and are only meant as food for thought.
You do not have the required permissions to view the files attached to this post.
Tom

gschulz
Posts: 10
Joined: 22 Mar 2020, 19:32

Re: Import custom graphics to silk

#5 Post by gschulz » 31 Mar 2020, 21:46

Thank you for the feed back. I would also like to point out that your 2 results are yet different from the other 28 tools I tried, so there are now 30 different results.

In regards to the test where you loaded the graphic into a PCB editor, notice that the letters that are missing are all letters with holes in them (embedded objects), like A, B, D, e, g, O, P, Q, R?

gschulz
Posts: 10
Joined: 22 Mar 2020, 19:32

Re: Import custom graphics to silk

#6 Post by gschulz » 31 Mar 2020, 22:47

Additional Information: I took a sample PCB and exported to Gerber (attached in Gerbers.zip, export.png). Export.png is a screen shot from DipTrace PCB. After exporting it, I loaded it up in a third party Gerber viewer and it looked identical. I then imported it back to DipTrace PCB and the screen shot looks like Import1.png. On the right edge, you can see three layers, a Green, Red and Drab. If you uncheck the green layer, the holes are revealed on the red layer (Import2.png). If you look at the gerber data, you will see 2 %LPD*% and 1 %LPC*% which sets the draw and undraw modes respectively. These 3 commands correspond to the 3 Gerber Layers that are indicated. The Gerber Undraw mode was not honored and was instead placed on a new layer as additional filled objects. This does not meet the Gerber spec.

Conclusion: DipTrace cannot import Gerber files that it generated.
You do not have the required permissions to view the files attached to this post.

fi2eewill
Posts: 29
Joined: 09 Sep 2016, 14:10

Re: Import custom graphics to silk

#7 Post by fi2eewill » 01 Apr 2020, 01:58

why not import graphic directly in new PCB layout, export Gerber layer and re-import as silk
group as component so you can easily move it around...

i took a snapshot of the Required logo above, if i had the original logo picture the lines would be a lot better
as you can see the tiger silk resembles the photo with great fidelity
You do not have the required permissions to view the files attached to this post.
Last edited by fi2eewill on 02 Apr 2020, 01:24, edited 1 time in total.

gschulz
Posts: 10
Joined: 22 Mar 2020, 19:32

Re: Import custom graphics to silk

#8 Post by gschulz » 01 Apr 2020, 06:24

fi2eewill, excellent suggestion! Thanks for the feedback. Your suggestion is the closest I've seen to a usable approach, but it's still not quite there. When you import and image like this, DipTrace rasterizes the image into a gerber. Unfortunately, the gerber isn't generated at the same resolution as the original raster image, so there is distortion and errors in the conversion (see attachment). However, what I learned from your suggestion is that the gerber DipTrace generates does not include any %LPC*% commands and does not "undraw" any of the image. Based on this, I now know what DipTrace is expecting and can write a conversion tool that will convert a raster image directly into an equally high resolution gerber that can be imported into DipTrace.

To be clear, the "Import Gerber" feature in DipTrace is broken and I wouldn't have this issue if it worked properly.

ImportTest.png
You do not have the required permissions to view the files attached to this post.

fi2eewill
Posts: 29
Joined: 09 Sep 2016, 14:10

Re: Import custom graphics to silk

#9 Post by fi2eewill » 02 Apr 2020, 02:47

I see, from my experiment, DipTrace "recognized accuracy" bottoms at 1mil line width when you export the Gerber layer...
for me 1 mil seems to work with most images I import.. Text, unless vector, you will have distorted lines it seems
not sure how you plan to generate high resolution image Gerber and if DipTrace will actually recognize the import

the other factor here even if say DipTrace can give you 0.1mil line width, the final silk screen look will depend on print resolution at the PCB fab, so not sure if it's worth the hassle... Unlikely to find people using PCBs soldermask as a painting canvas :P - who knows i might have struck on a gold idea here :D
You do not have the required permissions to view the files attached to this post.

gschulz
Posts: 10
Joined: 22 Mar 2020, 19:32

Re: Import custom graphics to silk

#10 Post by gschulz » 03 Apr 2020, 00:23

fi2eewill, I couldn't get the 1 mil resolution you did, noticeably sharper than what I achieved. I took the day and wrote a tool that will do what I want (attached if you're interested). With my tool, I was able to create a gerber that lined up exactly with the PCB and had the resolution I wanted. My tool generates a gerber that does not use %LPC*% commands to "Undraw" parts of the image. Instead, it draws a raster and only places additive imagery to the file. It allows scaling and offset for fine tuning the graphic. The resulting gerber imported properly to DipTrace and avoids it's broken features:
VCO1_Fixed.png
Silk Layer Exported from DipTrace and viewed on third party viewer:
VCO1_Exported.png
In regards to your idea of painting on the PCB, that is what I was trying to achieve, a PCB with circuitry on one side and a front panel on the other. There are YouTube videos of similar solutions:





My hybrid PCB attempt:
VCO1c.png
VCO1b.png
Thanks for your suggestions and helping me to find a solution. Be warned: if you want to play with my tool, I didn't take the time to code in much in the way of safeguards. When converting to output, it will over-write a same-named file without warning. The input is a monochrome BMP and the output changes file extension to GBR. Contact me if you want more details.
You do not have the required permissions to view the files attached to this post.

Post Reply