KiCad StepUp New exporter for 3D MCAD (feedbacks are welcome)

thanks for the replies
I will check the python code to add more materials

Hi Mário,
yes, I know I can edit the wrl file to edit the materials but it will more simple if I can choose the correct material in KiCAD SteUp

Maurice,
a suggestion:
Could be a nice feature if you add file for user can add owns materials list

1 Like

Hi @Tech_JA
StepUp has started as a single macro file, so it is still a single file embedded in a FreeCAD workbench…
The idea to include a material list is a nice feature, but it will require to be compatible with both WB and Macro approach…

At the same time, if you have defined some nice materials, please post them here or at GH repo…
I could just add those to StepUp and update the suite for all users…

Thx
Maurice

Well i separated the material definitions for the vrml export used in our cadquery scripts. (Not sure if my implementation is still used.)
It might be possible to use that part for stepup. But it will definitely require some work. I will not be able to look into this until after the v5 release. (And the list of things to do after the v5 release is already quite long.)

Hi, I am new to Kicad and FreeCAD and have much to learn so please be patient!

I am trying to create a PCB with just a DB25 male connector and import it into FreeCAD.

I am using Kicad 4.0.7-e2-6376 and FreeCAD daily (12847 Git) on Ubuntu 16.04.3.

I installed StepUp as a workbench using the new Addon Manager in FreeCAD 0.17. I have followed the YouTube videos, including the maui2kc ones and eapbg’s detailed explanation.

Apart from some difficulties with paths, everything is working well, except for some reason when I view the 3D result in Kicad the connector is offset by its own length.

I obtained the .step model from here: https://grabcad.com/library/db9-db15-db25-db37-connector, opened it in FreeCAD, selected the DB25RA_M part and exported it as DB25RA_M.step.

I am using the PCB footprint DSUB-25_Male_Vertical_Pitch2.77x2.84mm_MountingHoles.kicad_mod from the Github version of Connectors_DSub.pretty.

This is the alignment in the StepUp workbench:

TIA for any advice!

I was only allowed one image in the previous post. Here is the alignment in Kicad 3D viewer:

I should add that everything is ‘0’ in FreeCAD, except “z Axis” which is 1.00.

I should also add that I am sure I saw a post with a similar problem, but I can’t find it for the life of me now!!

may be this one?

or this

Hoping this may help :smiley:
You should check your footprint offset values in the pcbnew file compared to the one of the footprint used to align the STEP model. Moreover be sure to use the newly exported STEP file to be loaded in KiCad and not the original one.

2 Likes

The simplest method is to make sure to reset all 3D offsets and rotation angles to zero before saving the footprint in KiCad and opening it in FreeCad for alignment of the 3Dmodel.

Thank you for the fast response.

Actually, I was using the Ubuntu repo version of Kicad (4.0.7) which I think still used .WRL file rather than STEP. However, I am reasonably sure that I am using either the .WRL or the new STEP file because a) they are in a different folder and b) the Y and Z values are spot on, which they certainly aren’t in the original model.

sometimes the model used in the pcb file (.kicad_pcb) has different x,y,z orientation values compared to the module used for orienting the model file (.kicad_mod)

The .kicad_mod file has this:

  (model ${KISYS3DMOD}/Connectors_DSub.3dshapes/DSUB-26-HD_Male_Vertical_Pitch2.29x1.98mm_MountingHoles.wrl
    (at (xyz 0 0 0))
    (scale (xyz 1 1 1))
    (rotate (xyz 0 0 0))
  )

Whilst the .kicad_pcb has this:

(model /home/iwbnwif/Development/kicadtry/libraries/DB25RA_M.wrl
  (at (xyz 0 0 0))
  (scale (xyz 1 1 1))
  (rotate (xyz 0 0 0))
)

But if I look in ${KISYS3DMOD} there is no /Connectors_DSub.3dshapes folder, so I assume that the .kicad_pcb overrides it?

Anyway, I think they are the same orientation.

Reading those two posts, I wondered if it is a mismatch between the current StepUp and the old version of Kicad, so I installed the nightly build but the problem remains.

However,

You should check your footprint offset values in the pcbnew file …

The new (nightly build) version of Kicad is really nice here. The 3D dialog includes a preview and I can force the connector to the correct position by setting the X offset to -1.3000 inches. After that Kicad 3D and StepUp import .kicad_pcb into FreeCAD are perfect!

After the upgrade and adjustment in the Kicad 3D dialog, the .kicad_pcb file looks like this:

(model /home/iwbnwif/Development/kicadtry/libraries/DB25RA_M.step
  (offset (xyz -33.01999950408936 0 0))
  (scale (xyz 1 1 1))
  (rotate (xyz 0 0 0))
)

So, problem is solved by a workaround - thank you :slight_smile: It would be nice to know why I need to offset -1.300 inches, but not essential.

That is because when importing the footprint into FreeCad with StepUp, it will use the KiCad offset and rotation settings to orient the footprint in FreeCad. Because of this I find it easier to have these parameters reset to zero before saving the footprint and importing it with StepUp, so that footprints have the same rotation and offset as displayed in KiCad as a starting point. To understand this, as an experiment try to set the z-rotation to 90° in the KiCad 3D tab, save the footprint and import with StepUp. Notice that the footprint now is rotated 90° in Freecad compared to the view in KiCad.

BTW, you can make use of the exported Step model even in ver. 4.07. When importing the board into FreeCad with StepUp, the WRL model will be substituted with a Step model with the same name if it exists.

