Skip to content

Commit

Permalink
Fix bug when unfolding sheet with material definition. issue #398
Browse files Browse the repository at this point in the history
  • Loading branch information
shaise committed Nov 17, 2024
1 parent 42f34be commit 9de49fe
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions SheetMetalKfactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def getSpreadSheetNames():
availableMdsObjects = []
for candidate in candidateSpreadSheets:
try:
KFactorLookupTable(candidate)
KFactorLookupTable(candidate.Label)
availableMdsObjects.append(candidate)
except ValueError as e:
FreeCAD.Console.PrintWarning(
Expand All @@ -90,7 +90,16 @@ def getSpreadSheetNames():
class KFactorLookupTable:
cell_regex = re.compile("^([A-Z]+)([0-9]+)$")

def __init__(self, lookup_sheet):
def __init__(self, material_sheet):
lookup_sheet = FreeCAD.ActiveDocument.getObjectsByLabel(material_sheet)
if len(lookup_sheet) >= 1:
lookup_sheet = lookup_sheet[0]
else:
raise ValueError(
"No spreadsheet found containing material definition: %s"
% material_sheet
)

key_cell = self.find_cell_by_label(lookup_sheet, "Radius / Thickness")
value_cell, k_factor_standard = self.find_k_factor_cell(lookup_sheet)

Expand Down

0 comments on commit 9de49fe

Please sign in to comment.