Git Product home page Git Product logo

stretch's People

Contributors

glebsexy avatar jarrettr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

stretch's Issues

PCB Does not save to out.svg

When I attempt to export from Kicad to svg, the only thing that appears in the svg is some pads under 'Modules'. The F.SilkS does not appear. When I add to the 'F.SilkS' in Inkscape and use stretch to bring it back into Kicad, nothing changes in the PCB layout. I tried changing the name of the Inkscape layout to 'F.Silkscreen' to match what shows in Kicad layers to no avail.

Any ideas on what I am doing wrong?

Thank you,

Vias and Copper Zones

I cant export the SVG file from kicad when vias or coper zones are in the PCB design.

When a via is in the design it shows this error:

Exception on python action plugin code

Traceback (most recent call last):

File "/home/user/.kicad/scripting/plugins/Stretch/Stretch/kiplug/-kicad.py" line 42, in Run
a.Run Plugin(pcb Filename, self.svg file name)

File "/home/user/.kicad/scripting/plugins/tretch/Stretch/kiplug/-
svg writer.py line 117 in Run Plugin
svg board.To_ SVG()

File /home/user/.kicad/scripting/plugins/stretch/stretch/kiplug/-
Doard.py line 254in To_SVG
tag-Beautifulsoup(item.To SVG) html.parser)

File "/home/user/.kicad/scripting/plugins/Stretch/Stretch/kiplug/
via py line 188, in To SVG
holefill#colourAssign( Via.lnner

TypeError Assign) missing 1 required positional argument: 'layername'

`soupsieve` package is not installed

When I installed and refresh this plugin, it shows "The soupsieve package is not installed. CSS selectors cannot be used."

I solved this issue by installing the required package to the KiCad python. However, is it possible to install all the required packages during the initialisation or installation stage?

Text severely messed up on export

Using:
Inkscape 1.0.2 (1.0.2+r75+1)
KiCad Version: 5.1.10-88a1d61d5888ubuntu20.04.1, release build

Libraries:
    wxWidgets 3.0.4
    libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Platform: Linux 5.4.0-72-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
    Boost: 1.71.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.68.0
    Compiler: GCC 9.3.0 with C++ ABI 1013

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=ON
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Linux Mint 20.1
Stretch latest

I tried Stretch export on a sandbox example and it badly messes up text on output. Font sizes are wrong, at least one text object is moved, and a bunch are gone entirely. And several %R references are unresolved.

KiCad original:
kicad_sandbox_orig

Stretch export:
stretch_sandbox_export

Plugin doesn't load in KiCad 8.0 `No module named 'bs4'`

Hello. Thanks for this plugin. I installed v1.3 via the plugin manager but the plugin doesn't load. The "plugin errors" dialog under preferences shows me the following:

  File "/Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/aocole/Documents/KiCad/8.0/3rdparty/plugins/com_github_jarrettr_stretch/__init__.py", line 3, in <module>
    from .kiplug.svg_writer import SvgWrite
  File "/Users/aocole/Documents/KiCad/8.0/3rdparty/plugins/com_github_jarrettr_stretch/kiplug/svg_writer.py", line 4, in <module>
    from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'

Oversized pads

I'm not quite sure when this happened, but I noticed that the pads on one of my footprints are enlarged:
image
There is a workaround with right click -> update footprint:
image.
It also shows up in Inkscape, but I imported/exported multiple times so it could've happened anytime.
image
I'm on lnkscape 1.0.2-2 (e86c870879, 2021-01-15)
KiCad :

