Feature Request: Rotate on IDF Import

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Zimtschnecke
Posts: 15
Joined: Tue Aug 23, 2016 9:49 am

Feature Request: Rotate on IDF Import

Postby Zimtschnecke » Tue Aug 23, 2016 10:53 am

Hello Everybody,

I find the IDF import capability of FreeCAD very useful and integrated it into my workflow.

Over the time using the IDF import I ran into conflicts that I cannot resolve in a convenient way:

I create 3D designs from various PCB designs from different suppliers.
Each supplier has different conventions regarding component footprint orientation in their library.
FreeCAD_IDF_Import_Feature_Request_Placement_SOIC-8_footprint.PNG
FreeCAD_IDF_Import_Feature_Request_Placement_SOIC-8_footprint.PNG (8.9 KiB) Viewed 928 times
FreeCAD_IDF_Import_Feature_Request_Placement_SOIC-8_footprint_other_orientation.PNG
FreeCAD_IDF_Import_Feature_Request_Placement_SOIC-8_footprint_other_orientation.PNG (7.47 KiB) Viewed 928 times
The STEP model to be imported does match the orientation of some but not every component footprint it is mapped to.
FreeCAD_IDF_Import_Feature_Request_Placement_SOIC-8_model.PNG
FreeCAD_IDF_Import_Feature_Request_Placement_SOIC-8_model.PNG (3.62 KiB) Viewed 928 times
So I have multiple entries in my "footprints_models.csv" for parts with different orientation that are mapped to a single STEP model that, on import, is put on the board in mostly wrong orientations.

To solve this, it was necessary to have a STEP model library that offers each part in two to four different orientations to match the different orientations in the footprint libraries.

A more elegant solution was to have an extra column in the "footprints_models.csv" file to specify the rotation of the referenced STEP model around the Z axis to match given footprint orientation.


Example of "footprints_models.csv" file now:

"FOOTPRINT" "STEP FILE"
"Supplier1_Resitor0805" "RES0805.STP"
"Supplier2_Resitor0805" "RES0805.STP"
"Supplier1_SOIC-8" "SOIC-8.STP"
"Supplier2_SOIC-8" "SOIC-8.STP"


Proposed format of "footprints_models.csv" file:

"FOOTPRINT" "STEP FILE" "Z-AXIS-ROTATION"
"Supplier1_Resitor0805" "RES0805.STP" "0"
"Supplier2_Resitor0805" "RES0805.STP" "90"
"Supplier1_SOIC-8" "SOIC-8.STP" "0"
"Supplier2_SOIC-8" "SOIC-8.STP" "270"


Thank you for your attention and best regards.
User avatar
easyw-fc
Posts: 2632
Joined: Thu Jul 09, 2015 9:34 am

Re: Feature Request: Rotate on IDF Import

Postby easyw-fc » Tue Aug 23, 2016 4:45 pm

Zimtschnecke wrote:Hello Everybody,

I find the IDF import capability of FreeCAD very useful and integrated it into my workflow.
you may find useful this post
viewtopic.php?t=13603
which is the software you are using to generate IDF file?
if you are using kicad, you may consider kicad StepUp instead
https://sourceforge.net/projects/kicadstepup/
Zimtschnecke
Posts: 15
Joined: Tue Aug 23, 2016 9:49 am

Re: Feature Request: Rotate on IDF Import

Postby Zimtschnecke » Tue Aug 23, 2016 5:30 pm

First, thank you very much for your great work and contributing to the project.

I use Cadence Allegro or Mentor Graphics PADS for IDF generation.
Actually it shouldn't matter which tool generates the IDF since they should look all the same.

If I got it right, the idea behind the KiCAD importer is a bit different than the other IDF importer.

This is an example result of a IDF file with STEP models mapped to each component footprint:
Example_IDF_Import.png
Example_IDF_Import.png (67.83 KiB) Viewed 907 times
User avatar
easyw-fc
Posts: 2632
Joined: Thu Jul 09, 2015 9:34 am

Re: Feature Request: Rotate on IDF Import

Postby easyw-fc » Tue Aug 23, 2016 9:52 pm

Zimtschnecke wrote:Hello Everybody,

I find the IDF import capability of FreeCAD very useful and integrated it into my workflow.

Over the time using the IDF import I ran into conflicts that I cannot resolve in a convenient way:

I create 3D designs from various PCB designs from different suppliers.
Each supplier has different conventions regarding component footprint orientation in their library.

FreeCAD_IDF_Import_Feature_Request_Placement_SOIC-8_footprint.PNG

FreeCAD_IDF_Import_Feature_Request_Placement_SOIC-8_footprint_other_orientation.PNG

The STEP model to be imported does match the orientation of some but not every component footprint it is mapped to.

FreeCAD_IDF_Import_Feature_Request_Placement_SOIC-8_model.PNG

So I have multiple entries in my "footprints_models.csv" for parts with different orientation that are mapped to a single STEP model that, on import, is put on the board in mostly wrong orientations.

To solve this, it was necessary to have a STEP model library that offers each part in two to four different orientations to match the different orientations in the footprint libraries.

A more elegant solution was to have an extra column in the "footprints_models.csv" file to specify the rotation of the referenced STEP model around the Z axis to match given footprint orientation.


Example of "footprints_models.csv" file now:

"FOOTPRINT" "STEP FILE"
"Supplier1_Resitor0805" "RES0805.STP"
"Supplier2_Resitor0805" "RES0805.STP"
"Supplier1_SOIC-8" "SOIC-8.STP"
"Supplier2_SOIC-8" "SOIC-8.STP"


Proposed format of "footprints_models.csv" file:

"FOOTPRINT" "STEP FILE" "Z-AXIS-ROTATION"
"Supplier1_Resitor0805" "RES0805.STP" "0"
"Supplier2_Resitor0805" "RES0805.STP" "90"
"Supplier1_SOIC-8" "SOIC-8.STP" "0"
"Supplier2_SOIC-8" "SOIC-8.STP" "270"


Thank you for your attention and best regards.
please have a try with this
https://github.com/easyw/Idf
I have changed only
https://github.com/easyw/Idf/raw/master/Idf.py
and
https://github.com/easyw/Idf/raw/master ... models.csv

just substitute Idf.py with the new one and restart FreeCAD
this should work out of the box :)
Maurice
Zimtschnecke
Posts: 15
Joined: Tue Aug 23, 2016 9:49 am

Re: Feature Request: Rotate on IDF Import

Postby Zimtschnecke » Wed Aug 24, 2016 8:48 am

easyw-fc wrote: please have a try with this
https://github.com/easyw/Idf
I have changed only
https://github.com/easyw/Idf/raw/master/Idf.py
and
https://github.com/easyw/Idf/raw/master ... models.csv

just substitute Idf.py with the new one and restart FreeCAD
this should work out of the box :)
Maurice
Dear Maurice,

thank you very much for the lightning fast and perfectly implemented solution.

Your solution exactly adds the feature requested.

I tested your code with different IDF files, different footprints, different STEP models and placed on both sides of the board.

This should go into the master branch and be released with version 0.17 as it adds great value to everyone importing IDF files.

Thank you again and best regards.