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


#97

Hi @novaktamas
I see you are using a recent release of kicad StepUp ‘kicad-StepUp-tools.FCMacro

then your config file is not anymore ksu-config.cfg but it is ksu-config.ini that you can find in

NB the new config file is in home user dir
Linux and OSX:
~/ which is $HOME
Windows:
%HOMEPATH%
Click kicad-StepUp-tools.FCMacro Config Button to display the ksu-config.ini file
and Help button for a quick Help
In case of any problem, just delete ksu-config.ini file and restart the kicad StepUp
tools… a new ini file will be generated
edit your 3D prefix and re-run the tools

kicad StepUp is working fine with FC 0.15, 016 and latest 0.17
Please consider to download latest release:
just recently updated for new features…
Latest Enhancements:
STEP multi-part allowed (creating compound)
EdgeCuts allowed for footprint that will generate Cuts in Board
Pcb Edge as footprint allowed
edge tolerance on vertex coincidence for easier designing

KiCad: C:\Program Files\KiCad-7409\bin Kicad work: D:\MUNKA\Tekinvest\RGB-keyb\RGB-kbd-128\KiCad packages3d: D:\MUNKA\KiCAD\packages3d

so just use:
C:\Program Files\KiCad-Stepup\demo\kicad-StepUp-tools.FCMacro
and adjust your prefix in ksu-config.ini (that you will find in Windows %HOMEPATH%) to:
[prefix3D] prefix3d_1 = D:\MUNKA\KiCAD\packages3d\ prefix3d_2 =
your %HOMEPATH% should be something like:
C:\Users\your_username

Thank you for using my StepUp tools since its first release :smiley:
Please feel free to ask any further advice you may require
Maurice

PS Don’t use scripts from old-scripts DIR
Stepup: C:\Program Files\KiCad-Stepup\demo\old-script
they are there just for reference


#98

A huge step forward :grin:

  • switched back to FreeCAD 0.16
  • deleted ksu-config.ini, then edited .ini just recreated
    Now FreeCAD+script runs, but my project is not perfect yet:

My workflow is for a custom connector:

  • download STP from manufacturer (e.g Molex)
  • I load STP into Creo 3. When loading I can choose loading as an assembly (more parts) or a single part. I must select single part (or resulting WRL won’t be accepted). Then I save single-component model again as STP.
  • I load the modified (single component) STP into FreeCAD then export from FreeCAD to WRL.
  • Copy both single-component STP and new WRL to my packages3D directory (both the same name, and rename STP->STEP)
  • I start KiCad Footprint Editor and load connector’s footprint (I created previously)
  • set Footprint properties/3D settings to my WRL (not with full path, but like ${KISYS3DMOD}/Connect.3dshapes/…WRL)
  • set scale/rotation/offset experimentally to look good
  • save footprint
  • change footprint to the new one in pcbnew.

Now 3d viewer shows the board perfectly (well aligned).

Then I want to export board to STEP for MCAD.

  • I start script in FreeCAD
  • Load kicad Board *.kicad_pcb
    Script slowly draws components one-by one (abt 20 minutes!! is it normal?), but new component is not well positioned. Finally I got lots of “…WRL error: reset values of scale to (xyz 1 1 1 )” errors, which is an explanation to bad positioning.
    Do you know what is the problem with my WRL’s?

Thanks again…I mean to create a new, more detailed workflow of using StepUp for you. I see much better, what a rookie doesn’t know/where are the traps:)))

Tommy


#99

Hi
You should use stepup to align the model to the footprint before exporting it to vrml
The position in kicad should be all zeros and the scale should be 1 1 1
Edit: shown here https://youtu.be/O6vr8QFnYGw


#100

Hi @novaktamas
that will be a long reply :smiley:

NB scale to 1,1,1 is MANDATORY for any mechanical conversion/collaboration

it highly depends on your models… I can assembly a board with hundred parts in about 30s…
Do you have the exportFusing = fuseAll option in your ksu-config.ini file? This is a time consuming option…

