Overwrite courtyard offset in python script

I use a Python script from the official repository (footprint_scripts_sip.py) to generate a SIP-4 footprint. By default crt_offset=0.25 is set in footprint_global_properties.py. However the part I use has really loose tolerances, therefore I want to increase the courtyard offset to 0.35. Is there some way to overwrite this variable or another method where I can still use the makeSIPVertical function?
Thanks Dom

Well you might need to read the code. (There is no other documentation so the code is all you have)

Also, as a tip for the future: If you have a question about an external script then it might be a good idea to link to the script in your question.

Good tip :+1:

I already read the code and as far as I understand it crt_offset is the variable I need to change. But I don’t know how to change it in my own script. Of course I can adjust crt_offset in footprint_global_properties.py and it generates me the footprint that I want. Nonetheless, it would change all other footprints in the library as well, wherefore this change would be rejected in a PR.

It is actually more a Python coding question but all the methods I found on the internet to change a global variable from my own script don’t work. I am not sure if the script was written with the intention to change this value, so I’m not sure if this is even possible. Maybe you can point me into the right direction?

And also the code of my script:

I believe this is the way to go, you will generate the footprint that you want, when done, revert to the previous value, the footprints in the library are generated already, they are not generated by the script anymore, so nothing will be touched in your library.

When the footprint is regenerated in the future one must always remember to manually modify the global properties file. In my opinion this is not the ideal solution. Therefore, I tried a few more things and came up with the idea to copy footprint_global_properties.py into my folder. Then I can modify it and my script will always use this local copy and not the global settings. I think it is still not the best solution but I think its acceptable. Though thank you for your suggestion.

Well you could give “make sip vertical” another parameter. (that gets the default from the global file)

That might be the best solution. Do you think it is preferable to modify the “official” version of makeSIPVertical or rather make a copy and modify it? I think it is most important that a change to the “official” script does not affect any existing generators.

In the meantime I encountered another issue. This time I have a SIP package where some pins are missing. Therefore it would be good to also pass this information to the script. I will give it a try to implement this and depending on your answer I can create a PR to extend the original makeSIPVertical with this new features or just use it to generate the footprints.

And also thanks a lot :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.