INNER CODE UNIT · Python
add_default_row
wzyn20051216/solidworks-automation-skill · apps/desktop/cad_workbench/app.py:476
def add_default_row(self, table: QTableWidget, kind: str) -> None:
if kind == "hole":
self._set_table_row(table, ["H1", "安装孔", "round", "bottom", "3.4", "4", "left", "bottom", "10", "10", "100", "60", "true"])
elif kind == "cutout":
self._set_table_row(table, ["I1", "USB-C", "front", "10", "4", "0", "1", "60", "15", "1", "0.3"])
else:
self._set_table_row(table, ["B1", "M3", "7", "2.8", "8", "bottom", "10", "10", "4", "true"])
def remove_selected_rows(self, table: QTableWidget) -> None:
rows = sorted({index.row() for index in table.selectedIndexes()}, reverse=True)
for row in rows:
table.removeRow(row)
def _cell(self, table: QTableWidget, row: int, column: int) -> str:
item = table.item(row, column)
return item.text().strip() if item else ""
def _float_cell(self, table: QTableWidget, row: int, column: int) -> float: