Hi, thanks for the PCB-to-FreeCAD importer!
While importing a PCB from gEDA, I found some bugs in formats/geda.py, which I'd like to share with you:
In the function getLayerByNumber, the regex assumes that a layer is defined by:
Layer[1, name] ( <layer objects> )
However, gEDA PCB currently exports the following:
Layer(1, "name") ( <layer objects> )
I fixed this by modifying the regex to:
layer = re.search('^Layer\s*[\[\(]{0} .+?[\]\)]\n\(\n([^\)].+?\n)?\)\n'.format(layerNumber), self.projektBRD, re.DOTALL|re.MULTILINE).groups()[0]
notice the [[(] and [])] groups, which accept either () or [].
In the function getPCB, the code assumes that the board outline is defined in layer 7. This is incorrect. According to http://wiki.geda-project.org/geda:pcb_tips#how_do_i_make_a_board_outline_to_go_with_my_gerbers_to_the_board_maker the outline should be defined on a (randomly chosen) layer, which becomes the 'outline' layer by simply renaming it to outline
(case sensitive).
To fix this, I added a function getLayerByName, which is very similar to getLayerByNumber:
def getLayerByName(self, layerName): '''Function returns whole layer section''' try: layer = re.search('^Layer\s*[\[\)][0-9]+ \"{0}\"[\]\)]\n\(\n([^\)].+?\n)?\)\n'.format(layerName), self.projektBRD, re.DOTALL|re.MULTILINE).groups()[0] if layer: return layer else: return '' except: return ''
In getPCB, I replaced the two calls to getLayerByNumber(7)
by getLayerByName('outline')
.
The function getAnnotations simply searches all Text objects in the PCB file, but does not take the location of the texts (top/bottom) into account. I decided to leave this as it is for now...
Anonymous
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Oops, typo in getLayerByName: the function should be:
Модные заметки по подбору модных луков на каждый день.
Заметки профессионалов, новости, все показы и шоу.
https://rftimes.ru/news/2024-08-14-7-samyh-kultovyh-veshchey-ot-balenciaga
Hi,
ad 1 - this is problematic in geda, if I remember sometimes there is even 4 different structures to define the same object, agr :). Will be fixed.
ad 2 - somethin new, will be fixed.
ad 3 - at the moment annotations do not work anywhere correctly :). Will be fixed.
I will implement changes in new version. Thanks for feedback.