Merge pull request #1 from vofy/dev

Pull bachelor theses changes to master
This commit is contained in:
Tomáš Batelka 2025-06-02 14:24:02 +02:00 committed by GitHub
commit ebadedc7da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
69 changed files with 12 additions and 164 deletions

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.

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.

View file

@ -1,68 +0,0 @@
#!/usr/bin/freecadcmd
import os
import FreeCAD as App # 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)
)
# 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 = []
# Traverse the printed CAD directory and its subdirectories
for root, dirs, files in os.walk(printed_cad_dir):
for file in files:
if file.endswith(".FCStd"):
# Absolute path of the CAD file
file_path = os.path.join(root, file)
App.Console.PrintMessage(f"\nProcessing {file_path}\n")
# Open the FreeCAD document
doc = App.openDocument(file_path)
App.setActiveDocument(doc.Name)
App.ActiveDocument.recompute()
# 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:
# Export the part to a 3MF file
Mesh.export([obj], output_path)
App.Console.PrintMessage(
f"Exported {obj.Label} to {output_path}\n"
)
except Exception as e:
App.Console.PrintError(f"Error exporting {obj.Label}: {e}\n")
failed_files.append(file_path)
# Close the FreeCAD document
App.closeDocument(doc.Name)
# Print the result of the export process
if failed_files:
App.Console.PrintError("\nThe following files failed to export:\n")
for file in failed_files:
App.Console.PrintError(f" - {file}\n")
else:
App.Console.PrintMessage("\nAll files have been exported successfully.\n")

View file

@ -1,74 +0,0 @@
#!/usr/bin/freecadcmd
import os
import FreeCAD as App # type: ignore
import FreeCADGui as Gui # type: ignore
# Define the project root directory
project_root = os.path.abspath(
os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)
)
# Define the CAD directory
cad_dir = os.path.join(project_root, "cad")
# Define the output directory
output_dir = os.path.join(project_root, "tex", "images", "2_prakticka_cast")
# Ensure the output directory exists
os.makedirs(output_dir, exist_ok=True)
# Iterate over all files in the CAD directory (excluding nested directories)
for file in os.listdir(cad_dir):
if file.endswith(".FCStd"):
file_path = os.path.join(cad_dir, file)
App.Console.PrintMessage(f"\nProcessing {file_path}\n")
# Open the FreeCAD document
doc = App.open(file_path)
App.setActiveDocument(doc.Name)
App.ActiveDocument.recompute()
# Check if the document contains any assemblies (App::Part)
has_assembly = any(
hasattr(obj, "Type") and obj.Type == "Assembly" for obj in doc.Objects
)
if has_assembly:
# Gui.showMainWindow()
# Set visibility to true for all objects in the assembly and hide all objects outside of the assembly
for obj in doc.Objects:
if hasattr(obj, "Type") and obj.Type == "Assembly":
for sub_obj in obj.OutList:
if sub_obj.ViewObject is not None:
sub_obj.ViewObject.Visibility = True
else:
if obj.ViewObject is not None:
obj.ViewObject.Visibility = False
for view in [
"ViewIsometric",
"ViewFront",
"ViewTop",
"ViewRight",
"ViewRear",
"ViewBottom",
"ViewLeft",
]:
Gui.ActiveDocument.sendMsgToViews(view)
output_path = os.path.join(
output_dir, f'{file.replace(".FCStd", "")}_{view}.png'
)
Gui.ActiveDocument.ActiveView.saveImage(
output_path, 1920, 1080, "Transparent"
)
App.Console.PrintMessage(f"Exported {view} view to {output_path}\n")
else:
App.Console.PrintMessage(
f"No assembly found in {file_path}, skipping image generation.\n"
)
# Close the FreeCAD document
App.closeDocument(doc.Name)

Binary file not shown.

Binary file not shown.

View file

@ -9,8 +9,8 @@
%english-slovak, % originální jazyk je angličtina, překlad je slovensky
%
%%% Z následujících voleb typu práce lze použít pouze jednu
semestral, % semestrální práce (výchozí)
%bachelor, % bakalářská práce
%semestral, % semestrální práce (výchozí)
bachelor, % bakalářská práce
%master, % diplomová práce
%treatise, % pojednání o disertační práci
%doctoral, % disertační práce

Binary file not shown.

View file

