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

@novaktamas

who’s having probs with the exporter???
I have not received any negative feedback till now…

As I already told you, if you could post a .kicad_pcb simple board e.g. with one or two components, I could tell you which path you should configure…
Also a screenshot of your Footprint 3D Settings as the one attached would help

Moreover I would need to have your ksu-config.cfg file and your launch-kicad_StepUp-demo.bat file…
and your FreeCAD version and installation path…

Sorry, Maurice, I meant problems they used to have. There were comments months ago, like


similar to my problem.
You made a perfect youtube tutorial video on getting STEP from component manufacturer, pushing and aligning it to KiCAD 3d viewer.
The opposite direction is not that clear: I see the fine model in KiCAD’s 3d viewer, but can’t export a STEP or WRL to import it to my Creo.
In your comment #27 of this thread, you display a workflow with “your KiCad design is ready to be converted to MCAD in just one click!!” Please point me to a how-to. What I have tried:

  • From pcbnew I open up 3d viewer and see board + 3d part bodies perfectly
  • I export both VRML and IDF
  • When I add these files to my assembly in Creo, I got nothing from VRML (“empty component”), and got the plain board form .EMN file (no component bodies, no holes, no wires).

I upload my whole project folder. It is a very tiny board with a single tactile switch named “SKHHLRA010”. You can also find the 3d body STEP (download from manufacturer).

.whole-project.zip (329.5 KB)

I got the point: from command prompt I run

“C:\Program Files\FreeCAD 0.15\bin\freecad” zeroswitch.emn ksu-config.cfg kicad_StepUp.FCMacro

FreeCad fires up, loads my model, but got an error (I have a single 3d-body-part switch called “SKHHLRA010”. I have SKHHLRA010.step and SKHHLRA010.wrl in my project folder)
The red error message is down at the bottom status line…it was there for short time, hard to catch…

if you enable the ‘Report View’ in FreeCAD
(Menu View, Views, Report Views checked)
you can see a verbose log output that will describe all the import actions…
I’m outside and replying from mobile
I cannot see the prj now
I will get later in the day
… but from the error I got in the pic it seems the config file is missing some paramams

@novaktamas
I got some answers:

  1. you have inserted more than a line in your 3D path … this is not handled by the exporter

  2. you have assigned to 3D model

    model TactSwitch-SKHHLRA010.wrl

but in the folder there is only

SKHHLRA010.wrl

and the correspondent STEP model

SKHHLRA010.step
  1. the STEP model is not correctly aligned to footprint
  2. the VRML model is not correctly aligned to footprint

then I did:

  1. adjusted the ksu config file with two configuration:
  • ksu-config.cfg assigned as it should be for your D: configuration,
    pointing 3D models to ‘D:/MUNKA/NBSz/Emelo/ZeroSwitch/KiCAD’

  • ksu-config-local.cfg assigned to work in a self contained project with 3D models in the same dir of the project itself…

2), 3), 4) renamed correctly the model and aligned both STEP and WRL file
5) added ${KIPRJMOD} var to your pcbnew file, so to have a self contained project

and here the result:


I also added a batch file to launch the exporter in just one click!
launch-kicad_StepUp-64bit.bat
(I see you are running FreeCAD in “C:\Program Files\FreeCAD 0.15\bin\freecad”)

and here the self containing project with models and pcbnew board corrected as required, with board and parts converted to MCAD :slight_smile:

whole-project-adjusted.zip (2.3 MB)

As I told you, the main complex part in kicad StepUp converter is the 3D model library configuration
but when you have done for one board, you have done for all!
some suggestions:

  1. I would not keep all my 3D models in a single dir, but I would put them in subdirs like e.g. smd_resistors, smd_capacitors, th_connectors, etc
  2. after aligning a model, remember to export both VRML and STEP models in the same dir, and use the same name for both

Maurice

PS there is also a video for the exporting procedure (posted at top)

@novaktamas
I’ve added some 3D MCAD models for kicad @ github
you can find details of the new MCAD library here


and in the README.txt file you can find some details for the configuration that may help users

