3D new library for Mechanical CAD exporting and enclosure design

Got it! :smile:
So it’s either:

  • use the Scale to kicad VRML button and then export directly as VRML, or
  • don’t do anything with the StepUp GUI macro and use Joan’s script from the command line.

If I do the first thing and then the macro, it’s the wrong size because I’ve scaled it twice?
If the second point is valid, then I wonder why using the GUI and then Joan’s script crashes FreeCAD…

Anyway, for me, I just won’t need to use Joan’s CLI script at all, I just click the button and then export direct as VRML from FreeCAD :smile:

Final question (for the time being haha!)

Some models appear rotated, and I can’t figure out why. I’ve recreated the 6-pin version of that JST connector, and despite aligning it properly to the footprint in FreeCAD, when I configure the resulting VRML file on my PCB in KiCAD, it’s rotated around 180 degrees. It’s not a big deal, I can just rotate the 3D settings in KiCAD, but I wonder why I’m getting it.
The Fuse holder is correct, the B02P-VL connector is correct, it’s just the B06P-VL that’s rotated…
b06pvl-wrl.zip (12.5 KB) B06P-VL-step.zip (35.0 KB)
CONN_JST_B06P-VL.zip (611 Bytes)

In KiCAD PCB:

@xavierw … send also the footprint
.kicad_mod

It’s the CONN_JST_B06P-VL.zip attachment in the previous post :wink:

edit: just noticed when I export from FreeCAD, the Info… popup box says that I need to rotate 180.0 on Z. So the information is given :smile: Out of interest, why cannot this rotation be managed in the created VRML file so nothing is then required externally in KiCAD?

the model you attached has these settings:

(model JST_B06P-VL.wrl
(at (xyz -0.3939 0.3 0))
(scale (xyz 0.3939 0.3939 0.3939))
(rotate (xyz -90 0 180))
)

but to use my script you have to set:
(as stated in the starter guide)

(model JST_B06P-VL.wrl
(at (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 z_angle))
)

I mean you have to put the model at 0,0,0 and scale (1,1,1)
and the orientation has to be changed only on z (rotation on x-y plane)
these parameters are also the parameters adopted for the new kicad libraries standard.

the information is related to the angle which is read from the .kicad_mod file, so it is just a reminder that the footprint model, to which your 3D part is aligned, is oriented as reported.

Moreover, when you have aligned your 3d model to module, it is your responsibility to update the model wrl part and the board that already have this model in.
This is exactly what you have to do with kicad standard way of working with Wings3D even if you don’t use kicad StepUp.
The plus with kicad StepUp is that you can see footprint when you align it… and of course you have the STEP exporting MCAD option

Anyway, I’m going to add a warning if the other parameters are not correct as e.g. in your kicad_mod footprint
thank you for your feedback :smile:
Maurice

You’re right - the scale does not apply at all to IDF component outlines; this is because the IDF outline is considered to be MCAD geometry data and in the general case a scale operation makes no sense. Historically the scale existed for VRML (visual data only) because the format does not enforce any specific unit; over the years people have abused this scaling in various ways but scaling shall never be applied to MCAD data intended for export to MCAD software.

Thanks @cbernardo, that makes sense :smile:
My only gripe now with FreeCAD is its amazing ability to massively bloat STEP files. This is regardless of aligning it to a footprint or not. As an example, one step file I created in Creo was 40kB. Once opened in FreeCAD, even if it is saved as-is with no changes, it’s now 241kB for the same thing…
Doing the aligning then doesn’t change much, the aligned shape is arond 246kB…
File if you’re curious: myrra_transformer.zip (39.3 KB) Not that this is a KiCAD related issue of course.

Just when I thought I was done! I’ve now managed to export one of my boards, but for some strange reason, some of the components lose their colour attributes in the rendered STEP model.
Of course, the individual STEP is OK and has all the colour, but once exported, it’s gone.

As an example:
Here’s a Molex KK connector which is in STEP format and opened in FreeCAD. I manually coloured the pins to a gold colour. This is saved in the AP214 format.

However, once the emn board is exported, all the different surfaces lose their colour information, and everything is a pale blue colour. It’s not the colour that bothers me, I can always change that, it’s just that all the different colours are merged into one generic one.

Some components are OK (like the DIPs, RJ45 receptacle, fuse holder in the background), but the Molex header, resistors and TO92 transistors have lost their colour info.

Is their a known complexity or size limitation? My resulting STEP file for the board is rather large, around 20MB.

