mirror of
https://github.com/vofy/fekt-scara.git
synced 2025-05-07 18:51:00 +02:00
Model základny hotov - CAD freeze
This commit is contained in:
parent
728dcef89c
commit
5bad788801
56 changed files with 25 additions and 28 deletions
3mf/base
Electronics_Cover_Bottom_[x1].3mfElectronics_Cover_Center_Module_[x2].3mfElectronics_Cover_Connectors_Module_[x1].3mfElectronics_Cover_Display_Module.3mfElectronics_Cover_Display_Module_Hinge_Lock_[x1].3mfElectronics_Cover_Display_Module_Hinge_[x1].3mfElectronics_Cover_Display_Module_Panel_[x1].3mfElectronics_Cover_Fan_Module_[x2].3mfElectronics_Cover_Short.3mfElectronics_Cover_Top.3mfElectronics_Cover_Top_[x1].3mfElectronics_DIN_Rail_Holder_[x6].3mfElectronics_Display_Back_[x1].3mfElectronics_Display_Frame_[x1].3mfFrame_Bearing_Holder_[x1].3mfFrame_Handle_[x1].3mfFrame_Motor_Frame.3mfFrame_Motor_Mount_[x1].3mfFrame_Plate_Clamp_[x4].3mfFrame_Plate_Side_Clamp.3mfFrame_Plate_Side_Left.3mfFrame_Plate_Side_Left_[x2].3mfFrame_Plate_Side_Right.3mfFrame_Plate_Side_Right_[x2].3mfFrame_Tip.3mfFrame_Tip_Bottom_[x1].3mfFrame_Tip_Top_[x1].3mf
cad
Frame_Assembly.FCStd
printed/base
Electronics_Cover_Bottom.FCStdElectronics_Cover_Center_Module.FCStdElectronics_Cover_Connectors_Module.FCStdElectronics_Cover_Display_Module.FCStdElectronics_Cover_Empty_Module.FCStdElectronics_Cover_Fan_Module.FCStdElectronics_Cover_Top.FCStdElectronics_DIN_Rail_Holder.FCStdElectronics_Display.FCStdFrame_Bearing_Holder.FCStdFrame_Handle.FCStdFrame_Motor_Frame.FCStdFrame_Motor_Mount.FCStdFrame_Plate_Side_Left.FCStdFrame_Plate_Side_Right.FCStdFrame_Tip_Bottom.FCStdFrame_Tip_Top.FCStd
sourced
scripts
Binary file not shown.
BIN
3mf/base/Electronics_Cover_Center_Module_[x2].3mf
Normal file
BIN
3mf/base/Electronics_Cover_Center_Module_[x2].3mf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
3mf/base/Electronics_Cover_Display_Module_Hinge_Lock_[x1].3mf
Normal file
BIN
3mf/base/Electronics_Cover_Display_Module_Hinge_Lock_[x1].3mf
Normal file
Binary file not shown.
BIN
3mf/base/Electronics_Cover_Display_Module_Hinge_[x1].3mf
Normal file
BIN
3mf/base/Electronics_Cover_Display_Module_Hinge_[x1].3mf
Normal file
Binary file not shown.
BIN
3mf/base/Electronics_Cover_Display_Module_Panel_[x1].3mf
Normal file
BIN
3mf/base/Electronics_Cover_Display_Module_Panel_[x1].3mf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
3mf/base/Electronics_Cover_Top_[x1].3mf
Normal file
BIN
3mf/base/Electronics_Cover_Top_[x1].3mf
Normal file
Binary file not shown.
BIN
3mf/base/Electronics_DIN_Rail_Holder_[x6].3mf
Normal file
BIN
3mf/base/Electronics_DIN_Rail_Holder_[x6].3mf
Normal file
Binary file not shown.
BIN
3mf/base/Electronics_Display_Back_[x1].3mf
Normal file
BIN
3mf/base/Electronics_Display_Back_[x1].3mf
Normal file
Binary file not shown.
BIN
3mf/base/Electronics_Display_Frame_[x1].3mf
Normal file
BIN
3mf/base/Electronics_Display_Frame_[x1].3mf
Normal file
Binary file not shown.
Binary file not shown.
BIN
3mf/base/Frame_Handle_[x1].3mf
Normal file
BIN
3mf/base/Frame_Handle_[x1].3mf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
3mf/base/Frame_Plate_Clamp_[x4].3mf
Normal file
BIN
3mf/base/Frame_Plate_Clamp_[x4].3mf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
3mf/base/Frame_Plate_Side_Left_[x2].3mf
Normal file
BIN
3mf/base/Frame_Plate_Side_Left_[x2].3mf
Normal file
Binary file not shown.
Binary file not shown.
BIN
3mf/base/Frame_Plate_Side_Right_[x2].3mf
Normal file
BIN
3mf/base/Frame_Plate_Side_Right_[x2].3mf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
cad/printed/base/Electronics_DIN_Rail_Holder.FCStd
Normal file
BIN
cad/printed/base/Electronics_DIN_Rail_Holder.FCStd
Normal file
Binary file not shown.
BIN
cad/printed/base/Electronics_Display.FCStd
Normal file
BIN
cad/printed/base/Electronics_Display.FCStd
Normal file
Binary file not shown.
Binary file not shown.
BIN
cad/printed/base/Frame_Handle.FCStd
Normal file
BIN
cad/printed/base/Frame_Handle.FCStd
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
cad/sourced/WAGO_2002-1201.FCStd
Normal file
BIN
cad/sourced/WAGO_2002-1201.FCStd
Normal file
Binary file not shown.
|
@ -5,14 +5,15 @@ import FreeCAD # type: ignore
|
|||
import Mesh # type: ignore
|
||||
|
||||
# Define the project root directory
|
||||
project_root = os.path.abspath(
|
||||
os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)
|
||||
)
|
||||
project_root = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
|
||||
|
||||
# Define the directories for CAD files and 3MF export files
|
||||
printed_cad_dir = os.path.join(project_root, "cad", "printed")
|
||||
printed_3mf_dir = os.path.join(project_root, "3mf")
|
||||
|
||||
# Create the 3mf directory if it doesn't exist
|
||||
os.makedirs(printed_3mf_dir, exist_ok=True)
|
||||
|
||||
# List to keep track of files that failed to export
|
||||
failed_files = []
|
||||
|
||||
|
@ -23,43 +24,39 @@ for root, dirs, files in os.walk(printed_cad_dir):
|
|||
# Absolute path of the CAD file
|
||||
file_path = os.path.join(root, file)
|
||||
|
||||
# Abslute path for the exported 3MF file
|
||||
output_path = os.path.join(
|
||||
printed_3mf_dir, os.path.relpath(file_path, printed_cad_dir)
|
||||
).replace(".FCStd", ".3mf")
|
||||
FreeCAD.Console.PrintMessage(f"\nProcessing {file_path}\n")
|
||||
|
||||
# Create the output directory if it doesn't already exist
|
||||
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
||||
|
||||
FreeCAD.Console.PrintMessage(f"\nExporting {file_path}\n")
|
||||
|
||||
# Open the FreeCAD document and recompute it
|
||||
# Open the FreeCAD document
|
||||
doc = FreeCAD.openDocument(file_path)
|
||||
FreeCAD.setActiveDocument(doc.Name)
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
# Get the body object from the document
|
||||
body = doc.getObject("Body")
|
||||
if body is None:
|
||||
FreeCAD.Console.PrintError(f"No 'Body' found in {file}\n")
|
||||
FreeCAD.closeDocument(doc.Name)
|
||||
failed_files.append(file_path)
|
||||
continue
|
||||
# Iterate over all objects in the document
|
||||
for obj in doc.Objects:
|
||||
# Check if the object is Std_Part
|
||||
if obj.TypeId == 'App::Part':
|
||||
# Construct the output path for the 3MF file using the label
|
||||
output_path = os.path.join(
|
||||
printed_3mf_dir, os.path.relpath(root, printed_cad_dir), f"{obj.Label}.3mf"
|
||||
)
|
||||
# Create the output directory if it doesn't already exist
|
||||
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
||||
|
||||
# Try to export the body to a 3MF file
|
||||
try:
|
||||
Mesh.export([body], output_path)
|
||||
except Exception as e:
|
||||
FreeCAD.Console.PrintError(f"Error exporting {file}: {e}\n")
|
||||
failed_files.append(file_path)
|
||||
try:
|
||||
# Export the part to a 3MF file
|
||||
Mesh.export([obj], output_path)
|
||||
FreeCAD.Console.PrintMessage(f"Exported {obj.Label} to {output_path}\n")
|
||||
except Exception as e:
|
||||
FreeCAD.Console.PrintError(f"Error exporting {obj.Label}: {e}\n")
|
||||
failed_files.append(file_path)
|
||||
|
||||
# Close the FreeCAD document
|
||||
FreeCAD.closeDocument(doc.Name)
|
||||
|
||||
# Print the result of the export and the files that failed
|
||||
# Print the result of the export process
|
||||
if failed_files:
|
||||
FreeCAD.Console.PrintError("\nThe following files failed to export:\n")
|
||||
for file in failed_files:
|
||||
FreeCAD.Console.PrintError(f" - {file}\n")
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage("\nAll files have been exported successfully.\n")
|
||||
FreeCAD.Console.PrintMessage("\nAll files have been exported successfully.\n")
|
Loading…
Reference in a new issue