Version: (5.1.9)-1, release build
Libraries:
    wxWidgets 3.0.5
    libcurl/7.71.0 OpenSSL/1.1.1g (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.41.0
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.73.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.71.0
    Compiler: GCC 10.2.0 with C++ ABI 1014
Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON 

Windows 10
Latest Stretch.

Convert SVG bezier traces to KiCad curves

With KiCad 8, arbitrary shapes can be connected to nets. Instead of the Inkscape hack with adding line segments to approximate curved traces, this can now be done natively.

The s-expression for the curves are like this:

	(gr_curve
		(pts
			(xy 66.4748 93.278) (xy 62.7248 90.378) (xy 64.2748 96.428) (xy 61.012077 95.482793)
		)
		(stroke
			(width 0.2)
			(type default)
		)
		(layer "F.Cu")
		(net 7)
	)

That ends up looking like this:
image

The four sets of points will end up looking like this in Inkscape:
image

Kicad 8.0 support

Hi,

I'm using the Stretch plugin that can be installed through KiCad's plugin manager.
Importing back even the unmodified SVG int KiCad 8.0 gives me the following error:

image

Original pcb file:
kicad_test.kicad_pcb.txt

Stretch converted SVG to pcb:
kicad_test.kicad_pcb_imported.txt

Looks like the problem is with this line:
(generator_version 8.0)
The version number should be in quotes like
(generator_version "8.0")

documentation clarifications needed

The installation instructions mention this step:

Install dependencies using D:\Programs\KiCad\bin\python.exe -m pip install bs4 (but substituting your own KiCad\bin path)

Is the assumption correct that this needs to be entered into the windows console with administrator privileges?
What is the equivalent instruction for other platforms, Linux in particular?
Is the extension designed and tested in kicad nightly or only in stable?

Remove the external BS4 dependency

In addition to making this plugin difficult to install, it also removes the ability to use the new KiCad plugin manager.

BeautifulSoup can be downloaded and included as a set of flat files in this repo, and in fact, it has been for some time, in the BS folder. That folder has been unused so far, though.

The problem with using it is that Python embedded in KiCad treats relative path imports really strangely. I attempted to get this working last year for a little while, but it was tricky, undocumented, and wasn't necessary for the minimum viable product.

Trying again to figure this out is becoming a higher priority now.

TypeError: can only concatenate str (not "list") to str

Thanks for the plugin! I just installed it in kicad 8.0 from the plugin manager. After setting up bs4 (ie from #36) I tried to export one of my boards to SVG and get the following exception.

TypeError: can only concatenate str (not "list") to str

Here is a screenshot of the error message.
image

Inclusion of DXF in tool

I am considering extending the tool to include DXF round trip translations along side SVG, as the formats and conversions are similar. Would you be interested in having it added to your repo if I go down that path? If I fork, both efforts may have less overall support.

Inkscape Beizer

When i try to fatten the beizer curves in inkscape this error shows in the log:

Traceback (most recent call last):
File "flatten.py", line 44, in
Flatten().run()
File "/snap/inkscape/9256/share/inkscape/extensions/inkex/base.py", line 130, in run
self.load_raw()
File "/snap/inkscape/9256/share/inkscape/extensions/inkex/base.py", line 143, in load_raw
document = self.load(self.file_io)
File "/snap/inkscape/9256/share/inkscape/extensions/inkex/base.py", line 317, in load
document = load_svg(stream)
File "/snap/inkscape/9256/share/inkscape/extensions/inkex/elements/_base.py", line 92, in load_svg
return etree.parse(stream, parser=SVG_PARSER)
File "src/lxml/etree.pyx", line 3521, in lxml.etree.parse
File "src/lxml/parser.pxi", line 1880, in lxml.etree._parseDocument
File "src/lxml/parser.pxi", line 1900, in lxml.etree._parseFilelikeDocument
File "src/lxml/parser.pxi", line 1795, in lxml.etree._parseDocFromFilelike
File "src/lxml/parser.pxi", line 1201, in lxml.etree._BaseParser._parseDocFromFilelike
File "src/lxml/parser.pxi", line 615, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 725, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 654, in lxml.etree._raiseParseError
File "/tmp/ink_ext_XXXXXX.svgUCIJF1", line 2
lxml.etree.XMLSyntaxError: XML declaration allowed only at the start of the document, line 2, column 6

How can I fix it?

Corrupt PCBs can't be smoothly recovered from

If something bad happens and Stretch generates a corrupt/invalid PCB, and then you won't be able to open it in KiCad. When you can't open it, you can't click the DOWN arrow, and can't generate a new, good PCB.

Current workaround is just to replace the PCB file with literally any one that works in your OS file manager so you can open it and hit that arrow, but it's janky.

A slightly better solution is to back up the existing PCB before replacing it with the newly generated one.

Stretch to SVG fails with exception

Kicad V6.0.9, Linux
Exporting PCB to SVG fails with an exception in file text.py at line 237:
if len(self.at) > 2:

angle += float(self.at[2])

because there is an additional parameter "unlocked":

(fp_text reference "S2" (at 0 4 unlocked) (layer "B.SilkS")

A line with an angle looks like this:

(fp_text reference "S2" (at 0 4 -45 unlocked) (layer "B.SilkS")

Changing the above lines to
if len(self.at) > 3:

angle += float(self.at[2])

seems to fix the issue.

Not able to see plugin icons

Copied the contents of Stretch-master to my plugins folder
C:\Program Files\KiCad\share\kicad\scripting\plugins
however, I am not able to load the plugins (refresh does not see anynew items).
Care to provide a sample?

Windows depedency installation error

I was trying to install the dependency bs4 as mentioned in the instruction which gives an exception error as attached in the picture.

image

Can I install from the Cmd prompt(Python 3.8.5) like "pip install bs4" instead of "\KiCad\bin\python.exe -m pip install bs4 " ?
What is the difference?

Unable to curve lines

When I convert straight line segments to curves then reimport to KiCad, they continue to appear there as lines with the same endpoints instead of curves. Is there a specific way to create a curved board outline or trace?

Changes not seen

I may just be misunderstanding the workflow or something, but the documentation does say:

"Make your modifications. Bend some lines, draw some pictures, rotate some footprints"

So I tried:

  • Export to SVG
  • In SVG, go into F.Silk layer
  • Draw a circle (using the circle/ellipse tool)
  • Change some text
  • Save the file
  • In KiCad hit down arrow, close and reopen PCBnew window

The PCB appears with the text changed, but no sign of the circle I drew.

'NoneType' object has no attribute 'next_element'

This almost seems to be a bug in BeautifulSoup, although it hasn't seemed to crop up in KiCad 5 at all. It also only seems to happen when stretching up, right after stretching down.

It's generated from base.svg.find('g', {'inkscape:label': layer}, recursive=True) in board.py.
layer is F.Cu or anything else really.

The base.svg XML triggers the packaged BS in isolation, without using Stretch as a plugin:

<svg height="297mm" id="svg8290" inkscape:version="0.92.4 (5da689c313, 2019-01-14)" sodipodi:docname="base.svg" version="1.1" viewbox="0 0 210 297" width="210mm" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg">
<defs id="defs8284"></defs>
<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="svg8290" inkscape:cx="-8.4507329" inkscape:cy="782.79942" inkscape:document-units="mm" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="1137" inkscape:window-maximized="1" inkscape:window-width="1920" inkscape:window-x="-8" inkscape:window-y="32" inkscape:zoom="0.7" pagecolor="#000000" showgrid="false"></sodipodi:namedview>
<metadata id="metadata1">
<rdf:rdf>
<cc:work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"></dc:type>
<dc:title></dc:title>
</cc:work>
</rdf:rdf>
</metadata>
<kicad></kicad><g attribs="user" id="layer58" inkscape:groupmode="layer" inkscape:label="User.9" number="58"></g><g attribs="user" id="layer57" inkscape:groupmode="layer" inkscape:label="User.8" number="57"></g><g attribs="user" id="layer56" inkscape:groupmode="layer" inkscape:label="User.7" number="56"></g><g attribs="user" id="layer55" inkscape:groupmode="layer" inkscape:label="User.6" number="55"></g><g attribs="user" id="layer54" inkscape:groupmode="layer" inkscape:label="User.5" number="54"></g><g attribs="user" id="layer53" inkscape:groupmode="layer" inkscape:label="User.4" number="53"></g><g attribs="user" id="layer52" inkscape:groupmode="layer" inkscape:label="User.3" number="52"></g><g attribs="user" id="layer51" inkscape:groupmode="layer" inkscape:label="User.2" number="51"></g><g attribs="user" id="layer50" inkscape:groupmode="layer" inkscape:label="User.1" number="50"></g><g attribs="user" id="layer49" inkscape:groupmode="layer" inkscape:label="F.Fab" number="49"></g><g attribs="user" id="layer48" inkscape:groupmode="layer" inkscape:label="B.Fab" number="48"></g><g attribs="user" id="layer47" inkscape:groupmode="layer" inkscape:label="F.CrtYd" number="47"></g><g attribs="user" id="layer46" inkscape:groupmode="layer" inkscape:label="B.CrtYd" number="46"></g><g attribs="user" id="layer45" inkscape:groupmode="layer" inkscape:label="Margin" number="45"></g><g attribs="user" id="layer44" inkscape:groupmode="layer" inkscape:label="Edge.Cuts" number="44"></g><g attribs="user" id="layer43" inkscape:groupmode="layer" inkscape:label="Eco2.User" number="43"></g><g attribs="user" id="layer42" inkscape:groupmode="layer" inkscape:label="Eco1.User" number="42"></g><g attribs="user" id="layer41" inkscape:groupmode="layer" inkscape:label="Cmts.User" number="41"></g><g attribs="user" id="layer40" inkscape:groupmode="layer" inkscape:label="Dwgs.User" number="40"></g><g attribs="user" id="layer39" inkscape:groupmode="layer" inkscape:label="F.Mask" number="39"></g><g attribs="user" id="layer38" inkscape:groupmode="layer" inkscape:label="B.Mask" number="38"></g><g attribs="user" id="layer37" inkscape:groupmode="layer" inkscape:label="F.SilkS" number="37"></g><g attribs="user" id="layer36" inkscape:groupmode="layer" inkscape:label="B.SilkS" number="36"></g><g attribs="user" id="layer35" inkscape:groupmode="layer" inkscape:label="F.Paste" number="35"></g><g attribs="user" id="layer34" inkscape:groupmode="layer" inkscape:label="B.Paste" number="34"></g><g attribs="user" id="layer33" inkscape:groupmode="layer" inkscape:label="F.Adhes" number="33"></g><g attribs="user" id="layer32" inkscape:groupmode="layer" inkscape:label="B.Adhes" number="32"></g><g attribs="signal" id="layer31" inkscape:groupmode="layer" inkscape:label="B.Cu" number="31"></g><g attribs="signal" id="layer0" inkscape:groupmode="layer" inkscape:label="F.Cu" number="0"></g><g inkscape:groupmode="layer" inkscape:label="Vias" type="layervia" user="True"></g><g inkscape:groupmode="layer" inkscape:label="Modules" type="module" user="True"></g><g inkscape:groupmode="layer" inkscape:label="Zones" type="layerzone" user="True"></g></svg>

More investigation needed. This does not happen with system-wide Pip installs of BS4.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.