Skip to content

Commit 4b2394a

Browse files
committed
Check if IsFilled() exists
It was added after 5.1
1 parent 7c64336 commit 4b2394a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

InteractiveHtmlBom/ecad/kicad.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,15 @@ def parse_shape(self, d):
8484
return None
8585
start = self.normalize(d.GetStart())
8686
end = self.normalize(d.GetEnd())
87-
if shape == "segment" or shape == "rect" and not d.IsFilled():
87+
if (shape == "segment" or shape == "rect" and
88+
not (hasattr(d, "IsFilled") and d.IsFilled())):
8889
return {
8990
"type": shape,
9091
"start": start,
9192
"end": end,
9293
"width": d.GetWidth() * 1e-6
9394
}
94-
if shape == "rect" and d.IsFilled():
95+
if shape == "rect" and hasattr(d, "IsFilled") and d.IsFilled():
9596
return {
9697
"type": "polygon",
9798
"pos": start,
@@ -110,7 +111,7 @@ def parse_shape(self, d):
110111
"radius": d.GetRadius() * 1e-6,
111112
"width": d.GetWidth() * 1e-6
112113
}
113-
if d.IsFilled():
114+
if hasattr(d, "IsFilled") and d.IsFilled():
114115
shape_dict["filled"] = 1
115116
return shape_dict
116117
if shape == "arc":
@@ -146,7 +147,7 @@ def parse_shape(self, d):
146147
"angle": angle,
147148
"polygons": polygons
148149
}
149-
if not d.IsFilled():
150+
if hasattr(d, "IsFilled") and not d.IsFilled():
150151
shape_dict["filled"] = 0
151152
shape_dict["width"] = d.GetWidth() * 1e-6
152153
return shape_dict

0 commit comments

Comments
 (0)