I'm thinking of changing how PCBmodE processes input files and the process in which it generates the board.
PCBmodE v4 takes input files and processes each component one by one, creating class objects for each as it goes. Then it places them on the board (SVG).
So we have the following hierarchy:
module -> board -> component -> footprint -> shape -> svgpath
The idea is that footprint doesn't have any of the modifiers that of the hierarchy 'above' it (scale, rotation, etc.) so that it can be reused for multiple instantiations. That requires, however, to modify each footprint object according to those modifiers after it has been created. So the footprint hierarchy down to svgpath is mutable. This sort of worked.
So far with v5 I've made svgpath mutable so if we wanted to rotate it after it has been created, we need to create a new object with rotation applied.
I was working on rotation recently and things got a bit out of hand because the process/implementation isn't too clear and I think I also got myself confused. This clearly isn't good.
So my thinking is this. First create a dictionary structure of the board with all the processing done (defaults, global/board settings, etc.) and apply the modifiers defined across the hierarchy. So in the case of rotate we can easily stack it up and apply it at the dictionary level before creating any objects. Then the next step would be to create the objects from this dictionary where all objects are immutable.
I think that this will simplify the logic and make the code more understandable and maintainable. It will also help add future modifiers and hierarchy (like multiple modules perboard and then add panel on top of that. It's a significant change so I'd like to hear your thoughts, comments, and ideas.
I'm thinking of changing how PCBmodE processes input files and the process in which it generates the board.
PCBmodE v4 takes input files and processes each component one by one, creating class objects for each as it goes. Then it places them on the board (SVG).
So we have the following hierarchy:
module -> board -> component -> footprint -> shape -> svgpathThe idea is that
footprintdoesn't have any of the modifiers that of the hierarchy 'above' it (scale, rotation, etc.) so that it can be reused for multiple instantiations. That requires, however, to modify eachfootprintobject according to those modifiers after it has been created. So thefootprinthierarchy down tosvgpathis mutable. This sort of worked.So far with v5 I've made
svgpathmutable so if we wanted to rotate it after it has been created, we need to create a new object with rotation applied.I was working on rotation recently and things got a bit out of hand because the process/implementation isn't too clear and I think I also got myself confused. This clearly isn't good.
So my thinking is this. First create a dictionary structure of the board with all the processing done (defaults, global/board settings, etc.) and apply the modifiers defined across the hierarchy. So in the case of
rotatewe can easily stack it up and apply it at the dictionary level before creating any objects. Then the next step would be to create the objects from this dictionary where all objects are immutable.I think that this will simplify the logic and make the code more understandable and maintainable. It will also help add future modifiers and hierarchy (like multiple
modulesperboardand then addpanelon top of that. It's a significant change so I'd like to hear your thoughts, comments, and ideas.