3D new library for Mechanical CAD exporting and enclosure design

@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.

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)