otolen, thank you, sorry our posts crossed earlier.

Because of this I find it easier to have these parameters reset to zero before saving the footprint and importing it with StepUp, so that footprints have the same rotation and offset as displayed in KiCad as a starting point.

Hmm, I don’t understand how I can save the footprint from Kicad (the .kicad_mod file). Actually, I am using the footprint directly from the library which seems to be zero’d:

  (model ${KISYS3DMOD}/Connectors_DSub.3dshapes/DSUB-26-HD_Male_Vertical_Pitch2.29x1.98mm_MountingHoles.wrl
    (at (xyz 0 0 0))
    (scale (xyz 1 1 1))
    (rotate (xyz 0 0 0))
  )

To understand this, as an experiment try to set the z-rotation to 90° in the KiCad 3D tab, save the footprint and import with StepUp. Notice that the footprint now is rotated 90° in Freecad compared to the view in KiCad.

If I change the z-rotation in the Kicad 3D tab, it moves the 3D model but the footprint remains the same.

Which file that StepUp imports will have the offset in it? IIUC, I import the .kicad_mod file (which is zero’d) and then a .step file. So my understanding was that StepUp effectively creates a duplicate of the .step file, but with the orientation and offset adjusted so it sits at zero.

Thanks for any further hints :slight_smile:

That what I initially thought, but it is oriented to the current settings in the 3D Tab; it is the mod file that will have the offset and rotation in it if it was non-zero at the time the file was saved [and imported with StepUp].

Note that the z-rotation experiment I was talking about refer to the visual orientation seen in Freecad, not KiCad. When you do the experiment the 3D model preview will also rotate. If I now reorient the 3D model of the resistor to vertical in Stepup and re-export, everything will be aligned again, but only if I kept the 90 rotation in KiCad.

But again, I think things are getting much simpler and less confusing if you reset the 3D settings rotation and offset to zero in the footprint editor before saving it and importing it into FreeCad with Stepup.

1 Like

Sorry for the delayed response and also for being slow in understanding!

Okay, I think I am starting to understand. If I open the library part in the footprint editor, I get this:

But on my pcb layout, I have this:

So somehow, when I placed the component I must have mirrored it, or the footprint has changed between Kicad library versions. I think the problem is that I was aligning the 3D part to the non-mirrored version, but this is obviously not correct for the (unintentionally) mirrored version.

So, I think problem solved - thank you to both for the help, and thanks for a really great tool! :clap:

1 Like

Not between versions. If you have the default setup, kicad v4 downloads the footprints on the fly. (The github plugin downloads the current head of the master branch.)

My suggestion is to setup a local footprint library.

Either by using the "save local copy to" option of the library wizard (still downloads the current head of master. more details in this tutorial by @bobc)

Or use the library download script found in the kicad-library-utils repo.
This does use git to clone all repos. It has an option to checkout a specific tag for the libs. (you can for example clone all libs and then checkout the commits tagged as 4.0.7)
But it does not setup your fp-lib-table. So you still need to add the cloned libs using the footprint library wizard.

This will be a lot easier in v5. (What will be harder in v5 is having a daily updated version of the lib because the github plugin can not handle the new setup of one large repo holding all the libs.)

1 Like

My suggestion is to setup a local footprint library.

Thank you, I was thinking of doing that at some point anyway, but will do it straight away.

I think it will help with the path problems I had with StepUp originally (now solved, but I am not entirely sure why).

Maurice,

Thank you for the very, very nice and clear job! It helps me (and others) a lot, saving our time.

And, of course, there are some gimmicks/questions about future of your child:

  • Importing silkscreens. This not only will give more natural look of a PCB assembled, but will provide more usable look of it in documentation. On my hand this is a must;
  • Importing pads/tracks. While this option is not absolutely necessary for many of us, sometimes it will help in constructing shields for RF components and supposing possible interference with metal parts of a box/construction;
  • Importing Dwgs.User (User Drawing) layer. Some thing/marks there will help a lot in a complete project. Without such import aligning already created at this layer info to imported PCB my hands is not a kind of quick task.

And the last not least.

After reading supplied with The Tool (kiCAD StepUp for FreeCAD) documentation, I not understand the fact I must to have both VRML and STEP libraries for parts. I does it only by the way of import. So, it must be clear in docs:

  • For importing PCB from kiCAD you must to have libraries in STEP, VRML is possible to create by the way.

Sincerely,
Eugenijus
[just switched from Eagle to kiCAD]

Hi,
you need both WRL and step if you use kicad 4, the next release will support directly both.

In general if you need to have detailed 3d view of your board including technical layers, the best option is to export the kicad_pcb to wrl.
Step export is most suitable for mechanical integration.

1 Like

Thank you for quick answer!

How it can be done? Is it somewhere at KiCAD, at StepUp or I need some additional plug-in or WB?

While mechanical view is my main target, and it is solved trough your StepUp (TNX x 100), sometimes “designer” view is welcome, esp. for documentation.

Sincerely,
Eugenijus.

In pcb_new: file->export->vrml

2 Likes

[smiling]

Oh, RTFM… I promise.
It is too easy to learn KiCAD, but distribution of some menu things and new shortcuts ideology for new user are sometimes confusing.

Your and Maui made my day. Today.

After testing such export (.wrl) from KiCAD, I found that is sometimes is empty, sometimes not.
If I will found how to reproduce collision, I’ll report it.