Skip to content

Commit

Permalink
Merge branch 'badgeek:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
drayde authored Sep 22, 2021
2 parents e402e5d + 42378e5 commit 1e7979c
Show file tree
Hide file tree
Showing 19 changed files with 376 additions and 224 deletions.
26 changes: 26 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2.1

orbs:
win: circleci/windows@2.2.0

jobs:
build:
executor:
name: win/default
shell: powershell.exe
steps:
- checkout
- run: systeminfo
- run:
name: "Build bitmap2component [windows]"
shell: bash.exe
command: |
choco install wget
choco install make
curl -O https://nuwen.net/files/mingw/mingw-17.1-without-git.exe
mingw-17.1-without-git.exe -o"C:\MinGW" -y
set PATH="%PATH%;c:\MinGW\bin"
make
ls
100 changes: 76 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,76 @@
language: node_js
node_js:
- '9'
env:
global:
- ENCRYPTION_LABEL: cabb09466128
- COMMIT_AUTHOR_EMAIL: travis@cocomake.co
- COMMIT_AUTHOR_NAME: Travis CI
before_install:
- uname -a
- sudo apt-get -qq update
- sudo apt-get install zip
script:
- bash build.sh
deploy:
provider: releases
api_key:
secure: KLiKx9YA0IMonTKywaxcdO00YCtXffJTmPlZj1edGAV1aKiWr8u9l5iW9qluNgUI/zeUCmJCJZj0V/k6U29E5lAbGRkngXfA0wqG3E4AxVPVjPQ17m2bipKJJRQjstrSgJCGjyNiBWVcAc3M2Ht/1TWEXFgzkjkBS8y0KdxO5vELgQ0e3MkTp+jTPqoPF7ap455nDydx5ck5wT9MWr+/JWcwnWcTzmVNemSeuwdp9q5xIlqhU0V8rFGBSf3NvRtIhH8DfCbEB/ZHF+qJk1AHFHP3rDaIEmCdvhBcZq3nNQToRKNpta4PO2OOq77ZHhck1oSqj/bLfIgD0m54fef6hyNLBsZskKxvWvC/ddCUolL5gQIntV9u6d8R50jYGTOIFjp9TrBoEgLa795Xiv4UfeXExc6C5lvZS6qOxT5gU0LnINb8lBBJIVK+/a4xDDE/F8IcGH+EeIKsGnncnH5Zb048bddGh/YHF5SLc7VjdCGFjMg4xp/RiBxrCPg545wmVf6GppUlpoYwC+rGjB/P+USpatYNIRW1Neh4+CAosPz8rrYA9g5tiW6SUdG4f0a98LlFcGCwQ79XwVwZGgyh+GhTSKGySypCAE7n0YfyVFcpR9USKqBcCRQVafAJm2B/59zx2Qfm2zOyEIwcfpURrFRMRnvolaaus0UmqSi51S0=
file_glob: true
file: "dist/*.zip"
skip_cleanup: true
on:
tags: true
branch: master
jobs:
include:
- stage: unit tests
os: windows
workspaces:
create:
name: windows-binaries
paths:
- bitmap2component.exe
language: cpp
compiler: cl
script:
- choco install make
- wget https://github.com/badgeek/svg2shenzhen/files/2404261/boost.zip
- unzip boost.zip
- mv boost src
- make
- stage: unit tests
os: linux
workspaces:
create:
name: linux-binaries
paths:
- bitmap2component_linux64
language: cpp
dist: trusty
script:
- wget https://github.com/badgeek/svg2shenzhen/files/2404261/boost.zip
- unzip boost.zip
- mv boost src
- make
- mv bitmap2component bitmap2component_linux64
- stage: unit tests
os: osx
workspaces:
create:
name: osx-binaries
paths:
- bitmap2component_osx
osx_image: xcode12u
language: cpp
script:
- wget https://github.com/badgeek/svg2shenzhen/files/2404261/boost.zip
- unzip boost.zip
- mv boost src
- make
- mv bitmap2component bitmap2component_osx
- stage: deploy
os: osx
language: minimal
sudo: true
workspaces:
use:
- linux-binaries
- osx-binaries
- windows-binaries
git:
clone: true
script:
- tar -zxvf ${CASHER_DIR}/linux-binaries-fetch.tgz
- tar -zxvf ${CASHER_DIR}/osx-binaries-fetch.tgz
- tar -zxvf ${CASHER_DIR}/windows-binaries-fetch.tgz
- mv home/travis/build/badgeek/svg2shenzhen/bitmap2component_linux64 ./inkscape/svg2shenzhen/bitmap2component_linux64
- mv ./C:/Users/travis/build/badgeek/svg2shenzhen/bitmap2component.exe ./inkscape/svg2shenzhen/bitmap2component.exe
- mv ./bitmap2component_osx ./inkscape/svg2shenzhen/
- sh build.sh
deploy:
provider: releases
api_key:
secure: KLiKx9YA0IMonTKywaxcdO00YCtXffJTmPlZj1edGAV1aKiWr8u9l5iW9qluNgUI/zeUCmJCJZj0V/k6U29E5lAbGRkngXfA0wqG3E4AxVPVjPQ17m2bipKJJRQjstrSgJCGjyNiBWVcAc3M2Ht/1TWEXFgzkjkBS8y0KdxO5vELgQ0e3MkTp+jTPqoPF7ap455nDydx5ck5wT9MWr+/JWcwnWcTzmVNemSeuwdp9q5xIlqhU0V8rFGBSf3NvRtIhH8DfCbEB/ZHF+qJk1AHFHP3rDaIEmCdvhBcZq3nNQToRKNpta4PO2OOq77ZHhck1oSqj/bLfIgD0m54fef6hyNLBsZskKxvWvC/ddCUolL5gQIntV9u6d8R50jYGTOIFjp9TrBoEgLa795Xiv4UfeXExc6C5lvZS6qOxT5gU0LnINb8lBBJIVK+/a4xDDE/F8IcGH+EeIKsGnncnH5Zb048bddGh/YHF5SLc7VjdCGFjMg4xp/RiBxrCPg545wmVf6GppUlpoYwC+rGjB/P+USpatYNIRW1Neh4+CAosPz8rrYA9g5tiW6SUdG4f0a98LlFcGCwQ79XwVwZGgyh+GhTSKGySypCAE7n0YfyVFcpR9USKqBcCRQVafAJm2B/59zx2Qfm2zOyEIwcfpURrFRMRnvolaaus0UmqSi51S0=
file_glob: true
file: "dist/*.*"
skip_cleanup: true
on:
tags: true
branch: master
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CXX=g++
CXXFLAGS=-std=c++11
INCLUDES=-Iinclude -Ipolygon -Ipotrace -Isrc
INCLUDES=-Iinclude -Ipolygon -Ipotrace -Isrc -I./ -IC:\MinGW\include
LIBS=

SOURCES:=\
Expand Down
115 changes: 85 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,127 @@
# Svg2Shenzhen
Inkscape extension for exporting drawing into Kicad PCB

![screenshot_125](https://i.imgur.com/gjFZZu3.jpg)
Inkscape extension for exporting drawings into a KiCad PCB.

![showcase](https://github.com/badgeek/svg2shenzhen/blob/master/doc/resources/showcase.jpeg?raw=true)

## Features

- Draw Any kind of shapes without restriction (unlike svg2mod)
- Support Drill Pad, and custom drill size
- Support Edge Cut (PCB Shape)
- Tested on OSX, and Windows and Linux
- Draw Any kind of shapes without restriction
- Supports Drill Pad, and custom drill size
- Supports Edge Cut (PCB Shape)
- Works on OSX, Windows and Linux

## Install

Download latest version (0.2.17) of [svg2shenzhen-extension.zip](https://github.com/badgeek/svg2shenzhen-next/releases)

Extract and copy the files into the directory indicated in Edit -> Preferences -> System: User extensions
Warning: starting from 0.2.18 svg2shenzhen only support Inkscape 1.0 and above

1. Download the latest version (0.2.18.7)
- Windows https://github.com/badgeek/svg2shenzhen/releases/download/0.2.18.7/svg2shenzhen-extension-0.2.18.7.zip
- Linux / OSX https://github.com/badgeek/svg2shenzhen/releases/download/0.2.18.7/svg2shenzhen-extension-0.2.18.7.tar.gz
- Release notes: https://github.com/badgeek/svg2shenzhen/releases
- Older version: https://github.com/badgeek/svg2shenzhen/releases

2. Extract and copy the files into the directory indicated in Inkscape under *Edit -> Preferences -> System: User extensions*

**Step by Step Guide with Screenshot**
- Go to your extracted folder it should look like this

![windowsStep0](https://github.com/badgeek/svg2shenzhen/blob/master/doc/resources/windows_step_0.png?raw=true)

- Copy all files *("svg2shenzhen" folder + svg2shenzhen_about.inx + svg2shenzhen_export.inx + svg2shenzhen_prepare.inx)*
- Open Inkscape and go **Edit --> Preferences**

![windowsStep1](https://github.com/badgeek/svg2shenzhen/blob/master/doc/resources/windows_step_1.png?raw=true)

- Under Preferences go to **System**, Now in **System info** you will see option ***User extensions:*** this is the path of extension. You can hit on ***Open*** icon and it will open up the folder.

![windowsStep2](https://github.com/badgeek/svg2shenzhen/blob/master/doc/resources/windows_step_2.png?raw=true)

- Paste all the files copied

![windowsStep3](https://github.com/badgeek/svg2shenzhen/blob/master/doc/resources/windows_step_3.png?raw=true)

- **Restart Inkscape**

## How to

1.Extension > Svg2Shenzhen > Prepare Document
2.Choose layer (F.Cu.. etc)
3.Draw PCB
4.Extension > Svg2Shenzhen > Export Kicad
In Inkscape:

1. *Extension > Svg2Shenzhen > Prepare Document*
2. Choose layer (F.Cu.. etc)
3. Draw PCB
4. *Extension > Svg2Shenzhen > Export KiCad*

Download and open [Example PCB](https://raw.githubusercontent.com/badgeek/svg2shenzhen-next/master/examples/viruspcb.svg)

## Tutorials

- Custom Footprints for Kicad - https://www.gabetaubman.com/blog/posts/kicad-custom-footprint/
- PCBArt Badge - http://blog.sheasilverman.com/2019/01/pcbart/
- Custom Footprints for KiCad - <https://www.gabetaubman.com/blog/posts/kicad-custom-footprint/>
- PCBArt Badge - <http://blog.sheasilverman.com/2019/01/pcbart/>

## Layername definitions

![screenshots_inkscape-3d-view](https://github.com/dusjagr/svg2shenzhen/raw/master/examples/myFirstPCB_comboScreen.png)

1. After the Prepare Document only the 2 fabrication layers are used, Edge.Cuts and Drill, and for the different PCB-layers only the F.Cu layer is active. The others have in the layer name "-disabled", change this by removing the ending to enable more layers.
2. Special use of Soldermaks layers: F.Mask and B.Mask. Due to the fabrication standard of PCB manufacturing, when enabled this will lead to the soldemask NOT present, where there are black areas in your design. This is kinda PCB / KiCAD standard, but can be confusing. If you want to Get-What-You-See from inkscape, meaning that you really draw the color, where you want the soldermaks to be change the layer name to "F.Mask-invert"
3. Super easy simple PCB with exposed copper, surrounded by soldermask can be generated automatically by leaving the F.Mask layer empty and renaming it to "F.Mask-auto".
4. Feel free to add your own layers, for testing graphics and designing stuff. All these other layernames will be ignored.
1. After the *Prepare Document* step, only two fabrication layers are used:
*Edge.Cuts* and *Drill*,
and for the different PCB-layers, only the *F.Cu* layer is active.
The others have the post-fix "-disabled" in their layer name;
change this by removing this post-fix to enable more layers.
2. Special use of the solder-mask layers *F.Mask* and *B.Mask*:
Due to the fabrication standard of PCB manufacturing,
when enabled, this will lead to the solder-mask NOT being present
where there are black areas in your design.
This is kinda PCB/KiCad standard, but can be confusing.
If you want to Get-What-You-See from Inkscape,
meaning that you really draw the color where you want the solder-mask to be,
change the layer name to *F.Mask-invert*
3. Super easy simple PCB with exposed copper surrounded by solder-mask,
can be generated automatically by leaving the *F.Mask* layer empty
and renaming it to *F.Mask-auto*.
4. Feel free to add your own layers, for testing graphics and designing stuff.
All these other layers will be ignored.

## Tips

1. For Edge.Cut layers, you need to convert any polygons or objects to paths with only an outline, no fill. Don't use any groups on Edge.Cut layers and if you have paths with inner cut outs break them apart into separate paths.
2. For Drill layers, place circle objects and they will be converted into drill pads in KiCad with the same diameter. These drills will not have annular rings unless you also add copper to the F.Cu and B.Cu layers. Don't use any groups on Drill layers either.
1. For *Edge.Cut* layers, you need to convert any polygons or objects to paths with only an outline, no fill.
Don't use any groups on *Edge.Cut* layers,
and if you have paths with inner cut-outs,
break them apart into separate paths.
2. For Drill layers, place circle objects,
and they will be converted into drill pads in KiCad with the same diameter.
These drills will not have annular rings,
unless you also add copper to the *F.Cu* and *B.Cu* layers.
Don't use any groups on the *Drill* layer either.

## References

- [Svg2Shenzhen Announcement on Gosh Community Forum](https://forum.openhardware.science/t/svg2shenzhen-save-inkscape-drawing-as-kicad-pcb/989)
- [PCB Art with Inkscape - Developer log](http://wiki.8bitmixtape.cc/#/4_7.1-PCB-Art-with-Kicad-and-Inkscape) on 8BitMixtape Wiki
- [PCB Art with Inkscape - Developer log](http://wiki.8bitmixtape.cc/#/4_7.1-PCB-Art-with-Kicad-and-Inkscape) on the 8BitMixtape Wiki
- [Practical Guide to Designing PCB Art](https://medium.com/@urish/a-practical-guide-to-designing-pcb-art-b5aa22926a5c)
- [KitSprint ANORG 2018](http://wiki.sgmk-ssam.ch/wiki/KitSprint_ANORG_2018#Kicad_bitmap_import_for_Shenzhen_Ready)

## Videos
- Drawing PCBs with Inkscape (FOSSDEM) with @kasbah of kitspace - https://www.youtube.com/watch?v=xXRPw7ItMaM
- Making a PCB Badge for Hackaday Supercon! - https://www.youtube.com/watch?v=YqdBiOj8uXw
- Understanding and Making PCB Art (mrtwinkletwinkle) https://www.youtube.com/watch?v=Sbkvza8cKQE

## Support this project

This project is developed independently and without any connection to funding or big collective or organization, Donation is highly appreciated, go to https://www.patreon.com/badgeek become a patron and support this project
This project is developed independently and without any connection to funding or big collective or organization.
Donation is highly appreciated.
Go to <https://www.patreon.com/badgeek> to become a patron and support this project

<a href="https://www.patreon.com/badgeek">
<img src="https://i.imgur.com/ys5X3ZP.png" >
</a>


## Contributors

- Budi Prakosa [@badgeek](https://github.com/badgeek)
- Kaspar Emanuel [@kasbah](https://github.com/kasbah)

## Credits
* inkscape-export-layers - https://github.com/jespino/inkscape-export-layers
* bitmap2component (kicad) - https://github.com/KiCad/kicad-source-mirror/tree/master/bitmap2component
* csv_output - https://github.com/tbekolay/csv_output
* svg2mod - https://github.com/mtl/svg2mod

* inkscape-export-layers - <https://github.com/jespino/inkscape-export-layers>
* bitmap2component (kicad) - <https://github.com/KiCad/kicad-source-mirror/tree/master/bitmap2component>
* csv_output - <https://github.com/tbekolay/csv_output>
* svg2mod - <https://github.com/svg2mod/svg2mod>
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ rm -fr $cwd/$BUILD_DIR/$BUILD_DIR_STAGING/*.bak

cd $cwd/$BUILD_DIR/$BUILD_DIR_STAGING

tar -czvf $cwd/$BUILD_DIR/${RELEASE_FILENAME_PREFIX}-${GIT_TAG_VERSION}.tar.gz .
zip -m -x .DS_Store -r $cwd/$BUILD_DIR/${RELEASE_FILENAME_PREFIX}-${GIT_TAG_VERSION}.zip .

cd $cwd
Expand Down
2 changes: 2 additions & 0 deletions common/geometry/shape_poly_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/

#define _USE_MATH_DEFINES
#include <cmath>

#include <vector>
#include <cstdio>
Expand Down
Binary file added doc/resources/showcase.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/resources/windows_step_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/resources/windows_step_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/resources/windows_step_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/resources/windows_step_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed inkscape/svg2shenzhen/bitmap2component.exe
Binary file not shown.
Binary file removed inkscape/svg2shenzhen/bitmap2component_linux64
Binary file not shown.
Binary file removed inkscape/svg2shenzhen/bitmap2component_osx
Binary file not shown.
Loading

0 comments on commit 1e7979c

Please sign in to comment.