@zz555,
This seems like the beginnings of a really good plugin for EasyEDA but there are some things that need a bit more work.
1) Relying on a proprietary, commercial 3rd party tool is less than ideal. Not everyone has or can afford a legal copy of Photoshop.
The good news though is that it seems possible to use the Free and Open Source Software tool, Gimp, to edit the line width of the generated PNG file.
I have not explored it fully but the following steps are nearly right. (At the moment the exported image has a border round ti which I have not worked out how to avoid.)
Open the file in Gimp;
Click on the Fuzzy select wand in the Toolbox Tool Options pallette;
Click on the image in Gimp
click Edit > Stroke Selection;
Change the Line Width;
Click Stoke;
File > Export As... to export as a PNG.
The line width of the image after exporting from Gimp is not great but that might be my inexperience with Gimp.
2) There is howwever a bigger problem because in EasyEDA it is not possible to assign a net name to copper imported as an image. It is also not possible to convert copper imported as an image to a track or a pad.
This creates DRC errors when trying to connect from a track to the copper of the spiral. The following topics describe some of the issues.
[https://easyeda.com/forum/topic/How-to-design-a-PCB-Lib-for-a-PCB-Antenna-efa50ba1cdd9433c958ceedbad520398](https://easyeda.com/forum/topic/How-to-design-a-PCB-Lib-for-a-PCB-Antenna-efa50ba1cdd9433c958ceedbad520398)
[https://easyeda.com/forum/topic/How-to-avoid-DRC-errors-when-connecting-to-PCB-Footprints-a-k-a-PCB-Libs-90bf944fe3644b21a7d27a9e9d8df8d6](https://easyeda.com/forum/topic/How-to-avoid-DRC-errors-when-connecting-to-PCB-Footprints-a-k-a-PCB-Libs-90bf944fe3644b21a7d27a9e9d8df8d6)
[https://easyeda.com/forum/topic/Copy-existing-PCB-from-a-scan-bdd1817ca030420c8139b06781f45983](https://easyeda.com/forum/topic/Copy-existing-PCB-from-a-scan-bdd1817ca030420c8139b06781f45983)
[https://easyeda\.com/forum/topic/Import\_custom\_PCB\_layout\_from\_Fusion\_360\-9USQOMJHF](https://easyeda.com/forum/topic/Import_custom_PCB_layout_from_Fusion_360-9USQOMJHF)
[https://easyeda\.com/forum/topic/Pre\_Designed\_PCB\_into\_EasyEDA\-nt20YWwol](https://easyeda.com/forum/topic/Pre_Designed_PCB_into_EasyEDA-nt20YWwol)<br>
<br>
There may be a way to export or convert the PNG file to an SVG file and then use Andreas Bernhofer's ESVG Import xtension: in
[https://easyeda.com/forum/topic/Extension-User-Extensions-for-EasyEDA-Summary-9e065b68316f4491a3911dc6204be31e](https://easyeda.com/forum/topic/Extension-User-Extensions-for-EasyEDA-Summary-9e065b68316f4491a3911dc6204be31e)<br>
<br>
3) Better still, add an adjustable width function to your tool and the ability to export it directly as an SVG file.
:)
@zz555
You can use a script directly in EasyEDA to create the spiral.
Go to `Advanced - Extensions - Run Script...` and run this, which is just a copy of your code, adapted to use the API:
``` js
source = api('getSource','json');
d = 100;
s = 3;
l = 1000;
centerx = source.canvas.originX;
centery = source.canvas.originY;
points = [];
for (i=0; i<l; i++) {
a=0.1*i;
points.push({
x: centerx+(d+s*a)*Math.cos(a),
y: centery+(d+s*a)*Math.sin(a),
})
}
api('createShape',{
shapeType:'TRACK',
"jsonCache": {
layerid: "1",
strokeWidth: 10,
pointArr: points
}
});
```
The scale is off, as the base unit in EasyEDA is 0.01 inch, but I guess you can use that to generate a proper script :)
**@andreasbernhofer**, thank you!
Works much better.
This is what I was looking for.
**My settings for this coil:**
d = 10;
s = 0.6;
l =
1360;
strokeWidth: 2
1 img - EasyEDA Script
2 img - old method (for comparison)
![New 2.png](//image.easyeda.com/pullimage/RNNvWlngx1vEoJzqmzDKE1eZ06Iy0ULpK1q1m8vG.png)
@zz555 It would be great to have it for easyeda pro. I was analyzing it, and it seems that can be modified to create square coils, but could not find enough documentation on easy eda pro to convert the script.
<font _mstmutation="1">@osoverflow </font>@osoverflow Hello, if interested in extending the api program, you can take a look at the tutorial on our official website:[What is Extension API? \| EasyEDA Pro User Guide](https://prodocs.easyeda.com/en/api/guide/)
@haidy_easyeda This is the first release of the extension for EasyEDA PRO, based on the code from @andreasbernhofer
<br>
[https://github.com/medisoft/pcb-coil-generator](https://github.com/medisoft/pcb-coil-generator)<br>
<br>
I could not find a way to set parameters for the code, and neither to close the modal. Any idea?
Nice try\! If you are trying to store parameters for later use\, try the SYS\_Storage interface\, which stores data for extensions\. And to close the iFrame frame you can use the SYS\_IFrame\.closeIFrame\(\) method\.@osoverflow
Our website uses essential cookies to help us ensure that it is working as expected, and uses optional analytics cookies to offer you a better browsing experience. To find out more, read our Cookie Notice