← Back to team overview

kicad-lib-committers team mailing list archive

Re: FCAD script generator.

 

On 02/10/18 20:16, Wayne Stambaugh wrote:
On 10/2/2018 12:11 PM, Wayne Stambaugh wrote:
On 10/2/2018 11:21 AM, Rene Pöschl wrote:
On 02/10/2018 16:24, Wayne Stambaugh wrote:
I was playing around with the FCAD script generator project[1] in a
failed attempt to generate a 3D model for a DC to DC converter that I am
creating for a project at work and intent to push to the kicad
libraries.  Are these scripts still being used to create 3D models for
KiCad because I cannot get anything to work correctly using the supplied
documentation.  If someone could point me in the right direction, I
would appreciate it.

Cheers,

Wayne

You did not provide the link for your [1]
Sorry about that.  It's the same as your [1] below.


We currently use freecad plus cadquerry for scripting. (We no longer use
Wings3d) The scripts can be found here under [1]

The scripts require FreeCad 0.17 or newer. (If you disable geometry
checks then you can also use 0.15 and 0.16)  Plus the cadquerry module
[2] version 0.5.2 (If i remember correctly then version 1 had problems
with the "selectors". I have not worked with these scripts for a while
and there are newer releases of cadquerry so it might be that the
problem has been fixed.)
I have installed the latest version of cadquery and I see CadQuery in
the workbench list in FreeCAD and when I select it I see the CadQuery
menu so I'm assuming that's all good.

All of these are called from the commandline something similar to
FreeCad script_name.py parameters.
That was the problem.  I wasn't calling out the variant on the command
line.  Thanks for the tip.  Once I'm done with the model I can submit
the symbol, footprint, 3D models, and script changes for approval.

Scripts that i designed are also directly loadable in the cadquerry
workbench. (Examples are the molex scripts. There is a subdirectory
cq_models. Load the script via the menu item CadQuerry -> Open Script.
This way it is a lot easier to develop the script it self.) The main
script in such cases only takes care of creating all (selected) variants
and the export process (including the addition of colours.)
I don't think this is the case with the DC to DC converter script but I
can get it to create the model so I'm moving it the right direction.

The best place to get further help is via an issue at that repo or on
the user forum.

---

Another maybe easier option is to design your 3d file using freecad and
then use kicad stepup to export the resulting file for kicad. (It will
automatically generate the wrl and step files in the correct scaling and
if you choose also with our standard colour scheme.)
I would rather take advantage of existing script based model generators
rather than create models by hand.  My parametric modeling skills are
weak and I really don't have a lot of free time to work on them.

Thanks for the help,

Cheers,

Wayne

The third option is to use whatever 3d modeling program you like (Catia,
Siemens NX, Creo, ...), export step, import that step file into freecad
and then use stepup to get the wrl/step pair for kicad. Or use the
generated step file directly. (The same works with manufacturer supplied
3d models. Here you might need to take a close look at the license of
such models.)

For stepup the best place to get more info is the user forum. But i
would guess also via an issue over at its github repo: [3] Stepup can be
directly installed using the Addon Manager of freecad (tools -> Addon
Manager) A cheatsheet can be found under [4]

---

[1]:
https://github.com/easyw/kicad-3d-models-in-freecad/tree/master/cadquery/FCAD_script_generator


[2]: https://github.com/jmwright/cadquery-freecad-module

[3]: https://github.com/easyw/kicadStepUpMod

[4]:
https://github.com/easyw/kicadStepUpMod/raw/master/demo/kicadStepUp-cheat-sheet.pdf

One more quick question.  I noticed in the DC to DC converter script
that all of the dimensions in the are in millimeters which makes the 3D
model wrong scale for KiCad.  Is the preferred script method to create
the models in millimeters then scale them for KiCad using FreeCAD or
scale the dimensions for kicad when creating new script models?  I'm
finding it rather cumbersome to scale the model in FreeCAD so I was just
curious.

Cheers,

Wayne



The script should create a 1:1 mm scale step model plus a 1/2.54 scaled (inch) wrl file (the same way as stepup does.)

The footprint must be setup with scaling = 1 for this to work correctly.

The scaling happens via the scale parameter in this function call on line 819: colored_meshes = expVRML.getColoredMesh(Gui, export_objects , scale)

The scale variable is set a few lines above to 1/2.54

https://github.com/easyw/kicad-3d-models-in-freecad/blob/581bab3ea182ce68909fa83561f92caf6e9c8ea8/cadquery/FCAD_script_generator/Converter_DCDC/main_generator_Converter_DCDC.py#L819

https://github.com/easyw/kicad-3d-models-in-freecad/blob/581bab3ea182ce68909fa83561f92caf6e9c8ea8/cadquery/FCAD_script_generator/Converter_DCDC/main_generator_Converter_DCDC.py#L819

https://github.com/easyw/kicad-3d-models-in-freecad/blob/581bab3ea182ce68909fa83561f92caf6e9c8ea8/cadquery/FCAD_script_generator/Converter_DCDC/main_generator_Converter_DCDC.py#L819

https://github.com/easyw/kicad-3d-models-in-freecad/blob/581bab3ea182ce68909fa83561f92caf6e9c8ea8/cadquery/FCAD_script_generator/Converter_DCDC/main_generator_Converter_DCDC.py#L819



Follow ups

References