Generic 3D Shapes in library

here the version of a 1x1x1 cube exported by FreeCAD (I used ‘Shaded’ before exporting otherwise you get also ‘Wireframes’ and ‘Vertex Points’ in vrml)
_box-fc.wrl (5.6 KB)
and the kicad StepUp exported version
box-fc-ksu.wrl (1.7 KB)
both are already scaled 1/2.54

2 Likes

Hi Maui, thanks for the file. I am still using kicad-stepup and its great. I used this generic box.wrl for all my missing parts, but when I use ki-cad-stepup I need a box.stp.

So I made one in freecad, a 1x1x1 box. I then attached it to a footprint, and scaled it in Kicad foot print properties, but when I run KiCad-stepup it always pulls in a 1x1x1 box instead of scaling to the required size.

Do you think my box.stp is the problem? Do you by any chance have a 1x1x1.stp file that gets scaled correctly?

1 Like

The issue here is that you’re working with an MCAD system (FreeCAD/OCE) which generally do not scale things because they work with the units specified in the model file. In the mechanical world it really doesn’t make sense to allow arbitrary X/Y/Z scaling. So in kicad you can scale VRML models as you please, and scaling had to be permitted because the VRML specification does not enforce length units, but for any MCAD data including IDF outlines any scale parameters are ignored.

If you wish I can make modifications to the kicad->STEP converter (https://github.com/cbernardo/kicad2mcad) so that it will also interpret IDF outlines, but you will still need to create a script of some kind to create the different sized boxes that you need for a project. Personally I will never implement scaling of MCAD models because that introduces many more opportunities to make very expensive mistakes in the mechanical verification.

2 Likes

Hi @mangelozzi,
Kicad StepUp doesn’t even care about the scale parameters in wrl because normally in MCAD world the models have to be already in the right scale…

There is a configurable option to create a bounding box of 3D mechanical models, but at the moment kicad StepUp doesn’t support the feature you are asking for (which would be to make a parametric bounding box based on scale values from wrl) …

I’m going to think on develop this feature because it could be of some interest for kicad users (I remember that also @jwr was asking for something similar)

I’m adding some features to kicad StepUp (one is the ability to align part to footprint using constrains), so because I’m revisiting something in the code, may be I would get the chance to add also this feature…
keep in touch :smiley:
Maurice

2 Likes

Hi @mangelozzi
I 've added to


the feature to create boxes or cylinders using dimensions as in scale values of wrl model

This feature will be triggered only if the wrl models have the following names:

  • box_mcad.wrl
  • cylV_mcad.wrl
  • cylH_mcad.wrl

if the kicad StepUp tools will parse these special names, correspondent models will be generated in FreeCAD using the dimensions as per the scale values indicated in the kicad_pcb file.
the 3 special wrl models are in the “shapes” folder of the demo project, or just download them from here
cylV_mcad.zip (2.8 KB)
cylH_mcad.zip (2.7 KB)
box_mcad.zip (407 Bytes)
that should add the ability to use simple generic shapes to generate bounding box like ECAD and MCAD models…
Please test it downloading the latest version of Kicad StepUp here
https://sourceforge.net/projects/kicadstepup/files/latest/download
and give me a feedback if that fulfill your request :smiley:

2 Likes

Oh my word maui you beast! :smile:Thank you so much! I have to be an adult and go to bed now, but I am so excited to try this out this weekend, brilliant idea and implementation!

Hi Maui,
So I just tried the new script, and it is fantastic! It is so easy to create 3D models now. Thank you very much!!! There was just one small issue, with the ferrite beads (FB1 and FB2), they were incorrectly placed in the Y axis (thought you may want to know about it):
Here is a comparison between the native display and the stepup model:

:smiley:

Here is the setup:

Boxes which were symmetric were placed fine, and even some rectangles were placed fine.
But the ferrite beads (x-scale:4.5, y-scale:1.6, z-scale:1.6) was not.

Still a really great helpful tool! Thank you so much!

Hi @mangelozzi
would you post the ferrite beads kicad_mod file or a simple board with the ferrite inside?
I will check it
Maurice

Hi @maui,
Heres the ferrite beads kicad_mod file:
EMIFIL_1806.kicad_mod (1.3 KB)
Thanks

Ferrites looks good.
The problem is with the transistors U2/U3, they are shifted down

1 Like

@mangelozzi
I tested the ferrite and it is fine
as Mario noticed, you have problem with U2 and U3 models
I see you are not using StepUp models both for STP and WRL models…

in facts the dpack model has a different aspect in Kicad 3d-viewer and in MCAD
that is why you are having a shift in the two environments
The new release of kicad StepUp is taking in count also of wrl model offset and rotation (only scale is mandatory 1,1,1 unless the new _mcad box models)
Probably in your board and/or in your library kicad_mod you have wrong offset alignment…
just make a backup of your board and search for all the instances of
(at (xyz
if you don’t have
(at (xyz 0 0 0))
you need to change previous values to the above ones

It is a best way to use kicad StepUp inserting models both in STP and WRL coming from StepUp exporter tools. In that way not only position, but also look will be the same in both environments…
Moreover in the kicad StepUp demo you can find also STP and WRL models for dpack to252
here a small video explaining that

Maurice

1 Like

This is why I want the OCE plugin to be in KiCad (eventually) after Mario’s new 3DViewer is merged. Then you will only have the STEP model and there won’t be any surprises because STEP and VRML models have different offsets.

2 Likes

you will get no surprise at all if you follow the instruction (which means just generate wrl from stp model)

2 Likes

Hey Maui,
Well done on the work you have been doing.
Maybe just a weird little issue of using “box_mcad.wrl”… as you know it creates a .step model on the fly.

When I use it with an offset specified to get the .wrl model positioned correctly, then it makes the model offset. As you can see in the below image:

This is KiCAD 3D viewer:

KiCad StepUp in FreeCAD:
Here you can see the connector boxs’ offset. The strange things is one of the boxes on the bottom side of the PCB is in the correct position (marked with a green tick). But the same component on the top side is in the wrong position (as shown in red).

I can use StepUp to correct the offsets manually every time I export the file. Just thought I would let you know because above it says it should handle offset and rotation data correctly. I am using the latest freecad version and almost latest KiCad StepUp (4022 but I see it has been updated 4 hours ago)(downloaded both of them today).

Hi @mangelozzi
To be honest I didn’t tested heavily offset for 3D boxes and cylinders… I’m not sure if the problem is on the script or on the base model…
do you have a board with wrong behavior to test it? (just a basic sample or a board without traces/netlist)
EDIT: I tried with some offset and it seems to work… a non working example would help :slight_smile:

the latest release has been updated mainly to allow multi-parts (using compounds) and edge tolerance on vertexes…

Maurice

Hi @mangelozzi
that should solve your issue
https://sourceforge.net/projects/kicadstepup/files/latest/download
kicad_StepUp_tools_v4025

please let me know if everything is fine now :slight_smile:
Maurice

1 Like

Hi Maui, I tried it out, and it works perfectly now! Very impressed, well done for fixing it! A generic block/cylinder is good enough for most MCAD review. Thank you so much!!

thank you for your bug reporting and feedback!
I fixed this also for some standard models case when using a different approach to the one I use/suggest in aligning models :wink:

Here are two step files (I think step is prefered to wrl these days) I made in FreeCAD I use a lot for rough fitting a 3D model (each have dimenions of 1mm for easy scaling):

1 Like