Hi, Maurice,
I think I can use your scripts fine by now: ))
Now I found something seems to be an issue for me.
My hint is the problem comes from a power connector on the back side.
what I do:
0. move connector’s STP (from manufacturer) to a subdir of packages3d, called NTlib (from my initials)

  1. I open connector’s STP in FreeCAD (C:\Program Files\KiCad\share\kicad\modules\packages3d\NTlib\Tyco-1-1734172-2.stp)
  2. start kicad-Tools macro
  3. load kicad Footprint module (footprint is by me based on connectors PDF drawing. path:
    C:\Program Files\KiCad\share\ntlib.pretty\Tyco-1-1734172-2.kicad_mod)
  4. click “create axis”
  5. rotate and translate while alignment seems to be fine
  6. push “scale to kicad VRML”. File is generated in the folder
    …packages3d\NTlib\Tyco-1-1734172-2.wrl
  7. start up kicad and pcb_new
  8. load my board
  9. I edit the connector - 3d settings - add 3d shape (…packages3d\NTlib\Tyco-1-1734172-2.wrl)
  10. I open up 3d viewer
    I see the connector, but on the component side and the opposite direction.

I attach the whole project to look after.
StepUp_issue.zip (410.6 KB)
What do I screw up? Or is this an issue of non-component side parts?

Hi,

  1. in your board / kicad_mod you have retained the previous model association, that will give a wrong data to kicad-StepUp-tool

