How to share step 3D model with all the components on the PCB too?

So I want to get this mechanical model right be I post it here for upload.

It doesn’t make sense to draw most 3D models with the 3D origin at the 2D origin in the XY plane that kicad calls the center of the part. What I want to do is make my Kicad footprint have a Z axis offset for the 3D part (which I know how to do) so that the feet of my directFET can be non-zero Z in my MCAD drawing. If I don’t do this then I need to mess around with the origin after drawing, or draw the part in a non-trivial fashion starting with the package legs, which is extremely annoying.

My question is, is this acceptable by the community? If this is the case it seems like somehow the the offset information wants to travel with the STEP and VRML files.

Maybe by way of a Kicad footprint file? I have all of my 3D shapes/ footprints / schematic symbols in my own personal repo online that are all linked together. After I fill it out a bit more I will make it available to the public, it isn’t quite ready.

?!? :confused:

The origin of CAD models is at <0,0,0>, as is the normal thing for any MCAD tool out there. KiCAD expects your SMT or TH part to sit on the X/Y plane at a Z-height of 0. The Z-axis positive values go towards you if you look frontal onto the X/Y plane.
If you got SMT devices, they will have nothing that protrudes into -Z territory.
Different matter for TH components, whose pins go through the board and are in -Z territory.

I don’t really get what you mean with the feet of the directFET being non-zero Z.
Can you post some images/files/models to make you point?

I make MCAD models so they don’t need any adjustment at all, neither in StepUP nor in KiCAD for placing them.

as @Joan_Sparky pointed out

The 3D models will be:

  • parametric models coming from technical datasheet
  • FreeCAD 1:1 model (optional)
  • STEP 1:1 model
  • STEP 1:1 model with with text on it (optional)
  • VRML 1/2.54 model (to fit perfectly kicad 3d-viewer with scale 1,1,1)
  • footprint file with right orientation, scale and 3D model associated
    the footprint could be also omitted if the official distribution one is available
  • STEP model fused in single object

if you find easier to build your models with a different origin, you can manage a script to translate the model exactly over the footprint using something similar to what @SchrodingersGat has done here


thanx for your contribution :smiley:
Maurice

I understand this. but for drawing a 3D model it doesn’t make sense (IMO) to have to start by drawing the feet of a package, see cross section below where the directFET origin doesn’t have any material in it. And the “feet” or tabs off to each side that the package sits on are only referenced to the body, so drawing them first is actually impossible without drawing the rest of the part, see below.

I missed the 2.54 scaling on the vrml file! That is most likely the source of my current pain, which is why the part isn’t showing up in the correct place if I use on offset. I will probably fix the STEP file so there doesn’t need to be an offset, but now that I am here I am curious to see how the scaling works on the 3D settings for footprints.

I’ll get this right soon, hopefully.

EDIT: @Joan_Sparky that is a XZ cross-section of the DirectFET footprint I drew up. The origin for Kicad needs to be located at the lowest Z and in the middle of the X dimension.

Ok, what tool do you use to draw you parts?
I’m only firm in Inventor unfortunately and it took me some time to refine my way of doing things.

Can you define workplanes?
Can you offset them from the original planes that go through the origin?

Or can you create your device not from looking at it from the top, but from the side?

Couple of ways to deal with this.

Example (SOT 343x) created mostly from the side:

I am using solidworks, and moving the origin isn’t possible. I can move the part wrt the origin after I have drawn it, which is what I ended up doing. For some reason late last night having to do that was irking me.

I am okay with doing that now that I have had coffee, seems like the correct solution!

There must be workplanes or something similar in that tool… I can barely remember anything from it (had it 10-12 years back for some time)… was deep in 3DS Max then :slight_smile:

You just start by offsetting a plane from the standard x/y plane by whatever the chip underside sits above the PCB.
I do this for QFN housings for example…

Yeah, there are tools for doing that. But solidworks wasn’t meant for origin shifting.

You can also define a user coordinate system and put that origin where you want it and then export to a STEP using that coordinate system but it is a pain to set the origin to a point in free space that isn’t on a vertex.

You can also shift the part around the origin by effectively adding offsets to all of the sketches and 3D features. That is fine, I just did that.

Neither was Inventor… know what you mean. Real PITA once you figure out that all models you did so far are on the wrong plane or screwups like that… been there, fixed that, didn’t get a T-Shirt :cry:

As for offsets, yup… they’re good, that will work. :slight_smile:

1 Like

you can just use StepUp tools to load your STEP model in FC select the part and click on Export STEP & VRML scaled and you’ll get your wrl (you can conserve STEP model coming from SW because the file size would be smaller than FC one)…
or you can convert STEP to wrl using this FC macro


there is a bit work to do to attach also material properties to the VRML but it should be easy just palying a bit with this code
https://github.com/easyw/kicad-3d-models-in-freecad/blob/master/exportVRMLwColors/exportPartToVRMLwMaterials.FCMacro

