freecad
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| freecad [2021/05/11 13:45] – ssm2017 | freecad [2024/02/14 00:39] (current) – ssm2017 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== freecad ====== | ====== freecad ====== | ||
| + | ===== blender 3 to freecad 19 ===== | ||
| + | | ||
| + | obj | ||
| + | | ||
| + | selection only | ||
| + | onjects as onj objects | ||
| + | | ||
| + | scale 1000 | ||
| + | forward y forward | ||
| + | up z up | ||
| + | geometry : | ||
| + | triangulate faces | ||
| + | |||
| + | | ||
| + | file / import | ||
| + | alias mesh = 1 object | ||
| + | | ||
| + | select all | ||
| + | part workbench : | ||
| + | menu part / create shape from mesh | ||
| + | | ||
| + | | ||
| + | | ||
| + | menu part / create a copy / refine shape | ||
| + | | ||
| + | menu part / convert to solid | ||
| + | | ||
| ====== Techdraw ====== | ====== Techdraw ====== | ||
| Update cartridge | Update cartridge | ||
| Line 49: | Line 76: | ||
| </ | </ | ||
| + | ====== Lighting test ====== | ||
| + | ===== Set Properties ===== | ||
| + | <sxh python> | ||
| + | def setLightingProperties(): | ||
| + | selection = FreeCADGui.Selection.getSelection() | ||
| + | # stop if none selected | ||
| + | if len(selection) < 1: | ||
| + | App.Console.PrintMessage(" | ||
| + | return | ||
| + | # assign properties | ||
| + | for item in selection: | ||
| + | # delete all the " | ||
| + | for prop in item.PropertiesList: | ||
| + | if item.getGroupOfProperty(prop) == " | ||
| + | item.removeProperty(prop) | ||
| + | App.Console.PrintMessage(" | ||
| + | # fixture type | ||
| + | if not hasattr(item," | ||
| + | item.addProperty(" | ||
| + | # channel | ||
| + | if not hasattr(item," | ||
| + | item.addProperty(" | ||
| + | # dimmer | ||
| + | if not hasattr(item," | ||
| + | item.addProperty(" | ||
| + | # gel | ||
| + | if not hasattr(item," | ||
| + | item.addProperty(" | ||
| + | |||
| + | setLightingProperties() | ||
| + | </ | ||
| + | ===== Build sheets ===== | ||
| + | <sxh python> | ||
| + | import collections | ||
| + | # get doc | ||
| + | doc = FreeCAD.ActiveDocument | ||
| + | |||
| + | # ==================== | ||
| + | # create spreadsheets | ||
| + | # ==================== | ||
| + | |||
| + | def deleteSheets(): | ||
| + | sheets = {" | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | # delete old spreadsheets | ||
| + | for sheet_name, sheet_label in sheets.items(): | ||
| + | if doc.getObject(sheet_name): | ||
| + | doc.removeObject(sheet_name) | ||
| + | App.Console.PrintMessage(" | ||
| + | doc.recompute() | ||
| + | |||
| + | # fixtures list | ||
| + | fixtures_count_sheet = doc.getObject(' | ||
| + | if not fixtures_count_sheet: | ||
| + | fixtures_count_sheet = doc.addObject(' | ||
| + | fixtures_count_sheet.Label = " | ||
| + | App.Console.PrintMessage(" | ||
| + | # empty the sheet | ||
| + | fixtures_count_sheet.clearAll() | ||
| + | # build first line | ||
| + | fixtures_count_sheet.set(" | ||
| + | fixtures_count_sheet.set(" | ||
| + | fixtures_count_sheet.setStyle(' | ||
| + | # | ||
| + | |||
| + | # gels list | ||
| + | gels_count_sheet = doc.getObject(' | ||
| + | if not gels_count_sheet: | ||
| + | gels_count_sheet = doc.addObject(' | ||
| + | gels_count_sheet.Label = "Gels Count" | ||
| + | App.Console.PrintMessage(" | ||
| + | # empty the sheet | ||
| + | gels_count_sheet.clearAll() | ||
| + | # build first line | ||
| + | gels_count_sheet.set(" | ||
| + | gels_count_sheet.set(" | ||
| + | gels_count_sheet.setStyle(' | ||
| + | # | ||
| + | |||
| + | # fixtures list by channel | ||
| + | fixtures_list_by_channel_sheet = doc.getObject(' | ||
| + | if not fixtures_list_by_channel_sheet: | ||
| + | fixtures_list_by_channel_sheet = doc.addObject(' | ||
| + | fixtures_list_by_channel_sheet.Label = " | ||
| + | App.Console.PrintMessage(" | ||
| + | # empty the sheet | ||
| + | fixtures_list_by_channel_sheet.clearAll() | ||
| + | # build first line | ||
| + | fixtures_list_by_channel_sheet.set(" | ||
| + | fixtures_list_by_channel_sheet.set(" | ||
| + | fixtures_list_by_channel_sheet.set(" | ||
| + | fixtures_list_by_channel_sheet.set(" | ||
| + | fixtures_list_by_channel_sheet.set(" | ||
| + | fixtures_list_by_channel_sheet.setStyle(' | ||
| + | # | ||
| + | |||
| + | # fixtures list by dimmer | ||
| + | fixtures_list_by_dimmer_sheet = doc.getObject(' | ||
| + | if not fixtures_list_by_dimmer_sheet: | ||
| + | fixtures_list_by_dimmer_sheet = doc.addObject(' | ||
| + | fixtures_list_by_dimmer_sheet.Label = " | ||
| + | App.Console.PrintMessage(" | ||
| + | # empty the sheet | ||
| + | fixtures_list_by_dimmer_sheet.clearAll() | ||
| + | # build first line | ||
| + | fixtures_list_by_dimmer_sheet.set(" | ||
| + | fixtures_list_by_dimmer_sheet.set(" | ||
| + | fixtures_list_by_dimmer_sheet.set(" | ||
| + | fixtures_list_by_dimmer_sheet.set(" | ||
| + | fixtures_list_by_dimmer_sheet.set(" | ||
| + | fixtures_list_by_dimmer_sheet.setStyle(' | ||
| + | doc.recompute() | ||
| + | |||
| + | # ==================== | ||
| + | # parse objects | ||
| + | # ==================== | ||
| + | objs = FreeCAD.ActiveDocument.Objects | ||
| + | # | ||
| + | |||
| + | # fill the devices list | ||
| + | fixtures_types_count = {} | ||
| + | gels_types_count = {} | ||
| + | fixtures_list_by_channel = {} | ||
| + | fixtures_list_by_dimmer = {} | ||
| + | for obj in objs: | ||
| + | if obj.isDerivedFrom(" | ||
| + | if hasattr(obj," | ||
| + | # get properties | ||
| + | fixture_type = obj.getPropertyByName(" | ||
| + | fixture_gel = obj.getPropertyByName(" | ||
| + | fixture_channel = obj.getPropertyByName(" | ||
| + | fixture_dimmer = obj.getPropertyByName(" | ||
| + | # fill the devices count | ||
| + | if fixture_type not in fixtures_types_count: | ||
| + | fixtures_types_count[fixture_type] = 0 | ||
| + | fixtures_types_count[fixture_type] += 1 | ||
| + | # fill the gels count | ||
| + | if fixture_gel not in gels_types_count: | ||
| + | gels_types_count[fixture_gel] = 0 | ||
| + | gels_types_count[fixture_gel] += 1 | ||
| + | # fill the list by channel | ||
| + | if not fixture_channel in fixtures_list_by_channel: | ||
| + | fixtures_list_by_channel[fixture_channel] = [] | ||
| + | fixtures_list_by_channel[fixture_channel].append(obj) | ||
| + | # fill the list by dimmer | ||
| + | if not fixture_dimmer in fixtures_list_by_dimmer: | ||
| + | fixtures_list_by_dimmer[fixture_dimmer] = [] | ||
| + | fixtures_list_by_dimmer[fixture_dimmer].append(obj) | ||
| + | |||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # order by key | ||
| + | fixtures_types_count = collections.OrderedDict(sorted(fixtures_types_count.items())) | ||
| + | gels_types_count = collections.OrderedDict(sorted(gels_types_count.items())) | ||
| + | fixtures_list_by_channel = collections.OrderedDict(sorted(fixtures_list_by_channel.items())) | ||
| + | fixtures_list_by_dimmer = collections.OrderedDict(sorted(fixtures_list_by_dimmer.items())) | ||
| + | |||
| + | # ============================== | ||
| + | # fill the fixtures count sheet | ||
| + | # ============================== | ||
| + | cell_idx = 2 | ||
| + | for fixt, qty in fixtures_types_count.items(): | ||
| + | type_cell = " | ||
| + | qty_cell = " | ||
| + | fixtures_count_sheet.set(type_cell, | ||
| + | fixtures_count_sheet.set(qty_cell, | ||
| + | cell_idx += 1 | ||
| + | # ============================== | ||
| + | # fill the gels count sheet | ||
| + | # ============================== | ||
| + | cell_idx = 2 | ||
| + | for gel, qty in gels_types_count.items(): | ||
| + | type_cell = " | ||
| + | qty_cell = " | ||
| + | gels_count_sheet.set(type_cell, | ||
| + | gels_count_sheet.set(qty_cell, | ||
| + | cell_idx += 1 | ||
| + | # ================================== | ||
| + | # fill the fixtures list by channel | ||
| + | # ================================== | ||
| + | cell_idx = 2 | ||
| + | for k,v in fixtures_list_by_channel.items(): | ||
| + | for fixture in fixtures_list_by_channel[k]: | ||
| + | channel_cell = " | ||
| + | dimmer_cell = " | ||
| + | type_cell = " | ||
| + | gel_cell = " | ||
| + | label_cell = " | ||
| + | fixtures_list_by_channel_sheet.set(channel_cell, | ||
| + | fixtures_list_by_channel_sheet.set(dimmer_cell, | ||
| + | fixtures_list_by_channel_sheet.set(type_cell, | ||
| + | fixtures_list_by_channel_sheet.set(gel_cell, | ||
| + | fixtures_list_by_channel_sheet.set(label_cell, | ||
| + | cell_idx += 1 | ||
| + | # ================================== | ||
| + | # fill the fixtures list by dimmer | ||
| + | # ================================== | ||
| + | cell_idx = 2 | ||
| + | for k,v in fixtures_list_by_dimmer.items(): | ||
| + | for fixture in fixtures_list_by_dimmer[k]: | ||
| + | dimmer_cell = " | ||
| + | channel_cell = " | ||
| + | type_cell = " | ||
| + | gel_cell = " | ||
| + | label_cell = " | ||
| + | fixtures_list_by_dimmer_sheet.set(dimmer_cell, | ||
| + | fixtures_list_by_dimmer_sheet.set(channel_cell, | ||
| + | fixtures_list_by_dimmer_sheet.set(type_cell, | ||
| + | fixtures_list_by_dimmer_sheet.set(gel_cell, | ||
| + | fixtures_list_by_dimmer_sheet.set(label_cell, | ||
| + | cell_idx += 1 | ||
| + | doc.recompute() | ||
| + | </ | ||
| {{tag> | {{tag> | ||
freecad.1620733508.txt.gz · Last modified: (external edit)
