Giter Club home page Giter Club logo

kicad-3d-models-in-freecad's Introduction

kicad-3d-models-in-freecad

kicad 3d models in freecad: this is a repo of 3d models done in freeCAD and exported in STEP and in VRML to be used in kicad 3d-viewer and in kicad StepUp tool with kicad StepUp it is possible to align the 3d-viewer and the 3d PCB and modules board in STEP, so to be able to obtain a perfectly identical represaentation in kicad 3d-viewer and in FreeCAD or MCAD software.

The only requirements, different from the actual way of using kicad is to substitute Wings3D with FreeCAD and, obviously, populate the 3D models with STEP lib...

The repo will have models starting from a FreeCAD project modeled in mm with a standar origin and orientation

                                        -----> STEP model exported (union of parts)

                                        -----> VRML model exported (scaled 1/2.54)

REQUIREMENTS

  • FreeCAD 0.17
  • CadQuery 1.2.0

If you would like to share your models, I'll be happy to add these to the 3D repo!!! :)

thank you for any suggestion and feedback,

Maurice

Risk disclaimer

USE 3D CAD DATA AT YOUR OWN RISK + DO NOT RELY UPON ANY INFORMATION FOUND HERE WITHOUT INDEPENDENT VERIFICATION.

kicad-3d-models-in-freecad's People

Contributors

acisternino avatar antoniovazquezblanco avatar chschlue avatar cnieves1 avatar dasfrank avatar dhaillant avatar easyw avatar esden avatar ferdymercury avatar franck78 avatar grob6000 avatar jhol avatar maximeborges avatar metacollin avatar misca1234 avatar mountyrox avatar myfreescalewebpage avatar penoud avatar poeschlr avatar qbort avatar rschaeuble avatar schrodingersgat avatar shackmeister avatar stambaughw avatar stoth avatar strombom avatar terjeio avatar timtashpulatov avatar tpambor avatar whitequark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kicad-3d-models-in-freecad's Issues

Module not work

Hi, i try to test your module but i cannot understand how to lunch...
I install "CadQuery" from https://github.com/dcowden/cadquery

I try to lunch "cq-ex2.FCMacro" (it's reside to my .Freecad/Macro but it's same if i try to lunch directly from your directory) and i receive this error :

Traceback (most recent call last):
  File "/home/hpc66-jo/.FreeCAD/Macro/cq-ex2.FCMacro", line 23, in <module>
    App.setActiveDocument("Ex000_Introduction")
<class 'Base.FreeCADError'>: Try to activate unknown document 'Ex000_Introduction'

Can you tell me how to use your script please ?

thank.
Jonathan.

Adding new tool?

Hi @easyw

For my recent models, I developed a Python class called Ribbon.

https://github.com/hackscribble/kicad-3d-models-in-freecad/blob/master/cadquery/FCAD_script_generator/Molex_55560/cq_models/ribbon.py

It let's me define a complex line as a series of straight line segments and arcs of given angle and radius, and then turns this centre line into a constant width closed wire (which can then be extruded to form a device pin or contact, for example).

Is this the sort of thing that might be added to the _tools folder, either as a standalone file or added into cq_helpers.py? If so, I will raise a PR.

Thanks

Example of use:

image

Fix Documentation

I am trying to add new models to the generators. Unfortunately the scripts referred to in the documentation files don't exist. (Like for example make_gw_export_fc.py) running the main_generator.py scripts that exist inside the deeper directories don't really work, complaining that it can't find the CadQuery module that is definitely installed in my freecad installation. Trying to push this further I ended up with errors complaining that exportVRML module is not present.

I wish to be able to contribute more content to the KiCad 3d models but not being able to figure out how to run the generator scripts makes it very difficult. :(

Maybe there should be a top level make file that generates all the models as every other software project that is expected to run on linux is built? Or at least a toplevel shell script that is tested on the most mundane and wide spread Ubuntu LTS installation with the default FreeCAD V0.15 and CadQuery installed using the addons_installer.

As a sidenote: Getting that far is already a hugely cumbersome process that requires a multitude of steps to reach, if you want more contributors you will definitely have to simplify this. :(

Scripts you want made

Hoping I could contribute some additional scripts. Promise to be tidier than the IDC headers this time! Let me know what you need next and I'll have a crack. Otherwise will be doing one to generate some TO92s (which were missing from my last project...).

BGA footprint generator failing

I have only tested the BGA generator script for now but it is failing with the "missing CadQuery 0.3.0 or later module". That error is generated despite CadQuery being installed. The actual offending line is from Gui.Command import * but it is included in the same try catch block as the CadQuery import command.

This is the offending line: https://github.com/easyw/kicad-3d-models-in-freecad/blob/master/cadquery/FCAD_script_generator/BGA_packages/main_generator.py#L108

Tested with freecad V0.15, V0.16, V0.17 and in all of them this script fails.

[LED_SMD/main_generator.py] No module named exportPartToVRML

Hello everybody,

I'm using CadQuery and the script /LED_SMD/main_generator.py for the first time. I'm starting the script by calling freecad-daily ./Downloads/FreeCAD/kicad-3d-models-in-freecad-master/cadquery/FCAD_script_generator/LED_SMD/main_generator.py LED_0805
FreeCAD is starting and I'm getting the following error message Exception while processing file: ./Downloads/FreeCAD/kicad-3d-models-in-freecad-master/cadquery/FCAD_script_generator/LED_SMD/main_generator.py [No module named exportPartToVRML] File format not supported: LED_0805

Could you please tell me what I'm missing? Thanks a lot!
Max

Buzzer_Beeper generator: Black screen in FC 0.18

While fixing the Buzzer_Beeper generator in order to work with FC 0.18 (see PR #374), I found that it works in FC 0.17 fine, but when running in FC 0.18, the program freezes (black screen) and nothing else is displayed.

I have tried to apply typical python3 fixes using 2to3 as well as other manual fixes but none worked (see my last commit here with the fixes I tried).

I can't debug this due to FC 0.18 black screening and not showing any exception/error messages - does anyone have any other ideas of what might be causing the behaviour?

It have a feeling that it might not be a python2/3 compatibility issue and instead some sort of issue with FreeCad python API?

Steps to reproduce:

  1. cd cadquery/FCAD_script_generator/Buzzer_Beeper
  2. start "" "C:\Program Files\FreeCAD 0.18\bin\freecad" main_generator.py MagneticBuzzer_CUI_CST-931RP-A

pinheaders not working

I'm trying to create pin headers with your script (c:/freecad/bin/freecad make_pinheaders_export_fc.py all). But FreeCAD just gives an error message:

./generated_pinheaders/\PinHeader_Straight_1x02_H06_p1.27mm.step
./generated_pinheaders/Exception while processing file: make_pinheaders_export_fc.py [local variable 'LIST_license' referenced before assignment]
File format not supported: all 

and only created that one .step file. What am I doing wrong?

And a second question, is it possible to create angled pinheaders?

Add option for origin offset to scripts

Some packages have their pickup point for pick and place machines not in the center of the footprint but shifted by an offset. I think at the moment it is not possible to generate 3D packages with this requirement. At least for the Converter_DCDC script but I haven't found this functionality in other scripts either.

KLC F6.2 says that the footprint anchor should be placed at the pickup point and KLC M2.2 tells that the 3D models must be placed with an offset of (0, 0). This means that the 3D model needs to be shifted in the python scripts.

I can imagine that this is not too difficult when the coordinate origin is shifted by the specified offset but I have no idea how to perform this in FreeCAD therefore, I will leave this task to someone else.

Murata's NXE2 series is an example where this is necessary:
image

Is there something wrong with the repository?

I am trying to push an update but get an error message

$ git remote -v

origin https://github.com/Misca1234/kicad-3d-models-in-freecad.git (fetch)
origin https://github.com/Misca1234/kicad-3d-models-in-freecad.git (push)
upstream https://github.com/easyw/kicad-3d-models-in-freecad (fetch)
upstream https://github.com/easyw/kicad-3d-models-in-freecad (push)

$ git push upstream Split_ACDC_DCDC_into_ACDC_and_DCDC_2

remote: Permission to easyw/kicad-3d-models-in-freecad.git denied to Misca1234.
fatal: unable to access 'https://github.com/easyw/kicad-3d-models-in-freecad/': The requested URL returned error: 403

Using the scripts with CADquery 1.2.0 and FreeCAD 0.18.3

I'm having trouble using the main_generator.py script with FreeCAD 0.18.3:

When I run:

freecad ./main_generator.py allQFN

I get:

FreeCAD 0.18.3, Libs: 0.18.3R
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2019
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

CadQuery 1.2.0
CadQuery is a parametric scripting API for creating and traversing CAD models
Author: David Cowden
License: Apache-2.0
Website: https://github.com/dcowden/cadquery
FC Version 
['0', '18.3', '', 'https://code.launchpad.net/~vcs-imports/freecad/trunk', '2019/07/19 03:17:35']FC Version 018.3
QtCore Version 5.12.2
Python Version 3.7.3 (default, Oct  7 2019, 12:56:13) 
[GCC 8.3.0]
FC Version 
['0', '18.3', '', 'https://code.launchpad.net/~vcs-imports/freecad/trunk', '2019/07/19 03:17:35']FC Version 018.3
QtCore Version 5.12.2
Python Version 3.7.3 (default, Oct  7 2019, 12:56:13) 
[GCC 8.3.0]
Exception while processing file: ./main_generator.py [invalid literal for int() with base 10: '18.3']

Is this an issue with CADquery?

SW DIP models rotated

imagen

The models for the SW DIP seem to have been exported rotated around PIN number 1 of the component.

Sorry I cannot find the time to guess why I cant execute the scripts with my version of FreeCAD and CadQuery.

Can anyone have a look at this?

DFN generator fails in FreeCAD 0.19

0.19-20943 fails to create models with

TQFN-20-1EP_5x5mm_P0.65mm_EP3.1x3.1mm{(0.14800000190734863, 0.14499999582767487, 0.14499999582767487): 'black body', (0.8240000009536743, 0.8199999928474426, 0.781000018119812): 'metal grey pins', (0.6909999847412109, 0.6639999747276306, 0.5979999899864197): 'light brown label'}
4.57e-07 <App> Document.cpp(3715): Failed to recompute TQFN_20_1EP_5x5mm_P065mm_EP31x31mm#Cut: Linked object is not a Part object
Recompute failed! Please check report view.
0.000593322 <App> Document.cpp(3715): Failed to recompute TQFN_20_1EP_5x5mm_P065mm_EP31x31mm#Cut: Linked object is not a Part object
Recompute failed! Please check report view.
<Import> ImportOCAF2.cpp(1132): TQFN_20_1EP_5x5mm_P065mm_EP31x31mm#Fusion001 has null shape

Working fine using 0.18.4.

Including the scripting part into the kicad library eco system?

@easyw from time to time we get people that seem to reinvent the wheel. I fear this is because they do not realize that your cadquerry/freecad scripting tools exist. (Similar problems exist for the footprint generator scripts.)

It might be a good idea to at least include a pointer to the cadquerry directory in the packages3d-source repo. The credits files in the packages3d repo alone do not seem to be enough (New contributors adding new models do not seem to look how the existing models have been created). I am not so sure a note in the Readme will help much. (If you want more time to think about this we can do this in the meantime)

We can include the FCAD_script_generator part as a git submodule. But this would require a fork that only contains this one directory. (Sadly git submodule can not point to subfolders in the source repository. There are unofficial git extensions but i do not assume library contributors would be able to use them.) It would also require that contributors know about git submodule. So maybe not the best option.

Another option would be to "move" that one folder over to the package3d repo. To keep you as maintainer of this little corner, we could give you collaborator status of the kicad-packages3d-source repo. (Of course only as long as you wish to keep maintaining this.) If we choose this option i would try to get the git history across as well.

A third option would be that the kicad team holds a fork of this repo and we point users via the repo description to the fact that your repo is the maintained repo.
I bet we will get pull requests on that fork.
Maybe it is possible to have some automatic script that syncs up the kicad fork with your repo on a regular basis. This would make it easy for contributors to just simply open a new PR on your repo with the same changes. We can even add a note to the pull request template that points to your repo.

Extending SMD TO and SOT scripts

Hi @easyw and @Shackmeister

I've opened this issue to continue the discussion from the PR ... #49

I'm adding Shackmeister to this conversation...
He did the work to extend sot packages to many asymmetric models and he was suggesting me to improve the generation for other models - @easyw

I was considering adding and option to set each pin induvidualy to either a GW or a flat pins... also I was thinking about adding an option in exclude_pins to set a value to 2.5 to only have half of the pin. would be used for TO-252 etc. - @Shackmeister

Can you confirm that the existing scripts are in this folder?
https://github.com/easyw/kicad-3d-models-in-freecad/tree/master/cadquery/FCAD_script_generator/GW_QFP_SOIC_SSOP_TSSOP_SOT

Thanks

model generation without firing up the FreeCAD GUI

I'd like to generate the 3D packages with main_generator.py script(s). Later on, I'll generate my newly created parts the same way. Unfortunately, the scripts fail with:

C:\Common\FreeCAD-0.17\bin\python.exe main_generator.py
FreeCAD 0.17, Libs: 0.17R13541 (Git)
Traceback (most recent call last):
  File "main_generator.py", line 64, in <module>
    import exportPartToVRML as expVRML
  File "../_tools\exportPartToVRML.py", line 100, in <module>
    clear_console()
  File "../_tools\exportPartToVRML.py", line 93, in clear_console
    mw=FreeCADGui.getMainWindow()
AttributeError: 'module' object has no attribute 'getMainWindow'

Then I realized that I have to call the main_generator.py script(s) with FreeCAD rather than with python. This is not documented by the way.

Afterwards, the FreeCad GUI is poping up the the conversion starts.

During my search regarding to the getMainWindow error I found the documentation about Embedding FreeCADGui. Especially the section Without even firing up the FreeCAD Gui was quite interesting to read. Maybe, this is an option for the future.

Folder for standalone script

Hi @easyw I have written a CQ script to generate the 3D models for a TO-220-7Lead_TabPin4 SMD device (aka TO-220-7-4). It is a "standalone" script to be run from the CQ workbench in FC - it does not use the main_generator.py framework.

In kicad-3d-models-in-freecad/cadquery/FCAD_script_generator/, should I create a folder just for this script or create a generic folder TO_SOT_Packages_SMD to match the .pretty folder in the KiCad library?

Thanks

Missing first pin marker on SSOP

I extended the SSOP generator script to include an SSOP-18 variant, see #173.

Now after proposing it for inclusion in KiCad/kicad-packages3D#320, I noticed that the first pin marker (circle) is missing in the generated FreeCAD model.

I've had a quick look at the source code for main_generator.py, but could not find an obvious reason for it to be missing. There are some commented-out lines, though. Maybe my rather recent FreeCAD version (compared to what some of the READMEs talk about) could play into it?

OS: Ubuntu 18.04 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13522 (Git)
Build type: None
Branch: releases/FreeCAD-0-17
Hash: 3bb5ff4e70c0c526f2d9dd69b1004155b2f527f2
Python version: 2.7.15rc1
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/UnitedStates (en_US)

Geometry Check on BOP

Hi @Shackmeister and all developers,
I've just updated the 'cq_cad_tools.py' adding two new functions:

  1. checkUnion(doc)
  2. checkBOP(shape)

and a source file to run these functions (I included all the functions in the file so to be able to run it easily)
checkBOP-example.py
I attached here also a wrong STEP model, not correctly union-ed and with wrong geometries to make some tests.
resistor-wrong-BOP.zip
uploaded also on the repo...

It is suggested to generate/export a STEP model, then close the file generator and import the STEP file;
then run the checkUnion function to see if the STEP file is correcty union-ed in a single part and run the checkBOP function to see if there are errors on the STEP shape.

This is going to be a quite robust check on the generated files... still in some case I found BOP check is not perfect, but it is for sure much better than the previous state.

Requirements:

  • FreeCAD 0.17 12703 or later

Using the scripts with CADquery 1.2.0 and FreeCAD 0.18.4

Hi Maurice, I'm having troubles getting the script to work in this new computer. I think I was using freecad 17 last time but I couldnt find that version so I'm stuck with fc18.

I'm getting this eError string: "CQ 030 doesn't open example file"

image
(sorry, can't figure out the shared clipboard on this VM)

image

I have the latest cadquery from the addon manager, a fresh ubuntu install, yaml is installed from pip3.

Not sure what else I can try...

Thanks!

The generator directory is a mess. How should we reorganize it?

@easyw, @SchrodingersGat, @Shackmeister, @DASFrank, @metacollin:
How should the generators be organized.
For me 3 options come to mind: (sorted from most effort to least effort.)

Option 1:
Go for depth
option1

Option 2:
My current effort. A bit of depth but also a lot of directories in the root folder.
option2

Option 3:
Focus on a uniform repo
Effort by Oliver (as i understand it. I might have interpreted it wrong.) This is the solution that creates the least amount of work.
option3

I vote for option 1 because i think it is the most future proof. (It will work even if we have 10 times the current generator scripts.)
Option 2 generates nearly the same amount of work as option 1 does. (Still has a cluttered root directory)
Option 3 could be a quick and dirty fix to get a uniform repository.

Any other suggestions?

Feedback concerning an often faced KiCad StepUp issue

Dear all!

Firstly I don't know how to get in touch with you apart from this GitHub issue section. I apologize if you don't like it this way.

I used KiCad to convert a STEP 3D design to a flat KiCad PCB footprint as explained in this tutorial (generating a kicad footprint from a 3D STEP model - YouTube). I got issues at the last step, which is the final export to the kicad_mod file. Either FreeCad uses too much RAM and my PC crash, or I get a Python fail Traceback. The console prints are copy-pasted below for your debugging.
The STEP file I wanted to convert can be found here (link to the download).
Versions used were: Windows 10 19041.928, FreeCad 0.19, KiCadStepUp installed via FreeCad addon manager today (23-04-21).

Does one of you know what could be my mistake seen the Traceback below?
On the other hands, I would be really happy if someone could help me converting this STEP to a footprint ;-).

Yours faithfully,
Cyril

14:59:35  exporting new footprint
14:59:35  saving to C:/Users/Luc/Desktop/PI16-ADC-footprint-v1.kicad_mod
14:59:35  Group
14:59:35  Sketch
14:59:35  Text
14:59:35  Text001
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  2d closed path
14:59:35  Running the Python command 'ksuToolsFootprintGen' failed:
Traceback (most recent call last):
  File "C:\Users\Luc\AppData\Roaming\FreeCAD\Mod\kicadStepUpMod\kicadStepUpCMD.py", line 1986, in Activated
    kicadStepUptools.PushFootprint()
  File "C:\Users\Luc\AppData\Roaming\FreeCAD\Mod\kicadStepUpMod\kicadStepUptools.py", line 16621, in PushFootprint
    export_footprint(name)
  File "C:\Users\Luc\AppData\Roaming\FreeCAD\Mod\kicadStepUpMod\kicadStepUptools.py", line 17248, in export_footprint
    drl_found=collect_drl(pth_ordered)
  File "C:\Users\Luc\AppData\Roaming\FreeCAD\Mod\kicadStepUpMod\kicadStepUptools.py", line 17887, in collect_drl
    r2=p[2][1]; cx2=p[2][2]; cy2=p[2][3]

Exception while processing file: main_generator.py [global name 'math' is not defined]

I'm very new to this script so this might be a non-issue and just me being stupid...

I am on Windows 10, FreeCAD version 0.17 and cadquery_module installed from within FreeCAD.
I have opened command prompt and navigated to cadquery\FCAD_script_generator\QFN_packages and run below two commands:

taskkill -im freecad.exe /f

start "" "C:\Program Files\FreeCAD 0.17\bin\freecad" main_generator.py QFN-16-1EP_3x3mm_Pitch0.5mm

When FreeCAD opens I get below error message in the FreeCAD console:

QFN-16-1EP_3x3mm_Pitch0.5mmException while processing file: main_generator.py [global name 'math' is not defined]
File format not supported: QFN-16-1EP_3x3mm_Pitch0.5mm 

Is this some bug or is my configuration incorrect?

Support JST SMD connectors and SH Series

JST connector series is widely used and lack support in these scripts. My main use cases are :

  • SH Series connectors which are SMD only
  • SMD vertical and horizontal variants of other series connectors.

SH series should be a good point to start from scratch on SMD variants and this variant scaled up with similar geometry but different parameters to other series connectors.

Render of PAD as circle

Hi, I don't know if its this the right place to report.

When try to open new footprint it shows the pad as circle, instead of a square with rounded corners.

I'm using freecad 0.17 with StepUp version 7.3.3.1
footprint tested: link

Thanks

yaml or not

Hi

What did we say a while ago, was we promoting ".yaml" or "cq_paramter" fileformat format ?

I was looking into "cadquery/FCAD_script_generator/LED_SMD" and it is yaml based regarding push
KiCad/kicad-packages3D#554

Best way to add a new 3D model?

Hi,
I was trying to use thist tool to generate a 3D model for this PR:
pointhi/kicad-footprint-generator#452
Which matches the OnSemi Case 506AQ.

I realized that it is already generated with correct exposed pad size if I run "freecad main_generator.py DFN-8-1EP_2x2mm_Pitch0.5mm".

However, Kicad needs a 3D model named as DFN-8-1EP_2x2mm_P0.5mm_EP0.7x1.3mm .
Therefore, what should I do to generate this model (and request a PR afterwards)?

TIA

align the License of the 3D models to the kicad libraries updated License

Hello contributors.

This issue is raised to align the License of the 3D models to the kicad libraries updated License.
(the license of the script generators will not change)

I'm kindly asking all the contributors to agree with this new license from GPL with symbol exception to CC-BY-SA 4.0 with symbol exception, as it is now adopted in KiCad libraries.
Here the new License file included into the models generator:
aligning License to CC-BY-SA 4.0
I'm adding the list of all contributors:
@hackscribble @hyOzd @DASFrank @poeschlr @stoth @Misca1234 @timtashpulatov @grob6000 @metacollin @terjeio @SchrodingersGat @Shackmeister @patricklaf @joe-skb7

Thanks a lot for your contribution.
Maurice

move more stuff inside _tools ?

Hello Easy

What is the correct most up to-date form of 'main_generator.py' ?

Actually, the molex is good. All the stuff in is clearly separated between drawing the models (imports CQ_models) and the creation/opening of files, licence, Gui etc...

Is it possible to move more of the code found in main_generator.py to something in _tools ?
A something that will callback the code to build what is wanted ?

main_genrator.py:

from cq_tools import savemodel

....
import my cq_models
....
def export_one_part (module, pincount, configuration, log):
      ....
       #gen a single model based on our data
       cq_obj_data = module.generate_part(pincount)
       
       #let 'tools' take care of boring stuff
        savemodel (cq_obj_data, module, pincount, configuration, log)

  def exportSeries(module, configuration, log, model_filter_regobj):
    for pins in module.series_params.pinrange:
        try:
            if model_filter_regobj.match(str(pins)):
                export_one_part(module, pins, configuration, log)
        except GeometryError as e:
            e.print_errors(stop_on_first_error)
            if stop_on_first_error:
                return -1
        except FreeCADVersionError as e:
            FreeCAD.Console.PrintError(e)
            return -1
    return 0
    .....

The 'configuration' can take care of all specifics like filenames, etc etc.
Is it correct to think that (not doing it today of course !) ?

Problems running the scripts

Hi everyone! Several weeks ago i started contributing to KiCad/kicad-packeges3D and created some 3D files with FreeCAD Part Design. In the discussion of my last PR KiCad/kicad-packages3D-source#293 i understood that a more efficient way is to use the CadQuery scripting. Thereupon i started to get a little bit deeper into this matter and worked through all the examples of CadQuery. But when i tried to understand/run the scipts in this (easyw/kicad-3d-models-in-freecad) repository i got a lot of problems. I could not run any script in FreeCad without getting errors and the same result i get when calling the scripts from the corresponding dir (e.g. DIP_Parts)

...\bin\freecad.exe main_generator.py DIP-10

It gives following exception in FreeCAD:

Exception while processing file: main_generator.py [Missing parentheses in call to 'print'. Did you mean print("CQ 030 doesn't open example file")? (cq_model_generator.py, line 120)]

The only success i had with the example file cq-ex2.FCMacro. This file runs without any problems.

Can anybody give some hints what's going wrong and what i should do to contibute to kicad-3d-models-in-freecad repository sucessfully.

Here my "About FreeCAD" output:

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.4 (GitTag)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: 980bf9060e28555fecd9e3462f68ca74007b70f8
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)

Generators not working on freecad V0.15

According to the README files the scripts should be working with the stable version of freecad that is the default version in Ubuntu aka V0.15.

But cq_cad_tools is checking and trowing an error if the version of freecad is less than V0.17.
https://github.com/easyw/kicad-3d-models-in-freecad/blob/master/cadquery/FCAD_script_generator/_tools/cq_cad_tools.py#L655

You should test the scripts on V0.15, and handle that gracefully unless you want to force everyone who would like to contribute to install developer version of freecad.

DC to DC converter generator no longer works

I was working on a new DC to DC converter model but the generator no longer seems to work. Using commit fb2c76a of this repo, running command:

'C:\Program
Files\FreeCAD 0.17\bin\FreeCAD.exe' .\main_generator.py "Converter_DCDC_XP_POWER_JTExxxxDxx_THT"

I get the following error in FreeCAD

CadQuery 1.2.0
CadQuery is a parametric scripting API for creating and traversing CAD models
Author: David Cowden
License: Apache-2.0
Website: https://github.com/dcowden/cadquery
FC Version
['0', '17', '13519 (Git)', 'git://github.com/FreeCAD/FreeCAD.git releases/FreeCAD-0-17', '2018/04/22 05:49:26', 'releases/FreeCAD-0-17', '1a8b868018f45ea486c0023fdbfeb06febc1fb89']FC Version 017
CQ 030 doesn't open example file
File format not supported: Converter_DCDC_XP_POWER_JTExxxxDxx_THT

It appears that something has been recently broken. This command used to work just a week or so ago.

bugfix

bug fix for script #254 used to generate this KiCad/kicad-packages3D#495

RED jack in the corner have pins inverted (Y only)

Changes the Y sign and it's OK (eg swap 3.25 & -3.25)

diff --git a/cadquery/FCAD_script_generator/Connector_Audio/cq_audio_jack_qingpu.py b/cadquery/FCAD_script_generator/Connector_Audio/cq_audio_jack_qingpu.py
index 0fbcfd1..13e962f 100644
--- a/cadquery/FCAD_script_generator/Connector_Audio/cq_audio_jack_qingpu.py
+++ b/cadquery/FCAD_script_generator/Connector_Audio/cq_audio_jack_qingpu.py
@@ -551,7 +551,7 @@ class cq_audio_jack_qingpu():
 
             A1 = 0.01,                                      # Body-board separation
 

-            pin = [['smd', -3.175, 3.25, 1.2, 2.5, 0.2], ['smd', -0.175, 3.25, 1.2, 2.5, 0.2], ['smd', 3.825, 3.25, 1.2, 2.5, 0.2], ['smd', 4.925, -3.25, 1.2, 2.5, 0.2]],
+            pin = [['smd', -3.175, -3.25, 1.2, 2.5, 0.2], ['smd', -0.175, -3.25, 1.2, 2.5, 0.2], ['smd', 3.825, -3.25, 1.2, 2.5, 0.2], ['smd', 4.925, 3.25, 1.2, 2.5, 0.2]],
             npthpin = [['pin', -4.775, 0.0, 1.5, 2.0], ['pin', 2.225, 0.0, 1.5, 2.0]],
             body_top_color_key  = 'metal aluminum',         # Top color
             body_color_key      = 'red body',               # Body color

Scripts have trouble to handle wide SOIC models

If you add this to the soic parameter file the script will not be able to solve it correclty,
it creates the wrl and step file but when the model is viewed in kicad the top is transparent


    'TSOP-I-32_18.4x8mm_P0.5mm': Params(
        #
        # TSOP I, 32 pins, 18.4x8mm body (https://www.micron.com/~/media/documents/products/technical-note/nor-flash/tn1225_land_pad_design.pdf, http://www.fujitsu.com/downloads/MICRO/fma/pdfmcu/f32pm25.pdf)
        # This model have been auto generated based on the foot print file
        # A number of paramters have been fixed or guessed, such as A2
        # 
        # The foot print that uses this 3D model is TSOP-I-32_18.4x8mm_P0.5mm.kicad_mod
        # 
        the = 9.0,         # body angle in degrees
        tb_s = 0.15,       # top part of body is that much smaller
        c = 0.1,           # pin thickness, body center part height
        R1 = 0.1,          # pin upper corner, inner radius
        R2 = 0.1,          # pin lower corner, inner radius
        S  = 0.1,          # pin top flat part length (excluding corner arc)
#        L = 0.65,         # pin bottom flat part length (including corner arc)
        fp_s = 1,          # True for circular pinmark, False for square pinmark (useful for diodes)
        fp_r = 0.4,        # first pin indicator radius
        fp_d = 0.5,        # first pin indicator distance from edge
        fp_z = 0.05,       # first pin indicator depth
        ef = 0.0,          # fillet of edges  Note: bigger bytes model with fillet
        cc1 = 0.25,        # 0.45 chamfer of the 1st pin corner
        D1 = 8.0,         # body length
        E1 = 18.4,         # body width
        E = 19.9,          # body overall width
        A1 = 0.1,          # body-board separation
        A2 = 1.5,          # body height
        b = 0.2,          # pin width
        e = 0.5,          # pin (center-to-center) distance
        npx = 16,           # number of pins along X axis (width)
        npy = 0,           # number of pins along y axis (length)
        epad = None,       # e Pad
        excluded_pins = None,          # pin excluded
        old_modelName = 'TSOP-I-32_18.4x8mm_P0.5mm',            # modelName
        modelName = 'TSOP-I-32_18.4x8mm_P0.5mm',            # modelName
        rotation = -90,      # rotation if required
        ),

metric fuses

I was wondering if there is any reason why there are no metric fuses included in the kicad 3d model libraries.

For example, C0402 is generated, but not Fuse0402. Maybe they could be included, giving them a different color? (blue or green)?

phoenix connector scripts not running

@poeschlr I'm currently going through the models and was planning to fix the library names of the phoenix connectors. I do however have some troubles with running your script, can you please check if you have some uncommited changes?

Resistor_THT script can omit lead bends

I am trying to model a Vishay/Dale CP0003 resistor (https://www.vishay.com/docs/30213/cp.pdf) using the following cq_parameters.py entry:

'CP0003': Params(
        body_color_key = 'white body',
        pin_color_key = 'metal grey pins',
        l = 22.22,
        d = 7.94,
        w = 7.94,
        pd = 0.914,
        px = 31.75,
        py = 0.0,
        shape = 'box',
        orient = 'h'
    ),

The resulting model has no lead bends nor lead stubs coming out of the body:
image

Is there some known and minor fix so that the leads come out properly but the model is still representative of this resistor?

I guess this is a limitation of the script, and different argument values will generate proper leads. If the arguments given are known to produce invalid results, it might be nice to alert the user at a minimum. Preventing model generation would be something else to consider, but certainly alert the user (especially since there isn't a preview for this script like the CP_Radial_THT script) as there's no quick and easy way to see there is a problem during model generation.

In addition, you may notice that the body color isn't very white. I found that other colors work well, and since the color looks more white in PCB design software I suppose this is an issue with FC or a misconfiguration of FC or my PC that is my fault. So I don't think there's anything to do about it, but I mention it just in case someone happens to have some ideas and takes the time to share them with me here.

In general, this script doesn't seem to have good error handling or input sanitation. While I was experimenting with various shapes to see what they look like, it wasn't always obvious what parameters were required for each shape (if zero is acceptable or not). It would be helpful to check the arguments based on the shape type and let the user know what's wrong. That all being said, a working generator that does it's thing nicely with a little trial and error is infinitely better than no generator at all!

Adding component with new parameters

I'm trying to add an inductor, http://katalog.we-online.de/pbs/datasheet/74435580680.pdf

Would it be the correct approach to add it to FCAD_script_generator\Inductors_SMD?

The available parameters are:

Params = namedtuple("Params", [
'L', # package length
'W', # package width
'T', # package height
'pb', # pin band
'pt', # pin thickness
'series', # Inductor Series
'modelName', # modelName
'rotation' # rotation if required
])

For the inductor in question I would need to remove the pb parameter and add pin length and width.

Adding new parameters breaks the existing models that are already in the script.

How would I modify the script without breaking the existing models?

Box_Headers: "missing CadQuery" message

Running main_generator.py gives missing CadQuery message but the program (and other generators) work OK.

Fixed by adding import FreeCADGui as Gui to program.

PR submitted: #39

Hard-coded paths in python scripts

I noticed that some scripts for updating footprints have hard-coded paths:
@Misca1234, was this because only you were using them?

Hard-coded paths:

FPDir = '../../../../kicad-footprints/Package_DFN_QFN.pretty'
KISYS3DMOD = '../../../../kicad-packages3D'
FreeCadExe = '/c/users/stefan/Downloads/FreeCAD_0.17.11223_x64_dev_win/FreeCAD_0.17.11223_x64_dev_win/bin/FreeCAD.exe'`

Files containing hard-coded paths:

grep -rnw -e '/c/users/stefan'
FCAD_script_generator/QFN_packages/FindMissingLGA3DModels.py:87:FreeCadExe = '/c/users/stefan/Downloads/FreeCAD_0.17.11223_x64_dev_win/FreeCAD_0.17.11223_x64_dev_win/bin/FreeCAD.exe'
FCAD_script_generator/QFN_packages/FindMissingDFN_QFN3DModels.py:87:FreeCadExe = '/c/users/stefan/Downloads/FreeCAD_0.17.11223_x64_dev_win/FreeCAD_0.17.11223_x64_dev_win/bin/FreeCAD.exe'
FCAD_script_generator/Varistor/FindMissingVaristor3DModels.py:87:FreeCadExe = '/c/users/stefan/Downloads/FreeCAD_0.17.11223_x64_dev_win/FreeCAD_0.17.11223_x64_dev_win/bin/FreeCAD.exe'
FCAD_script_generator/BGA_packages/FindMissingBGA3DModels.py:88:FreeCadExe = '/c/users/stefan/Downloads/FreeCAD_0.17.11223_x64_dev_win/FreeCAD_0.17.11223_x64_dev_win/bin/FreeCAD.exe'
FCAD_script_generator/DIP_packages/FindMissingDIP3DModels.py:87:FreeCadExe = '/c/users/stefan/Downloads/FreeCAD_0.17.11223_x64_dev_win/FreeCAD_0.17.11223_x64_dev_win/bin/FreeCAD.exe'
FCAD_script_generator/GW_QFP_SOIC_SSOP_TSSOP_SOT/FindMissingSOIC3DModels.py:87:FreeCadExe = '/c/users/stefan/Downloads/FreeCAD_0.17.11223_x64_dev_win/FreeCAD_0.17.11223_x64_dev_win/bin/FreeCAD.exe'
FCAD_script_generator/GW_QFP_SOIC_SSOP_TSSOP_SOT/FindMissingQFP3DModels.py:86:FreeCadExe = '/c/users/stefan/Downloads/FreeCAD_0.17.11223_x64_dev_win/FreeCAD_0.17.11223_x64_dev_win/bin/FreeCAD.exe'

Cannot generate 'gw' models

I don't have any problems generating any of the other models; however I get the following error when trying to generate 'gw' models.

debug: Part.makeLoft catching 'Standard_Failure' msg: 'Need at least two vertices, edges or wires to create loft face'

Output from terminal:-

freecad make_gw_export_fc.py all

`FC Version
['0', '15', '4671 (Git)', 'git://git.code.sf.net/p/free-cad/code', '2015/04/05 17:25:02', 'releases/FreeCAD-0-15', '244b3aef360841646cbfe80a1b225c8b39c8380c']FC Version 015
/usr/lib/freecad/Mod/CadQuery exists
FC Version
['0', '15', '4671 (Git)', 'git://git.code.sf.net/p/free-cad/code', '2015/04/05 17:25:02', 'releases/FreeCAD-0-15', '244b3aef360841646cbfe80a1b225c8b39c8380c']FC Version 015
/usr/lib/freecad/Mod/CadQuery exists
Cannot find icon: :/icons/media-playback-start.svg
CadQuery 0.3.0
CadQuery is a parametric scripting language for creating and traversing CAD models
Author: David Cowden
License: LGPL
Website: https://github.com/dcowden/cadquery
Opened /usr/lib/freecad/Mod/CadQuery/Examples/Ex000_Introduction.py
Executed /usr/lib/freecad/Mod/CadQuery/Examples/Ex000_Introduction.py

Ex000 Closed
Dock adjusted

Running...

ACCE=11.8;E1=10.0;S=0.2;L=0.6
debug: Part.makeLoft catching 'Standard_Failure' msg: 'Need at least two vertices, edges or wires to create loft face'
Exception while processing file: make_gw_export_fc.py [Need at least two vertices, edges or wires to create loft face]`

Python console output:-
`Python 2.7.6 (default, Jun 22 2015, 18:01:27)
[GCC 4.8.2] on linux2
Type 'help', 'copyright', 'credits' or 'license' for more information.

import WebGui
from StartPage import StartPage
WebGui.openBrowserHTML(StartPage.handle(),'file://' + App.getResourceDir() + 'Mod/Start/StartPage/','Start page')
import FreeCADGui as Gui
App.setActiveDocument("Ex000_Introduction")
App.ActiveDocument=App.getDocument("Ex000_Introduction")
Gui.ActiveDocument=Gui.getDocument("Ex000_Introduction")
App.setActiveDocument("")
App.ActiveDocument=None
Gui.ActiveDocument=None
App.setActiveDocument("qfp52_10x10_p065")
App.ActiveDocument=App.getDocument("qfp52_10x10_p065")
Gui.ActiveDocument=Gui.getDocument("qfp52_10x10_p065")
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.