@ -47,7 +47,7 @@ Po obvodu skříně jsou upevněny další části tiskárny. Jednou z~nich je d
\section{Tisk}
Nastavení sliceru vychází z~nastavení doporučení projektu Voron. Jedná se tedy následující nastavení:
Nastavení sliceru vychází z~nastavení doporučeného projektu Voron. Jedná se tedy následující nastavení:
\begin{itemize}
\item Výška vrstvy: \textbf{0,2mm}
@ -60,9 +60,9 @@ Nastavení sliceru vychází z~nastavení doporučení projektu Voron. Jedná se
Doporučenými materiály pro tisk jsou: \textbf{ASA}, ABS nebo PETG.
\section{Implementace kinematiky SCARA do Klippy}
\section{Implementace kinematiky SCARA do Klipperu}
% cSpell:disable-next-line
Klippy je část firmwaru Klipper, která běží na počítači uvnitř 3D tiskárny, ke kterému je připojena řídící deska. Kód je napsán převážně v~jazyce Python, přičemž některé funkce jsou implementovány v~jazyce C. Volání těchto funkcí je realizováno použitím rozhraní CFFI (C Foreign Function Interface). Klippy slouží k~interpreataci výrobních instrukcí -- GCode, které jsou přeloženy na volání iterních metod. Tyto volání jsou odesílány po sběrnici USB do řídící desky, která například generuje pulzy pro krokové motory nebo spíná topná tělesa.~\cite{klipper_code_overview}
Klipper je část firmwaru Klipper, která běží na počítači uvnitř 3D tiskárny, ke kterému je připojena řídící deska. Kód je napsán převážně v~jazyce Python, přičemž některé funkce jsou implementovány v~jazyce C. Volání těchto funkcí je realizováno použitím rozhraní CFFI (C Foreign Function Interface). Klippy slouží k~interpreataci výrobních instrukcí -- GCode, které jsou přeloženy na volání iterních metod. Tyto volání jsou odesílány po sběrnici USB do řídící desky, která například generuje pulzy pro krokové motory nebo spíná topná tělesa.~\cite{klipper_code_overview}
\subsection{Přímá a~inverzní kinematika}
Kinematické transformace se používají k~převodu natočení kloubů na souřadnice koncového bodu (přímá transformace) a~naopak (inverzní transformace). Pro výpočet transformace je třeba znát délky ramen \(L_1\) a~\(L_2\), offsety ramen \(x_{offset}\) a~\(y_{offset}\) a~Elbow Crosstalk Ratio (ECR).
@ -133,7 +133,13 @@ Dalším krokem je výpočet vzdálenosti od počátku.
hypot = \sqrt{x^2 + y^2}
\end{equation}
Dále se vypočítají úhly ramen \(\phi_S\) (shoulder) a~\(\phi_E\) (elbow).
Dále se vypočítají úhly ramen \(\phi_E\) (elbow) a~\(\phi_S\) (shoulder).
\begin{equation}
\phi_E = arccos \left( \frac { x^2 + y^2 + L_1^2 + L_2^2 } { 2 \cdot L_1 \cdot L_2 } \right) [\si{\radian}]
\end{equation}
kde \(L_1\) a~\(L_2\) jsou délky ramen.
\begin{equation}
% cSpell:disable-next-line
@ -142,22 +148,6 @@ Dále se vypočítají úhly ramen \(\phi_S\) (shoulder) a~\(\phi_E\) (elbow).
kde \(L_1\) a~\(L_2\) jsou délky ramen.
\begin{equation}
\phi_E = \frac { \phi_S } { ECR } + arccos \left( \frac { x^2 + y^2 + L_1^2 + L_2^2 } { 2 \cdot L_1 \cdot L_2 } \right) [\si{\radian}]
\end{equation}
kde \(ECR\) je Elbow Crosstalk Ratio, \(L_1\) a~\(L_2\) jsou délky ramen.
Následně stačí převést úhel v~radiánech na stupně.
\begin{equation}
\Phi_S = \phi_S \cdot \frac { 180 } { \pi } [\si{\degree}]
\end{equation}
\begin{equation}
\Phi_E = \phi_E \cdot \frac { 180 } { \pi } [\si{\degree}]
\end{equation}
% \section{Konfigurace tiskárny}
% \section{Kalibrace tiskárny}