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

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.

How can I define new materials in StepUp? I specifically need:

  • a shiny black plastic (surface like glass, but opaque), e.g. for TSOP-IR-receivers
  • The typical grey-LED-color for IR-diodes
  • orange and green glass/plexiglass for relais

Best,
JAN

For stepup or for the scripts? For the scripts there is a shaderColors.py file in the _tools directory.

For stepup it is hardcoded in kicadStepUptools.py starting at around line 1500 (plus or minus a bit depending on version. But you could simply search for the line as_is="")

Defining the color values is a bit harder but there is a tutorial out there.
Edit: found the tutorial: Tutorial and guidelines for better materials on 3D models

1 Like

Hello guys. I have a trouble with the app.
I have downloaded the StepUp, opened the demo with KiCad, I can see the PCB and everything is fine.
Next, I installed Freecad for Windows x64 and when I started the Macro, it just doesnt work.
Here I send you an image with the error. I have reinstalled it and nothing happen.
I really dont know why

It says:
Traceback (most recent call last): File “C:/Users…/kicad-StepUP-tools.FCMacro”. line 39555, in ini_content=cfg_read_all() File “C:/…/kicad-StepUP-tools.FCMacro”, line 3679, in cfg_read_all with codecs.ope(ksu_config_fname’w’, encoding=‘utf-8’) as cfg_file: File …

First of all I would suggest to remove all your StepUp files, included the configuration one in your user dir (c:\Users\brian)
Then install StepUp using FC tools menu (FC 0.17) or FC add-on installer if you are on FC 0.16
To have a more detailed error reporting, enable ‘Report’ Panel in FC.
Please refer to

Thank you for the reply!
Ok, I installed it in that way too but the error persist.
This is what Ive got in Report Panel in FC.

PoM not present
FC Version 016-6712
kicad StepUp version 7.1.6.7
tolerance on vertex applied
applying Materials to Shapes
your home path is C:\SPB_Data
ksu file doesn’t exist
making default
Traceback (most recent call last):
File “C:/Users/brian/AppData/Roaming/FreeCAD/Macro/kicad-StepUp-tools.FCMacro”, line 3955, in
ini_content=cfg_read_all()
File “C:/Users/brian/AppData/Roaming/FreeCAD/Macro/kicad-StepUp-tools.FCMacro”, line 3679, in cfg_read_all
with codecs.open(ksu_config_fname,‘w’, encoding=‘utf-8’) as cfg_file:
File “C:\Program Files\FreeCAD 0.16\bin\lib\codecs.py”, line 878, in open
file = builtin.open(filename, mode, buffering)
<type ‘exceptions.IOError’>: (2, ‘No such file or directory’, ‘C:\SPB_Data\ksu-config.ini’)

You still use the macro instead of the workbench :wink:

The hint is in [quote=“Briansan, post:133, topic:1048”]
C:/Users/brian/AppData/Roaming/FreeCAD/Macro/kicad-StepUp-tools.FCMacro
[/quote]

If you download the latest version of stepup you should nto get a FCMacro file any more. You should only get a folder called “kicadStepUpMod”.
Copy that folder into “C:/Users/brian/AppData/Roaming/FreeCAD/Mod/”

Stepup should then appear in the workbench selector. (drop down menu in the top toolbar or under view->workbench)

If you already installed it with the addon manager you should already be able to start stepup that way.


If the problem with the ksu-config.ini file persists, you can try and copy the default ksu-config.ini (3.3 KB) file to the location given in the error message [quote=“Briansan, post:133, topic:1048”]
C:\SPB_Data\ksu-config.ini
[/quote]

1 Like

Now the workbench works. But the error is the same.

However, I donwloaded the ksu-config.ini, put it in the location:
C:\SPB_Data\ksu-config.ini
and the error dissapeared.

I dont know if it is a new version with some kind of bug, but now it works!

Thank you so much Rene!

It seems freecad (or the python interpreter that comes with it) is for some reason not allowed to create files in that location for your system. This might be because you use a non standard location for your user data. My guess would be that some MS safeguard does protect that location from write access by freecad. (As you where able to create the file yourself.)

1 Like

Are you able to change some settings now? (i.e. changing the checkbox of ‘Material Properties’)?
Closing and re-opening FC, is this setting remaining as per your choice?

It is working perfectly! No worries…
Thank you! To all!

Cheers!

2 Likes

Hello,

I’ve used StepUp before, and it’s great. Awesome work and thanks for doing this. I’m currently using it as part of an open source PCB project, which is triggering me to ask some questions.