hi xavierw,

i think that has to do with FreeCAD - the problem is if you combine a object in FreeCAD with the union tool most of the time it works - but sometimes the colors are lost - i have not found a reliable way to reproduce this…
if you use the array modifier the colors are lost definitely.
so if - for some reason - in some way the importer tries to union the parts this could happen…
sunny greetings
stefan

Hi Stefan,

Thanks for your input. It’s strange as the components that lost there colour weren’t unioned. I need to do some more testing: I reckon it won’t always be the same components that lose their colour. Take the TO92 package - that’s a very simple model I drew myself.

TO92.zip (24.0 KB)
Zip file contains three files: to92.stp which is the raw file that I drew in Creo, then the TO-92_Inline…step the output of FreeCAD once aligned to the footprint and the resulting VRML file which appears fine in KiCAD 3D viewer.

did you exported the board fusing all the objects? fusion export option sometimes may produce weird result because of Open Cascade engine … particularly when object are detached or co-planar
http://forum.freecadweb.org/viewtopic.php?t=8451#p69489

not related to the size… I exported >100M without any issue…

here the two models and board produced by kicad StepUp exporter…

Result :smiley:
Those components were in fact fine, but it dawned on me that they went all wrong at the end. Turns out it was the horizontal resistor that was not unioned / fused which makes all the following step components lose their colour.

Having now fused that resistor and re-exported, it’s all OK :smile: - thanks for your help along this thread. I’ve been the biggest spammer with my newbie questions :blush: but hopefully it will help others.

Now to streamline my step / vrml files and try to get them at a managable size once FreeCADed!

that is a FreeCAD known beahviour
http://forum.freecadweb.org/viewtopic.php?t=6685
I don’t know if can be managed because of the OCE engine…

Thanks for pointing out the problem with FreeCAD bloating the STEP files. For me that means that I’ll have to go create a lightweight STEP library for kicad some time in the future. I already have an IGES library which is capable of creating PCB mechanical assembly models but (a) I need to make some large changes to kicad so that Export functions can be implemented by plugins and (b) my library has no provisions to actually display a model. Since I only work on the code in what little spare time I have, it will be a year or more before we see any such features in kicad. At least for now there’s FreeCAD, even if it bloats the models by a ridiculous amount.

@cbernardo I would say “At least for now there’s FreeCAD and kicad StepUp:wink:

this solution fills a big gap in MCAD exporting that was missing in kicad

FreeCAD is the only open source complete solution that can handle MCAD in a robust and solid way…
There is also a really complete python API which helps a lot kicad integration…
Moreover I investigated a bit more and FreeCAD is exporting STEP adding triangulation to brep model; probably there is a way to export STEP model removing those added information…

Maurice

on github now: JST PH 2.0 TOP through hole 2-16 pin, STEP + VRML…

PS: I found that I got the XH series wrong, need to redo those…

2 Likes

@Joan_Sparky you (forum?) save a lot in the jpg quality :slight_smile: Could you post better quality jpg renders? Perhaps better a PNG file?
Do you have an overview / page with all the models generated so far?

Those are just screenshots, not renders - I won’t really waste time on renders there.
I usually resize the shots from ~1200 px wide to 800, sharpen a bit and finito, just as an overview really.
Also, until 3 months ago I was still on DSL with maybe 200kBit down… now it is maybe 10-20 times faster for me, but not for all and bandwidth costs money everywhere… the website also doesn’t seem to be able to serve/load pictures wider than 2000 px without problems (see thread of me about print colors, where I posted a screenshot of pcbnew side-by-side with a scan)…

What detail are you missing? I can always put a zoomed in view into one of the corners if that solves your problem.

As for an overview… no, not really. No need/time to do this… is there a tool for that?
Arranging those 15 connectors there in Inventor did cost me 15 min, as I haven’t got the mass-import mastered yet, where it drops off the parts on a single 1D line instead of a 3D one (had to realign all parts).

That’s a render from within inventor… goes relatively fast, but I’m not looking forward to do this for all the models I’ve done so far…

Hm… maybe I can render a single unit each time instead of the screenshot of the whole series, would that suffice? Which picture size is preferred?

1 Like

I was just suggesting to put all this screenshots in a webpage or git hub? (dont know how it works)

I understand now you complain about the size of VRMLs :wink:

Please, notice the JPG compression in the files:


I dont know if that is the forum issue of the quality of the picture you upload?
I believe if you save it in PNG they will still have low size and keep the perfect quality.