topherbuckley / kicad_remote_import

Helps to import KiCad component libraries imported from ultralibrarian and snapeda zipfiles.
Apache License 2.0
3 stars 0 forks source link

FreeCAD 3D Model Auto-Alignment #2

Open topherbuckley opened 2 years ago

topherbuckley commented 2 years ago

Anyone know how to use FreeCAD to auto-align the pins to the holes/pads? It doesn't seem the is any particular fixed offset/rotation that I can hard code in so wondered if there was any auto-align tools out there. Not sure how that'd work, but thought I'd at least ask.

Screenshot from 2022-06-02 17-05-30

Steffen-W commented 1 year ago

Hi even if it does not answer your question. In some libraries, even the needed rotation and translation is included. But it is ignored in your lib.

topherbuckley commented 1 year ago

Sorry, I haven't touched this is quite a while. Can you reference an example where such rotation and translation is included and where it is ignored in the lib?

Steffen-W commented 1 year ago

https://componentsearchengine.com/part-view/744043151/W%C3%BCrth%20Elektronik WE-TPC_4818_482892.kicad_mod

  (model 744043151.stp
    (at (xyz 0 0 0))
    (scale (xyz 1 1 1))
    (rotate (xyz -90 0 -90))
  )

https://componentsearchengine.com/part-view/XPGDWT-N1-0000-00XPP/Wolfspeed XPGDWTN1000000XPP.kicad_mod

  (model XPGDWT-N1-0000-00XPP.stp
    (at (xyz 0 0 0))
    (scale (xyz 1 1 1))
    (rotate (xyz -90 0 0))
  )

https://github.com/topherbuckley/kicad_remote_import/blob/master/kicad-import.py#L319 This should be relatively easy to insert into the code. If the model entry is present, the string must be replaced by: "${KICAD6_3RD_PARTY}/" + found_model.name

topherbuckley commented 1 year ago

Thanks! I think I see your point. Offset, scale and rotate are all currently hardcoded in a string rather than extracted from the kicad_mod file. Happy to merge a PR if you wanted to fix this. I won't have time for a while to pick this back up and am not recalling off the top of my head how the parsing was working.

Steffen-W commented 10 months ago

I have added this to my repository. I hope it is recognizable which change the feature realizes.

https://github.com/Steffen-W/Import-LIB-KiCad-Plugin/commit/c501fe4e21bf2ba55679e2178c019b4a2b5acbe9?diff=unified