At the moment I’m hitting some problems with scale, and some questions about how I should be using the file names.

My first question is if there is a way to deal with the file names on repositories not found in the KISYS3DMOD location. In this case the repository structure is like this.
./KICAD
./KICAD/3D
./KICAD/project_1
./KICAD/project_2

Lets assume the PCB repository was checked out to C:\ . In KICAD under 3D setting when you add your file with a relative link to KISYS3DMOD it looks like this.
…/…/…/…/…/…/KICAD/3d/c-172319-1-k3-3d.wrl

The …/…/…/…/…/…/ is because the windows default for KISYS3DMOD is

C:\Program Files\KiCad\share\kicad\modules\packages3d\

Of course if you local repository is something more like “C:\my_personal_file_structure\library\3D” and you have to divulge your personal file structure, which is not desirable. Is there a way to provide links without divulging your personal file structure? As well is there a way to provide these links in a portable fashion, as my personal file structure is not going to be the same for someone else who checks out this repository. Right now someone who checks out this open repository needs to either re-create my personal file structure, or they need to update the links to what ever their personal structure is? Can I create a path for something like LOCALREPO which can be used by both KICAD and StepUp such that my repo does not need to rely on links with my personal file structure? How does KICAD and / or StepUp expect me to link my repo, such that these great tools function together harmoniously?

My other problem and questions is about scaling.

This is how it looks in KICAD 3D viewer.

After running StepUp, this is how it looks in FreeCAD R0.16
See below post. Apparently new users can only post one picture per post. So I’ll have to include pictures in separate posts.

If I scale the PCB by 1 / 2.54 = 0.393, It looks like this.
See below post. Apparently new users can only post one picture per post. So I’ll have to include pictures in separate posts.

The link below includes the FreeCAD files which generated the step and wrl files. The c-172319-1-k3-3d.FCStd file is fairly basic. I imported a file from the MFG, which is then scaled such that KICAD is 1:1. The KICAD does rotation and offset.

https://cp.sync.com/dl/882b2e040#ba9ctzgr-w5ab4gt5-aca8u7fu-jszd9by8

Here is a copy of the reports view log.

PoM not present
FC Version 016-6706
kicad StepUp version 7.1.7.9
tolerance on vertex applied
applying Materials to Shapes
your home path is C:\Users\Vista_64_D630
ksu file ‘ksu-config.ini’ exists
materials section present
turntable section present
compound section present
docking section present
constraints section present
font section present
useGridOrigin option present
3D models prefix=C:\Program Files\KiCad\share\kicad\modules\packages3d
3D models prefix2=
pcb color=1.0,0.1,0.0,red (255,25,0)
blacklist modules
volume 0 heigh 0
bounding box option 0 whitelist
placement board @ useBaseOrigin #place board @ 0,0,0
idf_to_origin True
last fp path
last brd path C:/KICAD/172319-1_52pin-connector
virtual models noVirtual
export fusing option nofuse #default
minimum drill size 0.0mm
export to STEP True
enable materials True
turntable True
compound allowed True
docking mode right
constraints mode all
kicad StepUp version 7.1.7.9
export to STEP True
ksu file ‘ksu-config.ini’ exists
materials section present
turntable section present
compound section present
docking section present
constraints section present
font section present
useGridOrigin option present
3D models prefix=C:\Program Files\KiCad\share\kicad\modules\packages3d
3D models prefix2=
pcb color=1.0,0.1,0.0,red (255,25,0)
blacklist modules
volume 0 heigh 0
bounding box option 0 whitelist
placement board @ useBaseOrigin #place board @ 0,0,0
idf_to_origin True
last fp path
last brd path C:/KICAD/172319-1_52pin-connector
virtual models noVirtual
export fusing option nofuse #default
minimum drill size 0.0mm
export to STEP True
enable materials True
turntable True
compound allowed True
docking mode right
constraints mode all
kicad StepUp version 7.1.7.9
opening C:/KICAD/172319-1_52pin-connector/172319-1_connector.kicad_pcb
my file path C:\KICAD\172319-1_52pin-connector
Failed to TuneWindowsGestures. Error: DLL entry point for SetGestureConfig not found in user32.dll. Could not tune Windows gestures.
PCB Loader
pcb thickness 1.6002mm
kicad_pcb version 4
board area [60.134499, 98.234499, 184.975501, 132.270501]
aux_axis_origin[0, 0]
2d circle closed path
2d circle closed path
2d circle closed path
2d circle closed path
2d closed path
max Length=124.46 index=4
running time: 0sec
start cutting
generating flat holes
cutting time 3
Shape already removed
running time: 4sec
FC Version 016-6706
placing board @ -122.555,115.2525
building up pcb time 4
start adding constraints to pcb sketch
adding constraints time 0
running time: 5sec
VBO status False
ReadShapeCompoundMode status False
…/…/…/…/…/…/KICAD/3d/c-172319-1-k3-3d.wrl
adjusting Relative Path
step-module-replaced C:/KICAD/172319-1_52pin-connector…/…/…/…/…/…/KICAD/3d/c-172319-1-k3-3d.wrl
model name c-172319-1-k3-3d
opening C:/KICAD/172319-1_52pin-connector/…/…/…/…/…/…/KICAD/3d/c-172319-1-k3-3d.step
c-172319-1-k3-3d
module C:/KICAD/172319-1_52pin-connector/…/…/…/…/…/…/KICAD/3d/c-172319-1-k3-3d.step
…/…/…/…/…/…/KICAD/3d/c-172319-1-k3-3d.wrl
adjusting Relative Path
step-module-replaced C:/KICAD/172319-1_52pin-connector…/…/…/…/…/…/KICAD/3d/c-172319-1-k3-3d.wrl
model name c-172319-1-k3-3d
opening C:/KICAD/172319-1_52pin-connector/…/…/…/…/…/…/KICAD/3d/c-172319-1-k3-3d.step
c-172319-1-k3-3d
module C:/KICAD/172319-1_52pin-connector/…/…/…/…/…/…/KICAD/3d/c-172319-1-k3-3d.step
running time: 34sec
exporting to MCAD
C:/KICAD/172319-1_52pin-connector_72319_1_connector.FCStd
Board Placed @ 0.0;0.0;0.0
kicad pcb pos: (122.555;-115.252;0.00)
running time: 41sec
running time: 41sec

