[[ Using KiCAD 5.0.2 on Ubuntu 18.04, and FreeCAD 0.16 64-bit based on Qt 4.8.7 ]]
I created a custom footprint for this barrier block connector; the pins are centered; this one does not come with manufacturer’s 3D model; so, I downloaded the 3D model for this other connector from Molex. Problem is, the pins are non-centered.
So, I edit the model with FreeCAD, and moved the pins to get them centered. This is what the modified model looks like in FreeCAD:
But this is what it looks like when I import it into KiCAD’s footprint editor (through-hole pins in the footprint are centered; pins of the 3D model are not):
I have little experience with 3D CAD software or file formats (just enough to, guided by Google searches, make these modifications using FreeCAD) — can someone with enough experience in 3D software and file formats shed some light on this?
Neither Kicad’s nor Freecad’s. You think the 3dmodel and the footprint are centered but they aren’t.
Install Freecad 0.17 and the workbench kicad-stepup.
Load the footprint and center the footprint and the 3d model.
Then export again the step model from kicad-stepup.
I really don’t understand this (which makes me suspect that you may not have understood what I meant).
Look at the FreeCAD screen capture — look on the bottom surface, a bit to the left of the pins; those two holes, those are the positions of the pins in the original file as I downloaded it (because the Molex connector has the pins close to one of the edges of the connector). I moved them towards the right, so now they’re centered (the pins, with respect to the bottom surface of the connector).
That clearly shows in the screen shot; however, in KiCAD’s footprint editor, the pins are clearly not in the same position as they are in FreeCAD.
Does this change your comment or clarify what I meant?
Huh — I’m not sure what to make of this (or Pedro’s suggestion regarding this). From this stepup’s description, I see: “KiCad StepUp allows exporting KiCad 3D board and components to FreeCad which allows further export options.”
However, I can already export (at least as .step or .wrl), and I can see the model in FreeCAD (and I’ve sent those to a colleague that then has incorporated them to his design of the enclosure, all in 3D CAD software).
I’m not sure I can visualize the workflow of what you did (maybe I just need to get FreeCAD 0.17 and kicad-stepup and play with them? … …Who knew!! )
Sometimes a step model doesn’t work well in KiCad. In that case exporting it from StepUp workbench may fix the problem even though an ordinary human being can’t tell why. Additionally you get also automatically a wrl model.
To me it looks like the model in the screenshot is indeed wrong, the pins aren’t in the center of the 3d model body. Try to see it without the board in there.
My guess is that the model consists of multiple “bodies” but @cal-linux only shifted the “body” that represents the black part of the model. (A body is a CAD container representing one singular solid.)
Would you mind reporting this as a bug to https://bugs.launchpad.net/kicad along with the file? The file is correct but KiCad is not displaying it correctly. As to the reason, I’d be guessing right now so I’ll avoid that.
Actually, no, I moved the 14 surfaces (“bodies”?) that form the two connection pins at the bottom (7 surfaces each pin, given the curved/filleted ends). In FreeCAD, I started with the toolbar button that “breaks” the model into its parts (the blue down arrow, below-right from the red circle button in the above screen shot) — that is what gives me the Face001 to Face118 surfaces. Face001 to Face014 happen to be the pins at the bottom; I selected those and set the z coordinate to 3.9mm (instead of 0mm original value).
To save, I selected Face001 to Face118 and went to menu File → Export and selected a .step output file.
Not sure whether this would provide any clues as to why/how KiCAD is failing to interpret the 3D model (going with Seth’s comment that the 3D file is indeed correct).
Indeed as soon as I do, in KiCAD’s footprint editor, “Add 3D shape” and select this file, the footprint editor shows the 3D model by itself, without the board, and it does show with the pins non-centered:
A note about your model (not necessaraly the source of your problems but it might make it harder for freecad to generate a step file from it.):
Surface only models are generally a bad idea. (A lot of CAD functions only work on volumetric models. Surface modeling requires specialized tools. Even with such specialized tools you would never use surface models for anything else than getting a guide. The outer shell of a car for example starts as a surface from the designer. The engineers then convert it into a volumetric model that represents material thicknesses and also things like welding joins, …)
I am also unsure how you managed to damaged the model this badly to be honest. If i download the manufacturer model i get a solid as it should be.
I ran freecads geometry check on the original model. Lets say it has errors is an understatement. (Even looking at the model already shows problems. Check the outer sides closely. Especially the area around the rounded edges. Something is seriously wrong with this model as it is from the manufacturer. Or there are massive bugs in freecads step import.)
It would also help if you uploaded your footprint.
Hi @cal-linux
the original Molex model is a solid, instead your FC rework is a shell (part made of faces) wich doesn’t belong to a solid. This is the main culprit of your issue.
You should modify the molex model maintaining the model solid.
After that you can export your model to be used in kicad.
The Molex model is shown exactly the same in DesignSpark Mechanical…
The only issue in FC is that often the internal geometry check gives false positives.
I would have assumed false positives as well would it not look that strange in this particular area. (The rounded edge looks like it failed to properly generate. I kind of assumed this could be one of the problems reported. I did not invest the time to really check the reported errors.)
Notice, the above is the model with the original 3D model — which was already a slightly modified version of the one from Molex (to change the color of the plastic surfaces to near-black).
Do keep in mind that, as stated in my initial post, I have very little experience with 3D CAD software or file formats. When opening the model in FreeCAD, it did look like all I had access to were surfaces (I assume that this is related to the way I’m using the software, presumably not the right/optimal way).
In any case, it does look like I will definitely want to look at kicad-stepup, which hopefully will make it easier to do 3D CAD manipulations while producing KiCAD-friendly files.
Turns out I could fix it with plain FreeCAD (the same 0.16 I have) based on this observation above.
The way I see it (and this is just inference on my side), the model is just a bunch of surfaces; the inside of the model is just empty space. The solid-vs-non-solid aspect seems to be given by whether or not the surfaces completely cover the internal volume (mathematically, the way to express this would be: the surfaces completely cover the internal volume if ∄ a continuous line that connects a point in the inside volume with a point outside the volume without intersecting any of the surfaces — in any case, this statement works for “simple” solids where no two surfaces intersect).
The bottom surface had two holes in it, which were covered by the two pins; when I move the two pins, then the “solid” now has holes and stops being a solid.
The fix was: I added a box (Create a cube solid toolbar button in FreeCAD), and move it until it aligns with the bottom surface; resize it and move it so that the two holes get covered; I think I split the box into its sub-components (the surfaces) attempting to merge the two surfaces, but FC does not allow to do that with surfaces (only works with two solids). But still, I then just selected all surfaces and went File → Export and saved as .step — now it works in KiCAD!
Thanks for all the comments/discussion and suggestions! (now I’m not sure whether I will want to go the stepup route, but at least I will keep it in mind for future instances!)