diff --git a/python/assign_alias.py b/python/assign_alias.py new file mode 100644 index 0000000..cf1b2e0 --- /dev/null +++ b/python/assign_alias.py @@ -0,0 +1,21 @@ +import FreeCAD as App + +# Change 'Spreadsheet' to the actual name of your sheet if different +sheet = App.ActiveDocument.getObject('Spreadsheet') + +# Set the range of rows you want to process (e.g., row 1 to 20) +start_row = 1 +end_row = 20 + +for i in range(start_row, end_row + 1): + val_cell = f"A{i}" + name_cell = f"B{i}" + + alias_name = sheet.get(name_cell) + + if alias_name: + # FreeCAD aliases cannot have spaces or special characters + clean_alias = "".join(filter(str.isalnum, alias_name)) + sheet.setAlias(val_cell, clean_alias) + +App.ActiveDocument.recompute() diff --git a/python/show_constraints.py b/python/show_constraints.py new file mode 100644 index 0000000..00f30ba --- /dev/null +++ b/python/show_constraints.py @@ -0,0 +1,20 @@ +# +# 3/23/26 ChatGPT +# shows details of constraints +# + +sk = App.ActiveDocument.ActiveObject + +App.Console.PrintMessage("Constraint Listing:\n") +print(f'Constraint Listing: ') +for i, c in enumerate(sk.Constraints): + App.Console.PrintMessage(f"\nConstraint {i}: {c.Type}") + + if hasattr(c, "Value") and c.Value != 0: + App.Console.PrintMessage(f" = {c.Value}") + + App.Console.PrintMessage( + f"\n First : Geo {c.First}, Pos {c.FirstPos}" + f"\n Second: Geo {c.Second}, Pos {c.SecondPos}" + f"\n Third : Geo {c.Third}, Pos {c.ThirdPos}\n" + )