Why is this scale coming in wrong, and how do I get it to scale properly?

KICAD version is 4.05, this is on a Vista 64 bit platform, with FreeCAD R0.16. StepUp is launched via workbench pull down.

After running StepUp, this is how it looks in FreeCAD R0.16

If I scale the PCB by 1 / 2.54 = 0.393, It looks like this.

you can add a second path to StepUp config file

[prefix3D]
;; put here your kisys3dmod path or 3d model prefix path or 3d alias
;; only two prefixs are allowed; must finish with slash or backslash
prefix3d_1 = C:\Program Files\KiCad\share\kicad\modules\packages3d
prefix3d_2 = D:\extra3Dpackages

and then add a new var to configuration path for kicad, to match this prefix
http://docs.kicad.org/4.0.7/en/kicad.html#_configuration_of_paths

For github repo you can use the $KIPRJMOD var, as i.e. in this repo:
Icezum kicad portable project

from your screenshots and from your files, you have scaled your STEP models to 1/2.54 … that is not the way to work with StepUp… you need to have STEP model in scale 1:1, and you need to scale only wrl models.
Moreover you have offset and rotation in your footprint which is not suggested (supported but not suggested)

To check your models you can:

  1. load your footprint in FreeCAD (if you have installed StepUp as WB you are allowed to open a footprint directly in FC)
  2. import your STEP model
  3. check scale, orientation and position and when everything is fine, export STEP and wrl using the StepUp export button

Please have a look at
kicadStepUp-cheat-sheet.pdf
for further details

1 Like

The scaling in 3D viewer seems wrong to me. In FreeCad, I see the original MFG files and the exported step and vrml files all measure in FreeCad as the datasheet for this device claims they should measure. However when I insert this WRL into KICAD, with a 1:1 scale, it shows up like this.

If I clone / scale before I export the WRL, such that when I open the WRL file in FreeCad, it measures to be very small, it then shows just fine in the KICAD 3D viewer. It seems the KICAD viewer is confused and is scaling between metric and ANSI measurements. I guess for now I’ll just have to keep in mind to verify that FreeCad shows the proper measurements, and then scale the WRL accordingly. I expect long term that the WRL thing will go away. So getting the step file correct is the real important thing. For now I’ll just fudge the WRL files to make it work.

I will check my models in FreeCad as you suggest. I suspect that will be much better than checking them in KICAD as I have been doing.

On the cheat sheet, can I suggest a revision number or revision date, as well as a link to the official cheat sheet. Such that if someone copies this users are directed to the most up to date version, as well they’ll have a method for validating that they have a proper copy.

Use freecad stepup to export the 3d models. It takes care of correctly scaling the wrl model for kicad.