How to interactive align 3d model to pcbnew footprint: new tool for kicad in 'Altium' style

Hi,
I’ve made a tool to align the 3d model directly moving it over the pcbnew footprint.

here there is a small video tutorial:

With ‘kicad-StepUp-tools’ it is possible to load the kicad footprint in FreeCAD and align the 3D part with a visual real time feedback of the 3d model and footprint reciprocal position.
Once the 3D part is aligned to the footprint pads and silk, the model can be exported in STEP format and in VRML format for kicad 3d-rendering, just clicking on the Scale to kicad VRML button.
That will align EDA to MCAD 3d viewers. No need to reiterate the aligning process or empiric calculate offset and rotation to apply to VRML model.
You can also click on ‘Create axis’ button to have an other help in orienting the part.
With this tool is possible to download a part from on-line libraries (e.g. 3dcontentcentral, grabcad, etc), align the model to kicad footprint and export the model to wrl. That will produce a 3d VRML model exactly aligned to footprint as in mechanical CAD.

TIP:
footprint aligner workflow:

  • load the Macro
  • open the 3d STEP model in FreeCAD
  • click on ‘load the footprint’ button
  • align the part to footprint
  • click on ‘scale to kicad VRML’ button

and here the place to download the script:

Moreover if you have the model in VRML and STEP, you are just a ‘step’ from having also the 3D mechanical copy of your kicad board and assemblies for ECAD MCAD collaboration and enclosure design:smile:
please have a look here for a full description of this feature:

Maurice

6 Likes

That’s great; I plan to have something like this for IGES models once the 3D work is done, but this involves rendering IGES models, which may take another 6 months or more for me to implement. Can your scripts be modified to manage IGES models as well?

amazing.

In the meantime I had figured out the alignment between inventor > freecad > kicad so I don’t have to do any adjustment at all anymore though :wink:

@cbernardo,
the kicad StepUp tool is already capable to handle IGES…
unfortunately FreeCAD and OCC (open cascades) have a less support/compatibility for IGES compared to STEP, so sometimes the FC exporting process could result in a non valid or multiple faces object IGES model…
FreeCAD people are focusing on STEP because this standard is widely used/accepted and updated…
IGES is an old format that has not been updated since 1996…
as from wikipedia page:
IGES - wikipedia

After the initial release of STEP (ISO 10303) in 1994, interest in further development of IGES declined, and Version 5.3 (1996) was the last published standard.

I’m looking forward to see the new 3D refactoring of kicad, but I would like a lot to have STEP format included too :slight_smile:

@Joan_Sparky

this StepUp tool is useful particularly when you want to integrate manufacturer’s model into kicad
so the model you get will be aligned and translated as per manufacturer needs, not for kicad needs…
Then the tool will be useful to you too :wink:
also when you get models from on-line libraries as e.g. 3dcontentcentral or grabcad the tool will help the user in aligning the model to the footprint…

Moreover,
I’ve seen at this forum thread
that you are designing your models with Inventor and then you export them to STEP and then to VRML with FreeCAD…
As you may know, I’m creating a repository for free 3D parametric models coming from FreeCAD with STEP and VRML 3D model ready to go for kicad…
I was reading from your post that you are happy to share your models too…

I was wondering if you would like to join with me and hyozd to increase the 3D MCAD repo :smile:
we have done a lot of parametric models of 3D parts scripting the process for part with many variants (e.g. tantalum capacitors with different sizes)…
what we are missing is some nice 3d part models for single model parts (e.g. USB micro connector or similar)
If you would like to share some of your models, we could offer to kicad users the ability to have free 3D parametric MCAD models, that could be distributed with any open hardware design
(normally manufacturer’s models have some restrictions to be free distributed)…
Please let me know your opinion :smile:
Maurice

excellent tool, congratz!
@maui If I had this tool working like this when I started using with kicad… I probably never had to contribute to 3d viewer development :stuck_out_tongue:

2 Likes

@kammutierspule
thanks a lot for your comment! :smile:
and I remember that you have done a great job in improving the VRML 3d render interface and FreeCAD VRML compatibility…
that gave me the chance to create kicad StepUp plugin and later this tool… :wink:
I consider that a nice open source collaboration! :slight_smile:

IGES is very old but still very well supported and much easier to implement than STEP. With the 3D refactor you will be able to provide support for STEP via OCE - you just need to write a plugin. The plugin can be part of the kicad source, but only an optional compile since it depends on OCE, or it can be out-of-tree. My long-term plan is to implement STEP AP214e3 (deprecated, but many models still in the wild), AP203e2 (superset of AP203e1 so I’m hoping e1 support is automagic), AP242 (currently e1 but that may change before I have time to start). Kicad only needs a lightweight library for MCAD; we don’t need the entire geometry kernel of OCE.

