You need to use EasyEDA editor to create some projects before publishing
Improved teardrops and curved traces
1800 13
Matt Shepcar 3 years ago
I recently read this [https://mitxela.com/projects/melting_kicad](https://mitxela.com/projects/melting_kicad) and thought I would have a go at making an equivalent EasyEDA script.  The result is here: [https://github.com/mattshepcar/easyeda-round-tracks](https://github.com/mattshepcar/easyeda-round-tracks) ~~It would be nice to turn this into a proper EasyEDA extension using the javascript API but I'm not too sure on the process for reloading/debugging JS extensions with EasyEDA.~~ Edit: This is now an extension you can use directly within EasyEDA. Matt <br> ![example2-smoothed.png](//image.easyeda.com/pullimage/4aY4yBu5qLLYEv9YHzz3ipI3VOQFlnWSQJFK4VAk.png)![example1-smoothed.png](//image.easyeda.com/pullimage/NMXvl2mPJQtzIQe7Mo87mvaErdv1DpErhQjnfkEh.png) ![example3-smoothed.png](//image.easyeda.com/pullimage/xaXUqtRTSKavDTnQA0riRp6p2nFMzVvCTteUjJrp.png)
Comments
andreasbernhofer 3 years ago
This looks really nice! Do you think you can port it to JavaScript in general? The extension part isn't a huge deal. You do have a simple API to load either the selected objects or the whole JSON source in javascript, do your thing, and apply either the updated json source or update the selected objects. (Of course it can get way more complex). We can help with that :) However - me not knowing very much python - porting it to JavaScript may be the harder part of this.
Reply
Matt Shepcar 3 years ago
Thanks. It shouldn't be too hard to port it as a command line command line util I guess.. I'll give it a go and then worry about making it an extension afterwards.
Reply
andreasbernhofer 3 years ago
@matt_1626 Well, EasyEDA runs in the Browser, so if you want seamless integration, your extension has to also run in the Browser. So it should be native JavaScript (and maybe WebAssebmbly). If you create a separate command line utility that runs on the host operating system, it may also interface with EasyEDA (e.g. as the autorouter does) but it will be a separate piece of software.
Reply
Matt Shepcar 3 years ago
yeah I mean purely as a starting point so the code is actually written in JS and not in Python.. I can look at making it an extension after that.
Reply
andreasbernhofer 3 years ago
@matt_1626 Okay, now I understand ;) You, you can do that. The basic script for manipulating the PCB with the API would be this: ``` js source = api('getSource','json'); // now source contains the complete JSON source of the pcb, do something with it // e.g. log it in the console: console.log(source); api('applySource',{source: source, createNew: false}); ``` You can simply run this in `Advanced` - `Ectensions` - `Run script ...` or run it in the Browsers javascript console if you e.g. install my example extension [https://github.com/xsrf/easyeda-extension-example](https://github.com/xsrf/easyeda-extension-example) or expose the api manually by executing the script `window.api = api` under `Run script ...` once. The example extension also shows how to create a simple menu and run the code via the menu, but you can concentrate on that later.
Reply
Matt Shepcar 3 years ago
i've got it working as a node.js app now [https://github.com/mattshepcar/easyeda-scripts/tree/main/node.js](https://github.com/mattshepcar/easyeda-scripts/tree/main/node.js) The next step will be to try and run it in the browser.
Reply
Matt Shepcar 3 years ago
I still need to add a user interface but it now works as an extension!  hooray! :)
Reply
andreasbernhofer 3 years ago
@matt_1626 wow, you're pretty fast and even used my sketchy hacks :D Btw. there is a way to load the additional javascript files using their blob-url generated by EasyEDA. Maybe they can even be directly imported with the blob url, I'm not sure... One example of fetching their content is used here: https://github.com/turbobabr/easyeda-quick-align-extension/blob/main/src/easy-fns.js#L183
Reply
Matt Shepcar 3 years ago
Yes, your extensions were a good reference, thanks very much!  I borrowed part of your readme too, i hope you don't mind. ;)  I think the sketchy hack for importing different js modules is kind of ok, it's not really so different from how it looked in the node.js version except instead of "module.exports = " i have "extension.\<modulename> = "
Reply
andreasbernhofer 3 years ago
@matt_1626 You're welcome, reuse whatever is useful ;) And you're right, it's not much different from module exports. But when I used the minified paper.js I would have preferred not having to modify the js file, but just include it. This would also remove the need to either hardcode the extension id or use the hack to get it in each file ;)
Reply
Matt Shepcar 3 years ago
That's true.  It works though and that's the main thing. :)   Hopefully EasyEDA will get better support for extensions in the future and a better documented API. A built in extension registry/installer would be really nice as I think very few people even know that extensions are a thing at the minute!
Reply
THX1138 9 months ago
I tried using this extension but for some reason it only applies teardrops to three places. I created arrays of PTHs and traces and then used the add teardrops function but it didn't apply to all of them. Does anyone know why that might be? Below is a screenshot where you can see the teardrop function only applied to a small area. Selecting all the traces or all the PTHs or both before adding teardrops did not change the outcome. Thanks. ![image.png](//image.easyeda.com/pullimage/s9I1wYd82NozVG9KFeHpOlgGrLa79CgtBcnw0cad.png)
Reply
haidy_easyeda 9 months ago
<font _mstmutation="1">@thx1138 </font>Hello, if you are convenient you can send the pcb file to my email, so that I can test for you, thank you~. email add:[haidy@easyeda.com](mailto:haidy@easyeda.com)<font _mstmutation="1"></font>
Reply
Login or Register to add a comment
goToTop
你现在访问的是EasyEDA海外版,建议访问速度更快的国内版 https://lceda.cn(需要重新注册)
如果需要转移工程请在个人中心 - 工程 - 工程高级设置 - 下载工程,下载后在https://lceda.cn/editor 打开保存即可。
有问题联系QQ 3001956291 不再提醒
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus-@1x -mockplus-

Cookie Notice

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