you don’t need to rename STP to STEP… the StepUp tools will search for .step, .stp, .iges, .igs

  1. I would suggest to start easily with i.e. a single square board with a single footprint
  2. with the recent StepUp release (since v3116) it is possible to align models in kicad pcbnew and assembly them correctly, but I would suggest to use this alternative workflow:
    a) download STP from manufacturer (e.g Molex)
    b) load STP into FreeCAD
    c) analyze your 3D model to see if it is a SOLID or a collection of SURFACES
    c1) if it is a SOLID just use the solid model
    c2) if it is a collection of SURFACES make a compound of surfaces (Part WorkBench, Make compound)
    d) load footprint in FreeCAD as @Shack suggested (‘Load kicad Footprint module’ button)
    d1) NB footprint must have
    (model path/yourModel.wrl (at (xyz 0 0 0)) (scale (xyz 1 1 1)) (rotate (xyz 0 0 0)) )
    ‘z’ rotation is allowed if needed
    That is what is also recommended for kicad library
    e) align your model (SOLID or COMPOUND) using i.e. the StepUp tools to the footprint in FreeCAD
    (That will allow you to align the model to your footprint in a mechanical environment… For most SMD models typically is enough to click on Rotate X if needed, Center X, Center Y , Put on Z buttons)
    f) when aligned, click on the button ‘Export to kicad: STEP & scaled VRML
  3. copy both STEP and WRL models to your 3D DIR PATH
  4. check if your model is fine both in footprint editor and pcbnew in kicad
  5. run the script/macro
  6. load the board using the ‘Load kicad PCB board’ button
  7. check if everything is fine
  8. if everything went fine, iterate the process for all the new models you need to add

Hoping to giving you the right road to obtain your pcb 3D model result :slight_smile:
Maurice


#101

How to decide if solid or surfaces?

In MCAD there are “part” and “assembly”. Parts may be solid or may consist of surfaces. It seems my STEP is an assembly: it contains multiple solid parts.
See printscreen of FreeCAD:

Yes, the problem is surely with model complexity. I exported STEP from KiCAD, and it resulted a 700MB stp file…hard to swallow for my poor box:-). Stp downloaded from part manufacturer can be highly detailed. E.g. I have a stp for a switch where even internal metal and plastic structures are 100% detailed!! Is there a way to simplify those over-complicated models?


#102

Load them in FreeCAD and delete the parts you don’t want.

If that still doesn’t work you have to remake it yourself as you can’t get rid of details in an automated way that I would know of for MCAD.


#103

I use DesignSpark Mechanical to open the original STEP file and see if there are SOLIDS or SURFACES


yes in fact… the best option would be to make a union of parts to obtain a single object fused … FC has some issues in fusing objects when they are coplanar and don’t have any common parts… sometimes is sufficient to move a part i.e. 10um (0.01mm) to be able to make a usable union of parts… or just try with PTCreo and check the result in FC
Anyway the latest release is supporting multi-part STEP models … to align those just use Part Make compound and align the compound… this it will be a bit time consuming when assembling the board, because the multipart, reloaded in FC will have to be re-elaborated as compound… so the fused object is the best option

as @Joan_Sparky pointed out the simplest is to delete the sub-parts you don’t want in your MCAD sw
An other option is to use bounding boxes and i.e. height or volume constraint for parts you don’t consider useful for your mechanical design… then kicad StepUp will assembly only relevant parts and will substitute a part with its bounding box

Here an example of a board with small volume parts discarded, bounding boxes on internal parts, and connector as real STEP models

The result will have a much lighter file size for STEP


#104

Hi Maurice,
Firt of all, congrats for your KiCAD StepUp

I’m trying the wrl export feature and I like to add my materials
How can I do it?

I think the wrl file created by KiCAD StepUp has all material available included it.

my test file:
Terminais.wrl (18.7 KB)

Jorge


#105

The materials in stepup are hardcoded. if you want to add more materials you need to add them to the code.


#106

Hi @Tech_JA
you can select the materials among the available using the combo box

If you want to add or modify the materials, you need, as @Rene_Poschl pointed out, to add/modify the code inside the ‘py’ or ‘FCMacro’ file


#107

You can also use a text editor to edit your WRL file and manually edit your materials.
I made this guidelines that will help understand how materials work:


#108

Hi Mario @kammutierspule
would you mind to post the two Materials documents in LibreOffice format? ATM we linked the pdf, but then tey are not modifiable to add new materials :wink:
Then we could include them at the packages3D GH repo


#109

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


#110

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


#111

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.)


#112

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!


#113

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!!


#114

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.


#115

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.


#116

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.