You need to Create a Project and stay online at least 60min in Editor for posting a Topic.
Improved teardrops and curved traces
414 11
Matt Shepcar 1 year 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
Matt Shepcar 1 year 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
andreasbernhofer 1 year 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 1 year 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 1 year 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 1 year ago
I still need to add a user interface but it now works as an extension!  hooray! :)
Reply
Matt Shepcar 1 year 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
andreasbernhofer 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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
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
We use cookies to offer you a better experience. Detailed information on the use of cookies on this website is provided in our Privacy Policy. By using this site, you consent to the use of our cookies.