Maurice

Ill give that a shot!

Why is this happening?

I have aligned it!

Looks rotated by 180 degrees?
@maui will probably need the step file and the footprint this goes with for analysis :wink:

Hi @josexavier
if you are using the exported STEP and VRML models, probably you have a wrong z angle value on your pcb file…
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)
you can check it just opening your .kicad_pcb and .kicad_mod files in a text editor and search for the .wrl file name
Kicad pcbnew doesn’t have an automatic sync between module and board file 3d parameters…
In general it is a good extra grade of freedom, but sometimes it is a bit confusing

   (model 3Dmodels/my_model.wrl 
     (at (xyz 0 0 0))
     (scale (xyz 1 1 1))
     (rotate (xyz 0 0 0))
   )

Maurice

Thank you,
You was correct :slight_smile:

Another question. On your last update there is an error when I use different paths for 3d parts. I have common 3d files on /usr/share/kicad/packages3d and other 3d parts on my project folder.

I have changed the prefix3d_1 path to /home/ze/ on ksu-config.ini otherway it can’t export the wrl and step file into the kicad folder because it need permissions and after change it to home/ze I start getting the following:

/home/ze/Capacitors_SMD.3dshapes/C_0603.step
/home/ze/Resistors_SMD.3dshapes/R_0603.step
/home/ze/Housings_QFP.3dshapes/LQFP-64_10x10mm_Pitch0.5mm.step
/home/ze/TO_SOT_Packages_SMD.3dshapes/SOT23-6.step
/home/ze/TO_SOT_Packages_SMD.3dshapes/SOT23-5_wLABEL.step
/home/ze/Socket_Strips.3dshapes/Socket_Strip_Straight_1x03.step
/home/ze/LEDs.3dshapes/LED_0805.step
/home/ze/shapes3D/022053021.step
/home/ze/Pin_Headers.3dshapes/Pin_Header_Straight_1x05.step
/home/ze/shapes3D/S6B-XH-A.step
/home/ze/shapes3D/Pololu_DRV8801.step
/home/ze/shapes3D/B2B-XH-A.step
/home/ze/shapes3D/1050171001.step

Hi,
recently I’ve changed the default dir to save the 3D model from $HOME to the same 3D prefix used for 3D models…
Some users asked me that…

I forgot that KiCAD will put all the 3D models as default in a folder that requires permission to be written…

  /usr/share/kicad/packages3d

This is a bad habit that KiCAD has also on windows (the models are in Program files subdir)…
I normally (and many other do) have a different folder path for all my library models (lib, mod and 3D) to be sure that will not be overwritten by a new installation of KiCAD itself…
If you let me some time, I will take care also of this permission problem…

Just a clarification… kicad StepUp at the moment doesn’t allow more then one single path prefix for resolving 3D models location… it is partially intentional because if you have two models with the same name in two different search path, which one will be picked and would be the picked one the right one?
So if you want you can move/copy all your models from

  /usr/share/kicad/packages3d

to your 3D path

 /home/ze

anyway, I will take care also of this permission problem soon…

thanks for reporting this
Maurice

Hi @josexavier
please have a look at latest version here


I’ve added a check if the dir is writable… if not then the models will be written in $HOME
This latest version is also fully compatible with FC 0.15, FC 0.16, FreeCAD 0.17 and latest OCC 7, particularly on “.kicad_mod” loading
:smiley:
Maurice
3 Likes

Hi,

I also started using StepUp. It took me a while to get it going but it is working great. Thanks a lot!

There is one thing puzzling me though. How can I generate a STEP file as a solid (so it can be rotated and translated as one part) and still use different colors. I tried using assemblies (so that each part has its own material and color properties) and exported them as a STEP file but then all constraints between the (sub) parts are lost (I’m using the Alibre design CAD program). Any suggestions or directions how I should proceed?

Hi @dolfijn
glad to see you are using StepUp :smiley:

this is a nice feature of FreeCAD… as in the kicad StepUp Starter Guide

assure that your STEP module is fused to just one solid object
(Part Boolean Union in FreeCAD)
Note: here FreeCAD forum fusion howto10 some tips to fuse correctly objects in
FreeCAD

I don’t know Alibre, but I know that some MCAD sw don’t allow the user to make a union of parts, some others just fuse them, but they lose different colors…
Please consider that you can model your parts in Alibre and then import them in FC and make a union of the assemblies to obtain a single 3D object with colors…
in FreeCAD you can also load your Kicad footprint and align directly your model to footprint itself

Maurice

Hi Maurice,

Thanks for your reply. The problem is indeed the Boolean operator in Alibre design. Works fine but discards the colors of united parts. I tried some simple unification with FreeCAD and that looks promising :slight_smile: So I will proceed by fusing my Alibre generated assemblies in FreeCAD. Should work.

Thanks again!

Peter