3D new library for Mechanical CAD exporting and enclosure design

Should be me… I think it’s set to 80% quality or something thereabouts.

Yes, would be nice to have pics that relate to the models for sure, but without an automatic way I’ll probably never get around to do it.
Maybe FreeCAD can do this?
@maui, do you know if that is possible, creating/saving a little pic of each module while it’s being scaled/converted that I could include into my script?
There seems to be some POVray link in FreeCAD…
Inventor does this autmoatically, as preview for when you load parts/assemblies from the convenient main menu.

@Joan_Sparky have a look here
http://forum.freecadweb.org/viewtopic.php?t=5917
and here
http://forum.freecadweb.org/viewtopic.php?t=1824
and here
http://forum.freecadweb.org/viewtopic.php?t=5020
PS nice models! :smile:

i have made a export button for freecad that exports me a selected object as step + takes a screenshot and saves it aside for quick ref.
image saving is easy:

def save_screenshot_of_objects(objects_to_include, filename):
    """save a screenshot from the given objects."""
    activeDoc = App.ActiveDocument
    # rembember the visibility of all objects in document:
    backupVisibilityTrue = []
    for obj in activeDoc.Objects:
        if obj.ViewObject.Visibility:
            backupVisibilityTrue.append(obj.Name)
            obj.ViewObject.Visibility = False
        #
    #
    # now all objects should be invisible.

    # now show all in objects_to_include:
    for obj in objects_to_include:
        obj.ViewObject.Visibility = True
    #

    # now make the screenshot
    width, height = Gui.activeDocument().activeView().getSize()
    Gui.activeDocument().activeView().saveImage(
        filename,
        width,
        height,
        'Transparent'
    )

    # now hide all in objects_to_include:
    for obj in objects_to_include:
        obj.ViewObject.Visibility = False
    #
    # now all objects should be invisible.

    # recreate original state
    for objName in backupVisibilityTrue:
        activeDoc.getObject(objName).ViewObject.Visibility = True
        App.Console.PrintMessage("objName():{}\n".format(objName))
    #

    # restore objects_to_include
    for obj in objects_to_include:
        Gui.Selection.addSelection(activeDoc.getObject(obj.Name))
    #

if i have some time i will upload my freecad macros…

1 Like

@Joan_Sparky, I’ve used your collection of transformer models, thanks :smile:
One strange problem with them though: when I open the STEP file in FreeCAD, I see it as two objects, and this doesn’t seem to go away when “unioning” them and saving the fuse as a single object; when I re-open it, it’s two objects again (the outer steel shell/pins and the internal windings).

A side effect of FreeCAD is that it generates very bloated STEP files so I’ve resorted to using Creo to manually align the STEP files and then just using FreeCAD with @maui’s macros to confirm alignment. However, I cannot seem to lose this dual-object thing. This causes the issue with losing colouring on the resulting STEP assembly. Also, it insists on “moving” the internal windings and making a mess of the whole thing.

Any ideas?

Wow, the coil package is not just moved, it’s rotated 90 degrees… look at the coil former there.
From the lessons learned with the MELF packages (parts where separated entities) I build any model solid in Inventor (extrusions etc. have overlap), so there shouldn’t be any possibility of parts to become loose.
I can confirm that FreeCAD sees two pieces there though - will investigate.

I found that a mirror operation that creates the copper-coil inset on the ‘other’ side of the coil package is causing this, if I suppress it and export a step model and import it into FreeCAD it’s just one object.
I can solve that, no problem.
I can’t explain why it separates like that though, as the creation of the coil package (with those separation planes) happens earlier and should be unrelated…

@xavierw
Somehow in your tool-chain something is applying moves/rotations to the 1st piece only and leaves the 2nd piece where it was… can you nail down or guess which step might cause that?

@maui
I should be able to avoid several-parts-per-model thing… we stumbled across this with the MELF I think. Can you check with StepUP if this is a potential problem with above transformer please? Thanks!

I changed the modelling slightly and found what might had been the problem… a projection sketch profile of the coil former had been used in the extrusion feature that creates the copper inset. Mirroring that causes the problem. I’ll have to repopulate the parametric tables with the different values for the series again to export every model for this change to take effect in the STEP/VRML files - will see if I can automate this a bit more, might be useful as one can see :blush:

I was more after some rendering automatism, not just plain screenshots :smile:

I found this here:
http://www.freecadweb.org/wiki/index.php?title=Raytracing_Module
which sounds pretty promising, when one scrolls down to the scripting part:
http://www.freecadweb.org/wiki/index.php?title=Raytracing_Module#Scripting

