Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate STEP file? #9

Open
maholli opened this issue May 6, 2020 · 17 comments
Open

generate STEP file? #9

maholli opened this issue May 6, 2020 · 17 comments

Comments

@maholli
Copy link

maholli commented May 6, 2020

Has anyone played around with auto generating STEP files (File -> Export -> STEP)? Any tips?

@set-soft, maybe your fork is more suitable for this?

@set-soft
Copy link

set-soft commented May 6, 2020

Hi!

My fork doesn't currently support it, but this is something I would like to add. I generate STEP files from time to time. I didn't include them in my first approach just because they are huge and testing them is complex.
Note that my fork is currently focused on KiCad 5.1.5, dropping support for KiCad 4. Functional docker images are available and the scripts run perfectly without docker. But I'm focused on Linux, don't have access to Windows or Mac OSX.
I'm currently adding automatic tests to the scripts to make them more reliable.
If you want: detail what features and options do you expect from it.
Also: are you willing to help coding?

Regards, SET

@leoheck
Copy link

leoheck commented May 8, 2020

@maholli @set-soft I made an initial script to export the step. I can make a PR to your repo if needed.

@maholli
Copy link
Author

maholli commented May 8, 2020

@set-soft Thanks for the response! I'm afraid most of this code is outside my wheelhouse, so I likely wouldn't be much help with the initial legwork. I do, however, have your fork up and running with github actions and can help test!

@leoheck Sweet! I see you have a kicad-automation repo, but it doesn't look like you've forked off of productize or elsewhere. I'd love to check the code out if you want to push to your repo or make a PR to @set-soft's (if applicable).

@leoheck
Copy link

leoheck commented May 10, 2020

@maholli I do have, but just because I was merging code from all of the forks to make it work fast, for my purposes.

@set-soft
Copy link

Hi @leoheck I'll take a look at what's needed to export the STEP files. If you have working code tell me where is and I'll take a look at it.

@set-soft
Copy link

I took a look into this. There is no need to add it to these scripts. The "File -> Export -> Step" dialog is just a wrapper for /usr/bin/kicad2step.

This functionality could be added to kiplot (my fork uses kicad-automation-scripts)

@leoheck
Copy link

leoheck commented May 11, 2020

Nice /usr/bin/kicad2step you are good in finding info. Let us know if this is working, please.

My first attempt (and it is working, at least for me) is this
https://www.dropbox.com/s/tl3gk2739pe0n5f/export_step.py?dl=0

If you want to test it you may need my whole folder since it adds other dependencies from other forks. It is not well organized yet
https://www.dropbox.com/sh/y1bz4xufxokotqu/AADSeIgBeCs_jAk4FO8_1u6ca?dl=0

@set-soft
Copy link

Thanks @leoheck I'm finishing some details on my fork and then I'll see how to export the step file.

@leoheck
Copy link

leoheck commented May 27, 2020

Totally off-topic question for you @set-soft (where I can talk to you?)

Do you have any idea if it is possible to run these tools, on a system without GUI?

I want to integrate them into my CI (using GitHub workspaces)
I am using a self-hosted server, but it does not have GUI right now.

So, I can see 2 problems here.

  1. The Server does not have Gui (but this is not the issue since I can install it if needed)
  2. Github logs-in into my server (through ssh I believe). So it is possible that I can't change this passing the -X flag to enable the X11 export

So, the issue I see is that these tools are GUI dependent since they need Windows to do the job.

Do you know if there is any way to work around this GUI dependency?

Ah, just found this Xvfb to fake a Display. It looks good.

@set-soft
Copy link

I'm not sure if I understand, the whole idea is to run them in a server without X and using them for continuous integration. Like in this example: https://github.com/INTI-CMNB/kicad_ci_test also this example: https://gitlab.com/set-soft/kicad-ci-test-spora
The Makefile included in my fork has a target "test_docker_local" to run the tools inside a docker image without access to the host X server, simulating the same situation you'll find in a machine without X.
Also take a look at our KiPlot repo: https://github.com/INTI-CMNB/kiplot
And yes the tools runs KiCad inside a fake X server created by Xvfb
The current version in the repo can also start a Window Manager (inside the fake server) and export it using VNC protocol, so you can connect with the virtual server and interact with it inside a window of your real X server. This is greate for debug.

@leoheck
Copy link

leoheck commented May 28, 2020

And yes the tools run KiCad inside a fake X server created by Xvfb

Oh, thank you for this info.
I was not using your repo as a whole since I was using things from different places.
I also dropping the docker part to use on my computer for simplicity, but it may be an interesting solution for CI. Thank you for explaining to me all of that.

This comment relates to this thread.

If you are adding a way to export the step file in your repo. A good thing to do is to also test if 3d-models of the parts are good (test if they are not multipart, for instance). Maybe Freecad has something to help here. This is especially helpful when the user adds external 3d-models. When 3d-models are not good, the generated step file (is usable) but a single part is not generated because the boolean operation used to make it fails.

@leoheck
Copy link

leoheck commented Jun 2, 2020

@maholli @set-soft , this is the command Kicad uses to generate the 3d-model

/usr/bin/kicad2step --user-origin="148.088301 x 103.570169" -f -o ./board.step ./board.kicad_pcb

@set-soft
Copy link

Ok, added something.

@leoheck Do you have examples for the issue you mention? What should we do in this case? Print a warning about it?

@leoheck
Copy link

leoheck commented Jun 16, 2020

Are you talking about the issues here #9 (comment) ?

Maybe they are not issues anymore. You've solved this when you told us that these tools were running on docker/ci. And I verified it by myself running it on my own ci and on my my computer ssh-ing to it without X11.

Considering my last comment here...

I would just suggest changing this part. I forgot to say it when I was showing the comment before.
--user-origin="148.088301 x 103.570169" but a config to change these settings on kiplot.json would be good too in future if you didn't implement it this time.

@set-soft
Copy link

Are you talking about the issues here #9 (comment) ?

Nope, sorry for not quoting to make it clear, I was talinkg about:

A good thing to do is to also test if 3d-models of the parts are good (test if they are not multipart, for instance).

And:

but a config to change these settings on kiplot.json would be good too in future if you didn't implement it this time.

Of course, all the command line options can be controlled.

@leoheck
Copy link

leoheck commented Jun 17, 2020

A good thing to do is to also test if 3d-models of the parts are good (test if they are not multipart, for instance).

Oh ok, I see. I was looking into it, and this looks something hard to do since even KicadStepUp plugin for Freecad not always can't tell the right answer.

For instance, when the board uses only the 3d-models coming from the Kicad library the exported part is a single solid since KicadStepUp owner builds the Kicad Library considering this.

But if the user, like me, uses models from the internet, to fulfill the missing parts, sometimes these models are not good (as in they can't be used on boolean operations like addition) and Kicad won't export the .step file as a single solid.

This "single solid" feature is a good thing to have because when working with MCAD, you can use the explode operation, to visualize the device and system's parts better, and the board won't explode in many thousands of pieces. It will be handled as a single part.

So, long story short, this is a good feature to have, but it is hard to implement unless we find something useful here. Also, its result not something really important since the exported .step file can be used normally.

I was discussing this with @easyw, here easyw/kicadStepUpMod#50

@set-soft
Copy link

So, long story short, this is a good feature to have, but it is hard to implement unless we find something useful here. Also, its result not something really important since the exported .step file can be used normally.

Ok, I understand the idea. If we find a rasonable way to detect I'll add a warning.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants