Generic 3D Shapes in library

Hi,
Is there a a generic like 1x1x1mm size block in the 3D library?
I have applied numerous shapes in the default library and cant find such a thing.

It would be really handy, because say one have 1x2x3mm sized component, then you could just scale the generic 1mm block by 1, 2, 3.

Similarly with a Cylinder. This would be really helpful.
One could even stack shapes up with the 3D model adder, which is quite powerful with its rotate, scale and offset functionality.

Has anyone created a 1x1x1mm grey block that they are willing to share?

Kind Regards

Here is the cube you are looking for:

Mind that you can edit the wrl file (it is text!) and add different color / materialsā€¦ if that helpsā€¦

(that box.wrl file does not look very good ā€¦ but it should do the workā€¦ )

1 Like

Thanks so much that was exactly what I was looking for!
3D models now in a second!
I see I am not the first person to have this idea. :smile:

A simple search and replace ā€œ0.12156863ā€ to ā€œ0.5ā€ changes the black to a nice medium gray.

When I finish my current projects, I would like to learn how to make a cylinder, and then make a mini library of generic shapes/colours which I think would add a lot of value to none pros.

For cylinders itā€™s not so straightforward since larger cylinder = uglier model unless you put in many polygons.

If you only want rough models, KiCad has a number of IDF tools; hereā€™s an example of using the tools to created an IDF model of the ā€œpic_programmerā€ demo project which comes with kicad:

https://drive.google.com/open?id=0By_XTJN-s8aXaW1ZcUdrUTdzX1k

There is a script which generates the IDF outlines using the KiCad tools idfcyl and idfrect, and in some cases for more complex outlines the script defines the outline. I thought I had a rendering of that IDF model but I canā€™t find it; I have a rendering of the ā€œvideoā€ demo though:

https://drive.google.com/open?id=0By_XTJN-s8aXWUc4aGY2ejZ1alE

The IDF component outlines (*.idf files) are simply added to the project the way you would add a VRML model. However, scaling is not applied.

If you create and export an IDF model you can use KiCadā€™s idf2vrml tool to create those ugly multi-colored models. :slight_smile: Alternatively you can use the idf2igs tool from the separate ā€œlibIGESā€ project to produce an IGES assembly with those ugly colors. The good thing about going through IDF (+ idf2igs if necessary) is that you get an actual mechanical model with round holes etc. In the past people used VRML export + long list of voodoo to create a mechanical model which didnā€™t have round holes (which is a nuisance when you want to make alterations to the model within an MCAD package).

Since the stable release, documentation of the IDF tools has been available in the kicad docs.

1 Like

Yeah, havenā€™t gotten around to use @maui 's last version of FreeCAD>VRML conversion script yet, which should not do this kind of stuff.

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