WRONG
(model adapter-csati.wrl
(at (xyz 0.17 0.18 0))
(scale (xyz 0.3937 0.3937 0.3937))
(rotate (xyz 180 0 90))
)
CORRECT
(model NTlib/Tyco-1-1734172-2.wrl
(at (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)

  1. when you have aligned the module to the footprint in FreeCDA you need to save bothwrl’ and ‘step’ file
  2. if you want to associate .stp extension, you need to use the latest kicad-StepUp Macro (the one included in the project is working only with .step extension)

I attached the project with the right oriented module (wrl, step) and the board with the right module association (assuming your KISYS3DMOD path to c:/Program Files/KiCad/share/kicad/modules/packages3d/)


PS I normally prefer to work with a folder dir different from the one in kicad share folder, because you can risk to delete them in case of removing the kicad sw and upgrading
StepUp_solved.zip (1.0 MB)

I thought that when I run kicad-StepUp-tool, I started from the footprint, and STP gave the 3D body. After making alignment WRL would be generated. I assumed that previous WRL assignment (if any) of the kicad_mod was a “don’t care”. Is it a must starting with a kicad_mod where 3d model is un-allocated? If yes, it is a bug: the default position of the part body may be received from kicad_mod’s original assignment, but after manual moves/rotates it MUST NOT count if there was an initial 3d assignment or not.

I had saved it before, but in the attachment I sent to you I reloaded the original (downloaded) STP.

It would be nice to have two (or more) paths to 3d models in ksu config, as I’d have the ordinary parts (SMD resistors/capacitors) in C:\Program Files\KiCad\share\kicad\modules\packages3d,
and the project specific parts in D:\work… If I can have only a single path, I rather put my stuff to
C:\Program Files\KiCad\share\kicad\modules\packages3d\NTlib.
I see it is dangerous: care has to be taken when upgrading KiCAD.

And one more time: I don’t want to be a repining jerk; I appreciate and respect your work very much !!!

it is not a must starting with a 3d model unallocated, but it is a must, as pointed out in the manual, that you have scale to 1:1 and rotation only on z
Moreover, when you have aligned your 3d model to module, it is your responsibility to update the model wrl part and the board that already have this model in.
This is exactly what you have to do with kicad standard way of working with Wings3D even if you don’t use kicad StepUp.
The plus with kicad StepUp is that you can see footprint when you align it… and of course you have the STEP exporting MCAD option
the easy way to align 3d model to footprint is to
open the module in pcbnew and in parallel open the footprint in FreeCAD with kicad-StepUp-tools, align the STEP model to footprint in FC, export wrl and step model and add/reload the model in pcbnew 3d-viewer to check the result

[quote=“novaktamas, post:56, topic:1048”]It would be nice to have two (or more) paths to 3d models in ksu config, as I’d have the ordinary parts (SMD resistors/capacitors) in C:\Program Files\KiCad\share\kicad\modules\packages3d,
and the project specific parts in D:\work…[/quote]
Having more then one search path it is not convenient at the moment;
Kicad doesn’t have more then a search path, instead you add more environment variables. …
Moreover, with more then a search path, if you have e.g. two libs with the same models/names, which will be the module that would have to be correctly loaded?
I prefer stay simplerone search path for 3d models, or just put full path (not relative to folder location)

[quote=“novaktamas, post:56, topic:1048”]If I can have only a single path, I rather put my stuff to
C:\Program Files\KiCad\share\kicad\modules\packages3d\NTlib.
I see it is dangerous: care has to be taken when upgrading KiCAD.[/quote]
You can always copy all kicad std libs to e.g.

KISYSMOD -> D:\cad\modules
KISYS3DMOD -> D:\cad\modules\packages3d

and place there also your 3d new libs
Then in case of update, you can easily decide what you want to overwrite and what to keep
That is what I do in my designs (I prefer to have the control in what is changing … e.g. if I have produced a board with a footprint and I found it is fine, I absolutely don’t want to have it changed without a manual override)
Moreover I started to clone some of basic smd kicad libs changing all wrl models and adding step and wrl StepUp compatible models to the new libs
Capacitors_Tantalum_SMD.3dshapes
Capacitors_SMD.3dshapes
Resistors_SMD.3dshapes
Housing_SOIC.3dshapes
Housings_QFP.3dshapes

Then if you just overwrite the std libs with these ones, you’ll get a working StepUp environment :smile:
I asked developers to add a support to FreeCad 3D MCAD and VRML models in parallel to Wing3D models, but it seems they will not adopt it.
So for the moment the MCAD support is only through my external kicad StepUp exporter

Thank you for using my script and for your feedback :smile:
Maurice

Since I am not able to use FreeCAD (any 3D modelling program except for Sketchup) right now I have no chance to try it out but as I understand this script makes some mandatory things possible, I have some ideas to improve it in the future.

If we combine a realtime communication infrastructure (like ours, aktos-dcs) with FreeCAD and Kicad, we can build a multiplayer game like development environment.

For example, one will start drawing schematic, other(s) will draw the device in FreeCAD at the same time with the mechanical related electronic components (like connectors, LEDs, etc) which are automatically imported via reading the net list. Then, some other or others will start drawing the nets and placing the rest of the components into the pcb where the edge cuts layer is gathered (and updated in realtime) from the 3D drawing.

From the point of view of pcb designer (who is using Kicad) some components (which are placed in 3D drawing) will be placed automatically.

From the point of view of 3D designer, the nets and the rest of the components will be placed in realtime.

If a collision is detected, both users will be notified in realtime. An interactive 3D scene of the collision area will be shown to the Kicad users.

We will start coding as soon as we finished our current works :wink:

Hi to all,
I just updated my kicad StepUp adding a GUI
I’ve moved all the script on the kicad StepUp tools Macro, giving the project 3 flavors:

  1. a script interface (as before)
    freecad kicad-StepUp-tools.FCMacro demo
  2. a Macro GUI
    freecad kicad-StepUp-tools.FCMacro
  3. a FreeCAD WorkBench
    just open a ".kicad_pcb" or ".emn" or ".kicad_mod" file from the File Menu of FreeCAD

The news on the GUI are:

  • ability to load directly the .kicad_pcb board and parts in FreeCAD
  • ability to load directly the .emn board and parts in FreeCAD
  • ability to load directly the .kicad_mod in FreeCAD to align the STEP model
  • ability to export the model aligned directly to VRML and STEP format
  • VRML exporting format much smaller and cleaner compared to the previous one

With this GUI it is possible to do most of 3D MCAD interaction with kicad EDA without a big knowledge in FreeCAD… So anyone can be focused on its own MCAD software :smile:

Please note that the config file has moved to a new config file
‘ksu-config.ini’
in home user path:
linux: ~/ ($HOME)
OSX: ~/ ($HOME)
Windows: %HOMEPATH%
you have to configure your [prefix3D] to
KISYS3DMOD path or 3D model prefix path

and here the new video tutorial

4 Likes

Sounds intriguing, but the complexity of that makes me shiver…

Maui great work!!
I really hope this step up support can be merged into the main code one day to provide native .step support.

2 Likes

The StepUp made by @maui is a script developed for and to be used with FreeCAD

1 Like

Hi @mangelozzi
kicad devs are working for a direct integration of STEP using the same approach I did with FreeCAD:
converting STEP to VRML and display natively the STEP->VRML model in kicad…
This part is almost done using OCE, which is the main MCAD library engine of FreeCAD…
Then there will be the part to export pcb board and models to STEP… this will take longer I think…

my kicad StepUp tools are available now and they probably will cover the STEP exporting process until a full integration will be done…
kicad StepUp is covering:

  • kicad_pcb to STEP exporting
  • kicad_mod visual align 3D model over footprint
  • generation of STEP model for pcb and parts configuring ‘bounding boxes’ and ‘minimum volume’ of 3D parts
  • collisions detect for enclosure and footprint design
  • exporting of VRML models with Material Properties (almost public feature)
    Many of these features will remain in FreeCAD (MCAD) environment anyway…

Moreover the direction is the same: leaving VRML files coming from Wings3D or similar modeler and get only STEP 3D mechanical models library as the source for kicad 3D :smile:

That is the reason I’m calling for an official repository for 3D mechanical models

The StepUp made by @maui is a tool GUI and script developed for kicad ECAD MCAD collaboration and to be used with FreeCAD :smiley:

4 Likes

Yes, unfortunately much longer. At the moment I’m thinking 1-2 years because of the API which needs to be developed to create plugins to manage PCB data. I should be working on the design of that API, but it makes no sense to start until the initial 3D work has been merged. If I didn’t care about the API and didn’t care about making the kicad code an even more unmanageable mess I could put in an IGES exporter in only 2 days - and maybe a STEP exporter using OCE in only 1 or 2 weeks.

3 Likes

Hi @all
I’ve added to kicad StepUp tools an external macro to export STEP to VRML with material properties, also if the model comes as a STEP multi-color fused part (i.e. coming from manufacturers or on line libs)
https://github.com/easyw/kicad-3d-models-in-freecad/blob/master/exportVRMLwColors/exportPartToVRMLwMaterials.FCMacro
this macro can be used after having aligned your STEP model to footprint and exported to STEP and VRML for kicad… if you desire an improved VRML model with not only diffused properties, but also with nice more material properties, you can select your part and run the macro… you will be asked to associate each color of the 3D MCAD model to a preset list of materials (i.e. metal grey pin, gold pin, black body, led blue etc…) aligned to @kammutierspule material list


Many thanx to Mario (@kammutierspule) for his useful work! :smiley:

Please note that method will give you a small difference in color appearance for exported VRML models compared to your original STEP models, but it will add nice reflective effect to be used in raytracing view, available with the new 3D refactoring coming soon :wink:

Maurice

2 Likes

Hi Maurice,

Great tool, the demo looks great! Unfortunately I have some issues running the thing on my side.

I have a board and three components with 3D models, which I found online. I had the option at download to specify which format, so I got the VMRL and STEP versions. For simplicity, I am using the default KISYS3DMOD path (C:\Program Files\KiCad\share\kicad\modules\packages3d). I placed both files for each component in a subfolder at the path: boardAD/(files go here…).

The models needed some scaling and offsetting which I did in KiCad manually. When I ran the script, several errors are displayed. It properly loads the board, then add some components (not all) then displays the following:
boardAD/myfirstconnector.wrl error: reset values of scale to (xyz 111)
boardAD/mysecondconnector.wrl reset values of scale to (xyz 111)
boardAD/mysecondconnector.wrl reset values of scale to (xyz 111)
(… as many times as this connector is present …)
boardAD/mythirdonnector.wrl reset values of scale to (xyz 111)
(… as many times as this connector is present …)

Basically, for all the components. The script did:

  • load one connector with proper scale and offset
  • load the second type of connector but wrong scaling and offset
  • did not load the third type (not visible in the object list in FreeCAD)

For the third connector, the STEP file opens correctly in FreeCAD in standalone.

Any advice?
Cheers and thanks

Hi @bananabread

you are trying to achieve a mechanical representation of your pcb and components
so scale is mandatory 1:1 for all the 3D models
please spend some time reading the starter guide…
https://sourceforge.net/projects/kicadstepup/files/kicadStepUp-starter-Guide.pdf/download
there is a paragraph about “Create your own Library” which is very useful

All good library model should have
(model shapes/your3Dmodel.wrl (at (xyz 0 0 0)) (scale (xyz 1 1 1)) (rotate (xyz 0 0 0)) )
kicad StepUp tools can take care of offset and rotation, but I still would suggest you to use them only for enclosures or mechanical spaces or screws…

you can align and check if your model will fit the footprint, loading the footprint itself inside FreeCAD and align there the 3D model in MCAD way
have a look at this thread

Also have a read at this thread from the first post… you will see that someone found the same doubts and did some steps to improve the ECAD to MCAD collaboration…
also this thread may be very useful

Maurice