@cbernardo
as you can find in the web:


IGES format always brings in parts as a surface model and assemblies
will be one single part with multiple surfaces. IGES files require
further processing inside of the 3D CAD software to convert them to
solid models.

STEP format is preferred as it brings the part into your 3D modeling software in solid format.
IGES solids capability is weak. Solids came late to IGES development. Consequently, translation of solids is more prone to geometric inconsistencies, resulting in unsewn/untrimmed surfaces.

I had some probs in some case in importing iges models, and let them became a solid… it could be because of FreeCAD iges weakness, but if I could give a vote to the new kicad 3d refactoring/plugin, I will vote for STEP! :smile:
P.S. with kicad StepUp, thanks to FreeCAD, STEP AP203, AP214, AP242 formats are already supported

I can do some when time permits, sure.

Joan_KiCAD_STEP-models.zip (1.5 MB)
Joan_KiCAD_WRL-models.zip (2.2 MB) contains:

  • 1212-8-PowerPAK-single.wrl
    (maybe have a look at the package material and see if some of it is useful for you?)
  • C_0805_H1-35.wrl
    (maybe have a look at the package material and see if some of it is useful for you, took me a while to get the orange right)
  • Conn_FCP_TE-14P-0.5-BOT.wrl
    (have only made this 14P so far)
  • Conn_JST-SH-10P-1.0-SIDE.wrl
    (made all models that are available by JST for this connector, parametric in Inventor)
  • Conn_JST-SH-10P-1.0-TOP.wrl
    (made all models that are available by JST for this connector, parametric in Inventor)
  • Conn_XH2.54_10P_TOP.wrl
    (Chinese XH 2.5 connectors, got all the TOP ones made that are available, parametric in Inventor)
  • Display_Nokia5110_mountFromBack.wrl
    (needed this for a project mounted from the back, using the pcb as frontplate)
  • Display_Nokia5110_mountFront.wrl
    (pretty ordinary)
  • EC2.wrl
    (needed those for a project, plastic housing needs modification to use it like that, got the EC3 as well)
  • ESP07.wrl
    (ordinary ESP8266-07 module)
  • Fuse_0805.wrl
    (housing for SMT fuses is usually green or blue)
  • LED_0603.wrl
  • LED_0805.wrl
    (pretty detailed)
  • SMD10.wrl
    (that’s the housing RECOM uses for their dcdc converters R-78xx-x.xSMD series)
  • Switch_SPST_rectangular.wrl
    (SPST switch from ebay)
  • USB-A_socket.wrl
    (usb a socket right angle mount from ebay)

So yeah, have a look at those… pretty detailed and somewhat longer loading times, but look nice. Makes you wish the 3d viewer would have more rendering options (shadows, raytracing, etc…) and AA or oversampling.
For most of these STEP models to align with the WRL models I had the orientation modified in FreeCAD before exporting to WRL the following way (nowadays I know which orientation in Inventor aligns out of the box with KiCAD, so not needed for any future models):

If you want to have a look at the footprints see here, I didn’t make them to KiCAD spec as I don’t want the reference to appear on my boards (text sizes are very tiny, layers are cmts.user) nor do they have fab outlines and might have the wrong orientation - so yeah, pretty unconventional but will help loading.
Joan_KiCAD_Footprints.pretty.zip (9.9 KB)

Would need a prioritized list of stuff that is missing for you so I can do one here and there when I have some time. Would also need the datasheet/type/drawing links for the ones you’re after.
Modelling would be in Inventor as I’m fastest there and intermediary as STEP models.

@Joan_Sparky
thank you for sharing your models… they are very nice :slight_smile:
That would be great to add some of them to the free MCAD/VRML models for kicad…
I went through them and I noticed that you create the STEP model with a scale factor of 1/2.54, as the VRML one.
Moreover the STEP is not aligned to VRML…
Modeling in inventor is fine, but to have the 3D models ready for the repo I’m building up, it would be nice to have:

  1. STEP model in scale 1:1
  2. VRML model in scale 1/2.54
  3. STEP and VRML model aligned correctly to kicad footprint…
  4. STEP part should have the name equal to file name
    would you mind to modify e.g. Conn_USB-A_EDAC.kicad_mod ?
    thank you
    Maurice

Gotcha.

Scale is no problem, they’re 1:1 in Inventor and getting them into a 1/2.54 I actually have to import/export them inside Inventor for scaling (as I couldn’t find an option to do this in FreeCAD)… if you like 1:1 STEP it saves me one step :smile:

If VRML is 1:1 then KiCAD has to have a scaling applied in all 3 dimensions… I just wanted to avoid that as I never had STEP models in mind, but I see where you want to go with this, so no problem.