Maybe this can be adapted to create renders of each model in a comfortable size like 400x400 or somesuch…

@Joan_Sparky, I had cheated and used your great looking model for convenience: the transformer I actually use is a slightly larger one (a Vigortronix 12VA), but your model almost fitted so I used that, scaled it up to about 180% its size and rotated it to correspont with my footprint requirement. I guess the “seperation” means the outer shell is rotated and aligned with my footprint, the coil section was left behind…

@xavierw
please consider that to correctly export board and parts, every single 3D model has to be a single object (a fused/union object);
it is also a good habit, if you modify/create a library object, to check if the fusion process lead to an exported STEP model can be read as single object.
That will avoid problems in running the StepUp script…

@Joan_Sparky
I verified and e.g. EFD-x-x-x_series comes with 2 separated parts…
what I normally do, in case of detached parts to be fused, is to slightly enlarge one or add a small part to let the two objects to be connected, then I fuse them…
this trick normally will lead in a single object/part that can be loaded in FC and managed correctly by StepUp exporter

thanks guys for your work! :smile:
PS @everyone
I would like to have a collection of 3D screenshots of board exported to MCAD with StepUp script…
would you mind to post some screenshot or just send it by mail?
Thanks
Maurice :smile:

@s_light @Joan_Sparky
if you want to hide enclosure parts,
like in

at the moment there is a nice trick :smile:

just export your enclosure that you need to hide as
wrl with 100% of transparency
then enabling/disabling Material Properties you can hide/show your enclosure

2 Likes

https://github.com/JoanTheSpark/KiCAD/blob/master/3D-shapes/Conn_others.zip

2 Likes

Hey :slight_smile:
i have made some footprints and 3d-models for my last project.
they are all in separate git repositories… easiest way to have an overview is to use the search:
3dshapes:


footprints:

and libs for the components:

the 3d models are exported in wrl and step. (with the help of the great FreeCAD addon from @maui )

i have licenced theme as MIT.

  • i think the design exception thing for GPL & KiCad is not ready jet?

for the Samtec connectors there are missing 3D files. i will create them if i have time to look in the automatic creation things / scripts but if you need theme Samtec has models on there website…
eventually i will move the Samtec Series to one combined repository - (don’t know jet what i find nicer :wink: )

i think i have mainly followed the KLC guide -
only at the repository / footprint and lib names i think i have not get it right…
have to review this some time…

@Joan_Sparky the USB-Connectors are build with a Metall-Sheet-Working-Tools or?
if i want to create theme with FreeCAD i would only have solid tools… and that would make it very difficult to get these details…

sunny greetings
stefan

2 Likes

have you tried at
http://forum.freecadweb.org/viewtopic.php?t=11303


I think that could be a nice tool for that kind of objects :smiley:

@maui thanks :slight_smile: that looks promising!!
i will try it out with the next sheet-metal-part i have to do :wink:

Nice @s_light ! Did you use @maui VRML exporter?

Mind also the materials:

:slightly_smiling:

@s_light, @kammutierspule
I’m going to work on it :wink:
I have already started something quite easy to use…
I will keep you informed :smiley:

uhmm ya maybe you can add something nice to your exporter… but… it would be better if it was integrated from the options from FreeCAD… so it would be more general (and future supported)

FreeCAD already supports materials properties
The problem is that it is not supported for fused objects, but only for single shapes
So all the STEP models coming from manufacturers or on-line libs will be missing that option
Moreover the FC wrl exporting routines will generate a very big wrl file, compared to my exporting routines, and you said that the format of the standard exporter it is also not ‘clean’ to be represented in kicad, if I remember well
Attached a sample of FC file with 2 shapes with Material Properties and the wrl file exported by the standard FC routines
Gold-Aluminum-shapes.FCStd (3.7 KB)
Gold-Aluminum-shapes.wrl (29.5 KB)

I understand that. I have any proposal to solve that :confused: I dont know how STEP / FreeCAD deal with that…

It could be possible to parse the generated VRML and learn what are the common materials and convert it to other structure… but… that would be a wast of time :confused:

In any case… it should be always possible to assign materials to already vertex colors on the vrml shapes…
but the difuse will come from color per vertex.

No, I didn’t use a sheet metal tool for them as then I would have needed to built an assembly from sheet metal and solid parts and the export/conversion to STEP/VRML will come out with separate parts then. I avoid that at the moment (the last parts I did as an assembly were the SMD LEDs and my EC2/3 connectors as there the transparent parts need to be physically separate from the opaque ones, for Inventor to be able to make them transparent).
:sunglasses:

chapeau! :rocket: very good job!