3D new library for Mechanical CAD exporting and enclosure design

+1 from my side, but please check that every family will build after any change… I had to revert few times in the past just because of the need of a cleaner structure, but not working… :sweat_smile:

indeed a cleanup could be needed

the way we specified it in the other scripts is like this
all_params = {
“0271” : make_params( 2, ‘Molex_53261_0271’),
“0371” : make_params( 3, ‘Molex_53261_0371’),
“0471” : make_params( 4, ‘Molex_53261_0471’),
“0571” : make_params( 5, ‘Molex_53261_0571’),
“0671” : make_params( 6, ‘Molex_53261_0671’),
“0771” : make_params( 7, ‘Molex_53261_0771’),
“0871” : make_params( 8, ‘Molex_53261_0871’),
“0971” : make_params( 9, ‘Molex_53261_0971’),
“1071” : make_params(10, ‘Molex_53261_1071’),
“1171” : make_params(11, ‘Molex_53261_1171’),
“1271” : make_params(12, ‘Molex_53261_1271’),
“1371” : make_params(13, ‘Molex_53261_1371’),
“1471” : make_params(14, ‘Molex_53261_1471’),
“1571” : make_params(15, ‘Molex_53261_1571’),
“1771” : make_params(17, ‘Molex_53261_1771’)
}
kicad_naming_params = {
“0271” : make_params( 2, extraoffset, ‘Molex_PicoBlade_53261-0271_02x1.25mm_Angled’),
“0371” : make_params( 3, extraoffset, ‘Molex_PicoBlade_53261-0371_03x1.25mm_Angled’),
“0471” : make_params( 4, extraoffset, ‘Molex_PicoBlade_53261-0471_04x1.25mm_Angled’),
“0571” : make_params( 5, extraoffset, ‘Molex_PicoBlade_53261-0571_05x1.25mm_Angled’),
“0671” : make_params( 6, extraoffset, ‘Molex_PicoBlade_53261-0671_06x1.25mm_Angled’),
“0771” : make_params( 7, extraoffset, ‘Molex_PicoBlade_53261-0771_07x1.25mm_Angled’),
“0871” : make_params( 8, extraoffset, ‘Molex_PicoBlade_53261-0871_08x1.25mm_Angled’),
“0971” : make_params( 9, extraoffset, ‘Molex_PicoBlade_53261-0971_09x1.25mm_Angled’),
“1071” : make_params(10, extraoffset, ‘Molex_PicoBlade_53261-1071_10x1.25mm_Angled’),
“1171” : make_params(11, extraoffset, ‘Molex_PicoBlade_53261-1171_11x1.25mm_Angled’),
“1271” : make_params(12, extraoffset, ‘Molex_PicoBlade_53261-1271_12x1.25mm_Angled’),
“1371” : make_params(13, extraoffset, ‘Molex_PicoBlade_53261-1371_13x1.25mm_Angled’),
“1471” : make_params(14, extraoffset, ‘Molex_PicoBlade_53261-1471_14x1.25mm_Angled’),
“1571” : make_params(15, extraoffset, ‘Molex_PicoBlade_53261-1571_15x1.25mm_Angled’),
“1771” : make_params(17, extraoffset, ‘Molex_PicoBlade_53261-1771_17x1.25mm_Angled’)
}

this way it can be changed quite easy at

def generate_part(part_key):
pins = generate_pins(all_params[part_key])
body = generate_body(all_params[part_key])
#pins = generate_pins(kicad_naming_params[part_key])
#body = generate_body(kicad_naming_params[part_key])
return (pins, body)

this way there is always the parameters used for generating the files for kicad and users can use the other ones for adding non kicad compliant parameters

When i first answered i looked at my jst scripts. This scripts are done in the way you did.

But now that i looked at my molex script i must say i like it more if the name is generated using a format string.
This way one can’t make a mistake in one of the models. If one model has the correct name, all of them have. (You then only need to check the one with the lowest pin count and the one with the highest count.)

file_name="Molex_PicoBlade_53261-"+ ('%02d' % num_pins) +"71_" + ('%02d' % num_pins) + "x" + ('%.2f' % pin_pitch) +"mm_Angled",

Also just think how much information you need to enter for my phoenix scripts. There are more than 500 connectors generated.

Hehehehehehehe… :+1:

For now i will reorganize my own scripts. This way there is no danger in destroying anything that is not under my control. edit: or better worded: I don’t like the probability of destroying the work of someone else.
(Also i’m not 100% sure everything that has been done recently has been merged into your repository. I don’t want to move files that have already changed in someones personal repo.)

perhaps we should consider moving the script talk over to

this way does ofcourse make much better sense for the connector scripts
the other more “manual” way was mainly ment for the other packages with more changing parameters and names than pin numbers :slight_smile:

1 Like

it wasn’t you and none on this thread :wink:
Moreover sometimes the scripts are working fine with a specific release of FC and release of cadquery, but with different FC (OCC) or CQ they don’t fully build…

going back to 3D models… new PR for QFP


3 Likes

I noticed that nearly none of my scripts work under freecad 0.17.
There seems to be a problem with the cadquerry selectors in this version.
But freecad 0.17 is a nightly build so some bugs are to be expected.

Pull request for Molex connectors:


4 Likes

It’s like a bee-hive in here with all that action.
Anyhow - cool work guys (& gals).
:+1:

2 Likes

All that was needed was a go for adding step files :slight_smile:

2 Likes

@Rene_Poschl these models are great (and so much better than the official Molex models!)

Can’t wait for more connector models to be added.

The work you guys have done on material modeling and step file-size reduction is really awesome :slight_smile:

Another pull request:



I finally found what crashed freecad 0.15 on my windows pc. Don’t use the following (on a slow pc.)

Gui.activateWorkbench("PartWorkbench")
Gui.SendMsgToActiveView("ViewFit")
Gui.activeDocument().activeView().viewAxometric()
2 Likes

strange …

you may try to use:

FreeCAD.activeDocument().recompute()
FreeCADGui.activateWorkbench(“PartWorkbench”)
FreeCADGui.SendMsgToActiveView(“ViewFit”)
FreeCADGui.activeDocument().activeView().viewAxometric()

The problem is the workbench switch. (This explains why generating one model on its own did not crash freecad.)
I wonder if it is linux that keeps freecad alive or if there is a difference in behavior between freecad 0.15 and 0.16.

you can add this to close FC from inside python

sys.exit() #to create model and exit

16 is much better than v15 on all platforms. I am expecting v17 to be getting stabilised for release soon

The problem is that version 0.16 seems to have some bugs when exporting step.
https://forum.freecadweb.org/viewtopic.php?f=3&t=20455

To ensure that my models are usable i opted to use version 0.15 under windows.
Normally i use 0.17 under linux for designing parts. (I like what has been done with the part design workbench.)
But (some of) my scripts only run under 0.15 or 0.16 because of some error with cadquerry selectors in version 0.17.

And another one done. (JST EH)



2 Likes