That one might be interesting and needs your input or a footprint to load I can work from/with if you have certain demands for orientation. Otherwise I can make sure that the STEP/VRML/kicad_mod align out of the box, just if the overall orientation is up to your/the libs specs I don’t know?!

Realigned the starting plane for the USB connector and went through FreeCAD for conversion… full cycle (STEP, VRML and KCFP (*)). VRML needed 0.394 scaling in KiCAD naturally.
Conn_USB-A-2.0_socket_right-angle.zip (216.1 KB)

*) KCFP… KiCAD Footprint

@Joan_Sparky
I’m sorry if I was not clear about VRML scaling…
when I say
“3) STEP and VRML model aligned correctly to kicad footprint…”
I just intended that VRML should be exported from STEP just maintaining the same orientation and position, the scale for VRML should be 1/2.54 (point 2) as you did for your previous lib models…

One other thing I forgot to tell you is that VRML model should be exported “shaded”, this will avoid to have a ‘wireframe’ on its body…
You can notice the wireframe opening vrml file in view3dscene software (kicad at the moment doesn’t display wireframe anyway… but it s useful if someone wants to use the vrml for exporting the board e.g. to blender…)

And the last one, the STEP model should have ‘.step’ extension for the lib models, not ‘.stp’ (this is useful for using the STEP model with kicad StepUp script :slight_smile: )

Adding also the footprint to the lib (KCFP) it is perfect, the VRML scale is fine (scale (xyz 1 1 1))
:smile:

Conn_USB-A-2.0_socket_right-angle-rev2.zip (234.4 KB)

thank you
Maurice

OK, reiterating:

  • STEP oriented like VRML, KCFP orientation doesn’t really matter
  • STEP extension .step
  • VRML scale 1/2.54 vs STEP, which is 1:1
  • VRML export out of FreeCAD ‘shaded’
2 Likes

if you have some spare time, here a some common parts for voltage regulator/transistor that would be nice to have:

Can you scale the STEP/VRML models with a script?

current workflow for me with aim of getting a 1:0.394 VRML (with STEP only for conversion/as afterthought):

  • inventor model 1:1
  • import in inventor for scale adjustment 1:0.394
  • export as 1:0.394 STEP
  • import freecad (rotations not needed anymore)
  • export freecad as VRML
    -> no 1:1 STEP

If I wanted a 1:1 STEP and a 1:0.394 VRML I would have to do 2 different STEP models to get a 1:1 STEP and a 1:0.394 VRML out of the box… I’d rather avoid that as it involves a lot of demotivating clicks :worried:

So, can you adjust scale of a STEP or VRML model via script?

Would be perfect if I could run the freecad conversion as a script as well… just needs to import the STEP and export the VRML.

Ideal world:

  • model 1:1 in inventor (or what have you)
  • export as 1:1 STEP
  • start script that creates the shaded 1:0.394 VRML with freecad (just point it at a folder and let it rattle away)

[edit] Reading your StepUP threads here and on launchpad it seems that you got that one covered?

Those are straight 1:1 STEP models from Inventor:
SOT223-3.stp (418.0 KB) NEW!

And one I needed for myself ($3.5 DCDC converter Vin max 36V, 500mA Vout 3.3V or 5V):


RECOM_ROF.stp (417.9 KB)

DPAK-3.stp (311.4 KB)
DPAK-5.stp (348.7 KB)

currently going through my ‘old’ models and converting them to the right orientation as I go along… had to learn a new trick in inventor for it :smile:
Then I modified one of the xQFP models to parametric so I just have two variables (pitch & pincount) from here on for those.

@Joan_Sparky,
sure I can handle the scaling and converting to vrml part…
for me to have just the model in STEP, scale 1:1, with the right orientation would be perfect! :smile:
Just in case you may need some user friendly tool to move, rotate, scale and convert to VRML, you can download the kicad StepUp demo and you’ll find the ‘kicad-StepUp-tools.FCMacro
If you launch the macro inside FreeCAD you can scale and convert to VRML just in one click :smile:


Thanks for the models…
I’m going to upload them to the repo, beside vrml format :smile:
I’ll keep you update!
Maurice

D2PAK-3.stp (341.5 KB)
D2PAK-5.stp (373.0 KB)
D2PAK-7.stp (388.3 KB)

So, there is no scripting ability to get freecad to do stuff without the GUI?

SOT89-3.stp (380.0 KB)
SOT89-5.stp (392.6 KB)

The SOT89-4 from above (I deleted the attachment by now) is wrong labelled. Use the SOT89-3 instead please. Same goes for the SOT223-3. I replaced the attachment further up. Might do 223-4 and -5…