Some changes
This commit is contained in:
parent
57455b84ab
commit
766bb1a985
103 changed files with 37820 additions and 2394 deletions
57
gcode/Generator/Old/backup/calculateangles.lpi
Normal file
57
gcode/Generator/Old/backup/calculateangles.lpi
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="My Application"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="calculateangles.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="calculateangles"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
43
gcode/Generator/Old/backup/calculateangles.lpr
Normal file
43
gcode/Generator/Old/backup/calculateangles.lpr
Normal file
|
@ -0,0 +1,43 @@
|
|||
program calculateangles;
|
||||
|
||||
uses SysUtils, Math; // Для работы с math
|
||||
|
||||
var
|
||||
x0, y0, d, a, b, c, discriminant, t1, t2, theta1, theta2: real;
|
||||
|
||||
begin
|
||||
// Исходные данные
|
||||
x0 := -30.37862;
|
||||
y0 := 5.24115;
|
||||
d := 0.825;
|
||||
|
||||
// Вычисление коэффициентов квадратного уравнения
|
||||
a := x0 * x0 - d * d;
|
||||
b := 2 * x0 * y0;
|
||||
c := y0 * y0 - d * d;
|
||||
|
||||
// Вычисление дискриминанта
|
||||
discriminant := b * b - 4 * a * c;
|
||||
|
||||
// Проверка наличия решений
|
||||
if discriminant >= 0 then
|
||||
begin
|
||||
// Вычисление корней квадратного уравнения
|
||||
t1 := (-b + sqrt(discriminant)) / (2 * a);
|
||||
t2 := (-b - sqrt(discriminant)) / (2 * a);
|
||||
|
||||
// Вычисление углов в градусах
|
||||
theta1 := ArcTan(t1) * 180 / Pi;
|
||||
theta2 := ArcTan(t2) * 180 / Pi;
|
||||
|
||||
// Вывод результатов
|
||||
writeln('Угол 1: ', theta1:0:10);
|
||||
writeln('Угол 2: ', theta2:0:10);
|
||||
end
|
||||
else
|
||||
begin
|
||||
writeln('Дискриминант отрицательный, нет вещественных решений.');
|
||||
end;
|
||||
|
||||
readln; // Чтобы консоль не закрылась сразу
|
||||
end.
|
23
gcode/Generator/Old/backup/calculateangles.lps
Normal file
23
gcode/Generator/Old/backup/calculateangles.lps
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="12"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="calculateangles.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<CursorPos X="5" Y="43"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory HistoryIndex="-1"/>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
58
gcode/Generator/Old/backup/calculaterectanglecorner.lpi
Normal file
58
gcode/Generator/Old/backup/calculaterectanglecorner.lpi
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="My Application"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="calculaterectanglecorner.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="CalculateRectangleCorner"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="calculaterectanglecorner"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
30
gcode/Generator/Old/backup/calculaterectanglecorner.lpr
Normal file
30
gcode/Generator/Old/backup/calculaterectanglecorner.lpr
Normal file
|
@ -0,0 +1,30 @@
|
|||
program CalculateRectangleCorner;
|
||||
|
||||
uses Math;
|
||||
|
||||
var
|
||||
length, width, angleDegrees, angleRadians, centerX, centerY, halfLength, halfWidth, leftBottomX, leftBottomY: real;
|
||||
|
||||
begin
|
||||
length := 30.7;
|
||||
width := 5.6;
|
||||
angleDegrees := 15;
|
||||
angleRadians := ((angleDegrees-90)) * Pi / 180;
|
||||
|
||||
centerX := 0;
|
||||
centerY := 0;
|
||||
|
||||
halfLength := length / 2;
|
||||
halfWidth := width / 2;
|
||||
|
||||
centerX := centerX - halfLength * Cos(angleRadians);
|
||||
centerY := centerY - halfLength * Sin(angleRadians);
|
||||
|
||||
leftBottomX := centerX - halfLength * Cos(angleRadians) - halfWidth * Sin(angleRadians);
|
||||
leftBottomY := centerY - halfLength * Sin(angleRadians) + halfWidth * Cos(angleRadians);
|
||||
//leftBottomY := centerY - halfWidth * Sin(angleRadians) - halfLength * Cos(angleRadians);
|
||||
|
||||
|
||||
writeln('Координаты левого нижнего угла: (', leftBottomX:0:6, ', ', leftBottomY:0:6, ')');
|
||||
readln;
|
||||
end.
|
33
gcode/Generator/Old/backup/calculaterectanglecorner.lps
Normal file
33
gcode/Generator/Old/backup/calculaterectanglecorner.lps
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="12"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="calculaterectanglecorner.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="CalculateRectangleCorner"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<CursorPos X="20" Y="12"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory HistoryIndex="1">
|
||||
<Position>
|
||||
<Filename Value="calculaterectanglecorner.lpr"/>
|
||||
<Caret Line="28" Column="5"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="calculaterectanglecorner.lpr"/>
|
||||
<Caret Line="13" Column="73"/>
|
||||
</Position>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
58
gcode/Generator/Old/backup/combinedcalculation.lpi
Normal file
58
gcode/Generator/Old/backup/combinedcalculation.lpi
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="My Application"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="CombinedCalculation"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="combinedcalculation"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
56
gcode/Generator/Old/backup/combinedcalculation.lpr
Normal file
56
gcode/Generator/Old/backup/combinedcalculation.lpr
Normal file
|
@ -0,0 +1,56 @@
|
|||
program CombinedCalculation;
|
||||
|
||||
uses Math;
|
||||
|
||||
var
|
||||
length, width, angleDegrees, angleRadians, centerX, centerY, halfLength, halfWidth, leftBottomX, leftBottomY, distance, a, b, c, discriminant, t1, t2, theta1, theta2: real;
|
||||
|
||||
begin
|
||||
// Входные данные для второй задачи (прямоугольник)
|
||||
length := 30.7;
|
||||
width := 5.6;
|
||||
angleDegrees := -15;
|
||||
distance := 0.825;
|
||||
|
||||
//angleRadians := (180-(angleDegrees+90)) * Pi / 180;
|
||||
angleRadians := angleDegrees * Pi / 180;
|
||||
halfLength := length / 2;
|
||||
halfWidth := width / 2;
|
||||
|
||||
centerX := 0; //Инициализируем центр
|
||||
centerY := 0; //Инициализируем центр
|
||||
|
||||
// Вычисление координат центра прямоугольника
|
||||
centerX := centerX - halfLength * Cos(angleRadians);
|
||||
centerY := centerY - halfLength * Sin(angleRadians);
|
||||
|
||||
// Вычисление координат левого нижнего угла (вторая задача)
|
||||
leftBottomX := centerX - halfLength * Cos(angleRadians) - halfWidth * Sin(angleRadians);
|
||||
leftBottomY := centerY - halfLength * Sin(angleRadians) + halfWidth * Cos(angleRadians);
|
||||
|
||||
// Использование результатов второй задачи в первой задаче
|
||||
writeln('Координаты левого нижнего угла: (', leftBottomX:0:6, ', ', leftBottomY:0:6, ')');
|
||||
|
||||
// Первая задача (исправленные коэффициенты)
|
||||
a := leftBottomX * leftBottomX + leftBottomY * leftBottomY;
|
||||
b := 2 * leftBottomX * leftBottomY;
|
||||
c := leftBottomY * leftBottomY - distance * distance;
|
||||
discriminant := b * b - 4 * a * c;
|
||||
|
||||
if discriminant >= 0 then
|
||||
begin
|
||||
t1 := (-b + sqrt(discriminant)) / (2 * a);
|
||||
t2 := (-b - sqrt(discriminant)) / (2 * a);
|
||||
|
||||
theta1 := ArcTan(t1) * 180 / Pi;
|
||||
theta2 := ArcTan(t2) * 180 / Pi;
|
||||
|
||||
writeln('Угол 1: ', theta1:0:10);
|
||||
writeln('Угол 2: ', theta2:0:10);
|
||||
end
|
||||
else
|
||||
begin
|
||||
writeln('Дискриминант отрицательный, нет вещественных решений.');
|
||||
end;
|
||||
readln;
|
||||
end.
|
57
gcode/Generator/Old/backup/combinedcalculation.lps
Normal file
57
gcode/Generator/Old/backup/combinedcalculation.lps
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="12"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="CombinedCalculation"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<CursorPos X="23" Y="12"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory HistoryIndex="7">
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="33" Column="65" TopLine="12"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="50" Column="5" TopLine="11"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="35" Column="71" TopLine="11"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="25" Column="120"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="37" Column="86" TopLine="7"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="38" Column="66" TopLine="7"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="12" Column="20" TopLine="4"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="15" Column="33"/>
|
||||
</Position>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
57
gcode/Generator/Old/backup/combinedcalculation2.lpi
Normal file
57
gcode/Generator/Old/backup/combinedcalculation2.lpi
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="My Application"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="combinedcalculation2.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="combinedcalculation2"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
67
gcode/Generator/Old/backup/combinedcalculation2.lpr
Normal file
67
gcode/Generator/Old/backup/combinedcalculation2.lpr
Normal file
|
@ -0,0 +1,67 @@
|
|||
program combinedcalculation2;
|
||||
|
||||
uses SysUtils, Math; // Для работы с math
|
||||
|
||||
var
|
||||
length, width, angleDegrees, angleRadians, centerX, centerY, halfLength, halfWidth, leftBottomX, leftBottomY: real;
|
||||
x0, y0, d, a, b, c, discriminant, t1, t2, theta1, theta2: real;
|
||||
|
||||
begin
|
||||
length := 40.7;
|
||||
width := 5.6;
|
||||
angleDegrees := 15;
|
||||
angleRadians := ((angleDegrees+90)) * Pi / 180;
|
||||
|
||||
centerX := 0;
|
||||
centerY := 0;
|
||||
|
||||
halfLength := length / 2;
|
||||
halfWidth := width / 2;
|
||||
|
||||
centerX := centerX - halfLength * Cos(angleRadians);
|
||||
centerY := centerY - halfLength * Sin(angleRadians);
|
||||
|
||||
leftBottomX := centerX - halfLength * Cos(angleRadians) - halfWidth * Sin(angleRadians);
|
||||
leftBottomY := centerY - halfLength * Sin(angleRadians) + halfWidth * Cos(angleRadians);
|
||||
//leftBottomY := centerY - halfWidth * Sin(angleRadians) - halfLength * Cos(angleRadians);
|
||||
|
||||
writeln('Координаты левого нижнего угла: (', leftBottomX:0:6, ', ', leftBottomY:0:6, ')');
|
||||
|
||||
// Исходные данные
|
||||
x0 := leftBottomY;
|
||||
y0 := leftBottomX;
|
||||
d := 0.825;
|
||||
|
||||
// Вычисление коэффициентов квадратного уравнения
|
||||
a := x0 * x0 - d * d;
|
||||
b := 2 * x0 * y0;
|
||||
c := y0 * y0 - d * d;
|
||||
|
||||
// Вычисление дискриминанта
|
||||
discriminant := b * b - 4 * a * c;
|
||||
|
||||
// Проверка наличия решений
|
||||
if discriminant >= 0 then
|
||||
begin
|
||||
// Вычисление корней квадратного уравнения
|
||||
t1 := (-b + sqrt(discriminant)) / (2 * a);
|
||||
t2 := (-b - sqrt(discriminant)) / (2 * a);
|
||||
|
||||
// Вычисление углов в градусах
|
||||
theta1 := ArcTan(t1) * 180 / Pi;
|
||||
theta2 := ArcTan(t2) * 180 / Pi;
|
||||
|
||||
// Вывод результатов
|
||||
writeln('Угол 1: ', theta1:0:10);
|
||||
writeln('Угол 2: ', theta2:0:10);
|
||||
end
|
||||
else
|
||||
begin
|
||||
writeln('Дискриминант отрицательный, нет вещественных решений.');
|
||||
end;
|
||||
|
||||
readln; // Чтобы консоль не закрылась сразу
|
||||
|
||||
|
||||
end.
|
||||
|
23
gcode/Generator/Old/backup/combinedcalculation2.lps
Normal file
23
gcode/Generator/Old/backup/combinedcalculation2.lps
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="12"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="combinedcalculation2.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<CursorPos X="14" Y="10"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory HistoryIndex="-1"/>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
62
gcode/Generator/Old/backup/combinedcalculation3.lpi
Normal file
62
gcode/Generator/Old/backup/combinedcalculation3.lpi
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="My Application"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="combinedcalculation3"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf3"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
67
gcode/Generator/Old/backup/combinedcalculation3.lpr
Normal file
67
gcode/Generator/Old/backup/combinedcalculation3.lpr
Normal file
|
@ -0,0 +1,67 @@
|
|||
program combinedcalculation3;
|
||||
|
||||
uses SysUtils, Math;
|
||||
|
||||
const
|
||||
lengthConst = 40.7;
|
||||
widthConst = 5.6;
|
||||
angleDegreesConst = 15;
|
||||
distanceConst = 0.825;
|
||||
|
||||
|
||||
function CalculateMaxMinAngle(rodLength, rodWidth, angle, clearance: double): double;
|
||||
var
|
||||
angleRadians, leftBottomX, leftBottomY: double;
|
||||
leftBottomX2, leftBottomY2: double;
|
||||
a, b, c, discriminant, t1, t2, theta1, theta2: double;
|
||||
a2, b2, c2, discriminant2, t12, t22, theta12, theta22: double;
|
||||
begin
|
||||
CalculateMaxMinAngle := 0; // Изначально нет решений
|
||||
|
||||
angleRadians := (angle + 90) * Pi / 180;
|
||||
|
||||
leftBottomX := -rodLength / 2 * Cos(angleRadians) - rodLength / 2 * Cos(angleRadians) - rodWidth / 2 * Sin(angleRadians);
|
||||
leftBottomY := -rodLength / 2 * Sin(angleRadians) - rodLength / 2 * Sin(angleRadians) + rodWidth / 2 * Cos(angleRadians);
|
||||
|
||||
writeln('Coordinates bottom-left corner: (', leftBottomX:0:6, ', ', leftBottomY:0:6, ')');
|
||||
|
||||
leftBottomY2 := -rodLength / 2 * Cos(0) - rodLength / 2 * Cos(0) - rodWidth / 2 * Sin(0);
|
||||
leftBottomX2 := -rodLength / 2 * Sin(0) - rodLength / 2 * Sin(0) + rodWidth / 2 * Cos(0);
|
||||
|
||||
writeln('Coordinates second bottom-left corner: (', leftBottomX2:0:6, ', ', leftBottomY2:0:6, ')');
|
||||
|
||||
|
||||
a := sqr(leftBottomY) - sqr(clearance);
|
||||
b := 2 * leftBottomY * leftBottomX;
|
||||
c := sqr(leftBottomX) - sqr(clearance);
|
||||
|
||||
discriminant := sqr(b) - 4 * a * c;
|
||||
|
||||
if discriminant >= 0 then
|
||||
begin
|
||||
t1 := (-b + sqrt(discriminant)) / (2 * a);
|
||||
t2 := (-b - sqrt(discriminant)) / (2 * a);
|
||||
|
||||
theta1 := ArcTan(t1) * 180 / Pi;
|
||||
theta2 := ArcTan(t2) * 180 / Pi;
|
||||
|
||||
// Возвращаем меньший угол
|
||||
if theta1 < theta2 then
|
||||
CalculateMaxMinAngle := theta1
|
||||
else
|
||||
CalculateMaxMinAngle := theta2;
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
minAngle: double;
|
||||
begin
|
||||
minAngle := CalculateMaxMinAngle(lengthConst, widthConst, angleDegreesConst, distanceConst);
|
||||
|
||||
if minAngle <> 0 then
|
||||
writeln('Меньший угол: ', minAngle:0:10)
|
||||
else
|
||||
writeln('Дискриминант отрицательный, нет вещественных решений.');
|
||||
|
||||
readln;
|
||||
end.
|
45
gcode/Generator/Old/backup/combinedcalculation3.lps
Normal file
45
gcode/Generator/Old/backup/combinedcalculation3.lps
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="12"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="50"/>
|
||||
<CursorPos X="67" Y="82"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory HistoryIndex="4">
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<Caret Line="12" Column="29"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<Caret Line="28" Column="68"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<Caret Line="67" Column="5" TopLine="28"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<Caret Line="32" Column="64"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<Caret Line="25" Column="76"/>
|
||||
</Position>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
BIN
gcode/Generator/Old/calculateangles.exe
Normal file
BIN
gcode/Generator/Old/calculateangles.exe
Normal file
Binary file not shown.
57
gcode/Generator/Old/calculateangles.lpi
Normal file
57
gcode/Generator/Old/calculateangles.lpi
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="My Application"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="calculateangles.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="calculateangles"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
43
gcode/Generator/Old/calculateangles.lpr
Normal file
43
gcode/Generator/Old/calculateangles.lpr
Normal file
|
@ -0,0 +1,43 @@
|
|||
program calculateangles;
|
||||
|
||||
uses SysUtils, Math; // Для работы с math
|
||||
|
||||
var
|
||||
x0, y0, d, a, b, c, discriminant, t1, t2, theta1, theta2: real;
|
||||
|
||||
begin
|
||||
// Исходные данные
|
||||
x0 := -40.03787;
|
||||
y0 := 7.82934;
|
||||
d := 0.825;
|
||||
|
||||
// Вычисление коэффициентов квадратного уравнения
|
||||
a := x0 * x0 - d * d;
|
||||
b := 2 * x0 * y0;
|
||||
c := y0 * y0 - d * d;
|
||||
|
||||
// Вычисление дискриминанта
|
||||
discriminant := b * b - 4 * a * c;
|
||||
|
||||
// Проверка наличия решений
|
||||
if discriminant >= 0 then
|
||||
begin
|
||||
// Вычисление корней квадратного уравнения
|
||||
t1 := (-b + sqrt(discriminant)) / (2 * a);
|
||||
t2 := (-b - sqrt(discriminant)) / (2 * a);
|
||||
|
||||
// Вычисление углов в градусах
|
||||
theta1 := ArcTan(t1) * 180 / Pi;
|
||||
theta2 := ArcTan(t2) * 180 / Pi;
|
||||
|
||||
// Вывод результатов
|
||||
writeln('Угол 1: ', theta1:0:10);
|
||||
writeln('Угол 2: ', theta2:0:10);
|
||||
end
|
||||
else
|
||||
begin
|
||||
writeln('Дискриминант отрицательный, нет вещественных решений.');
|
||||
end;
|
||||
|
||||
readln; // Чтобы консоль не закрылась сразу
|
||||
end.
|
24
gcode/Generator/Old/calculateangles.lps
Normal file
24
gcode/Generator/Old/calculateangles.lps
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="12"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="calculateangles.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="4"/>
|
||||
<CursorPos X="16" Y="11"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory HistoryIndex="-1"/>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
BIN
gcode/Generator/Old/calculaterectanglecorner.exe
Normal file
BIN
gcode/Generator/Old/calculaterectanglecorner.exe
Normal file
Binary file not shown.
58
gcode/Generator/Old/calculaterectanglecorner.lpi
Normal file
58
gcode/Generator/Old/calculaterectanglecorner.lpi
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="My Application"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="calculaterectanglecorner.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="CalculateRectangleCorner"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="calculaterectanglecorner"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
30
gcode/Generator/Old/calculaterectanglecorner.lpr
Normal file
30
gcode/Generator/Old/calculaterectanglecorner.lpr
Normal file
|
@ -0,0 +1,30 @@
|
|||
program CalculateRectangleCorner;
|
||||
|
||||
uses Math;
|
||||
|
||||
var
|
||||
length, width, angleDegrees, angleRadians, centerX, centerY, halfLength, halfWidth, leftBottomX, leftBottomY: real;
|
||||
|
||||
begin
|
||||
length := 30.7;
|
||||
width := 5.6;
|
||||
angleDegrees := 15;
|
||||
angleRadians := ((angleDegrees+90)) * Pi / 180;
|
||||
|
||||
centerX := 0;
|
||||
centerY := 0;
|
||||
|
||||
halfLength := length / 2;
|
||||
halfWidth := width / 2;
|
||||
|
||||
centerX := centerX - halfLength * Cos(angleRadians);
|
||||
centerY := centerY - halfLength * Sin(angleRadians);
|
||||
|
||||
leftBottomX := centerX - halfLength * Cos(angleRadians) - halfWidth * Sin(angleRadians);
|
||||
leftBottomY := centerY - halfLength * Sin(angleRadians) + halfWidth * Cos(angleRadians);
|
||||
//leftBottomY := centerY - halfWidth * Sin(angleRadians) - halfLength * Cos(angleRadians);
|
||||
|
||||
|
||||
writeln('Координаты левого нижнего угла: (', leftBottomX:0:6, ', ', leftBottomY:0:6, ')');
|
||||
readln;
|
||||
end.
|
33
gcode/Generator/Old/calculaterectanglecorner.lps
Normal file
33
gcode/Generator/Old/calculaterectanglecorner.lps
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="12"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="calculaterectanglecorner.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="CalculateRectangleCorner"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<CursorPos X="34" Y="12"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory HistoryIndex="1">
|
||||
<Position>
|
||||
<Filename Value="calculaterectanglecorner.lpr"/>
|
||||
<Caret Line="28" Column="5"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="calculaterectanglecorner.lpr"/>
|
||||
<Caret Line="13" Column="73"/>
|
||||
</Position>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
BIN
gcode/Generator/Old/combinedcalculation.exe
Normal file
BIN
gcode/Generator/Old/combinedcalculation.exe
Normal file
Binary file not shown.
58
gcode/Generator/Old/combinedcalculation.lpi
Normal file
58
gcode/Generator/Old/combinedcalculation.lpi
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="My Application"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="CombinedCalculation"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="combinedcalculation"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
56
gcode/Generator/Old/combinedcalculation.lpr
Normal file
56
gcode/Generator/Old/combinedcalculation.lpr
Normal file
|
@ -0,0 +1,56 @@
|
|||
program CombinedCalculation;
|
||||
|
||||
uses Math;
|
||||
|
||||
var
|
||||
length, width, angleDegrees, angleRadians, centerX, centerY, halfLength, halfWidth, leftBottomX, leftBottomY, distance, a, b, c, discriminant, t1, t2, theta1, theta2: real;
|
||||
|
||||
begin
|
||||
// Входные данные для второй задачи (прямоугольник)
|
||||
length := 30.7;
|
||||
width := 5.6;
|
||||
angleDegrees := -15;
|
||||
distance := 0.825;
|
||||
|
||||
angleRadians := (angleDegrees+90) * Pi / 180;
|
||||
//angleRadians := angleDegrees * Pi / 180;
|
||||
halfLength := length / 2;
|
||||
halfWidth := width / 2;
|
||||
|
||||
centerX := 0; //Инициализируем центр
|
||||
centerY := 0; //Инициализируем центр
|
||||
|
||||
// Вычисление координат центра прямоугольника
|
||||
centerX := centerX - halfLength * Cos(angleRadians);
|
||||
centerY := centerY - halfLength * Sin(angleRadians);
|
||||
|
||||
// Вычисление координат левого нижнего угла (вторая задача)
|
||||
leftBottomX := centerX - halfLength * Cos(angleRadians) - halfWidth * Sin(angleRadians);
|
||||
leftBottomY := centerY - halfLength * Sin(angleRadians) + halfWidth * Cos(angleRadians);
|
||||
|
||||
// Использование результатов второй задачи в первой задаче
|
||||
writeln('Координаты левого нижнего угла: (', leftBottomX:0:6, ', ', leftBottomY:0:6, ')');
|
||||
|
||||
// Первая задача (исправленные коэффициенты)
|
||||
a := leftBottomX * leftBottomX + leftBottomY * leftBottomY;
|
||||
b := 2 * leftBottomX * leftBottomY;
|
||||
c := leftBottomY * leftBottomY - distance * distance;
|
||||
discriminant := b * b - 4 * a * c;
|
||||
|
||||
if discriminant >= 0 then
|
||||
begin
|
||||
t1 := (-b + sqrt(discriminant)) / (2 * a);
|
||||
t2 := (-b - sqrt(discriminant)) / (2 * a);
|
||||
|
||||
theta1 := ArcTan(t1) * 180 / Pi;
|
||||
theta2 := ArcTan(t2) * 180 / Pi;
|
||||
|
||||
writeln('Угол 1: ', theta1:0:10);
|
||||
writeln('Угол 2: ', theta2:0:10);
|
||||
end
|
||||
else
|
||||
begin
|
||||
writeln('Дискриминант отрицательный, нет вещественных решений.');
|
||||
end;
|
||||
readln;
|
||||
end.
|
57
gcode/Generator/Old/combinedcalculation.lps
Normal file
57
gcode/Generator/Old/combinedcalculation.lps
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="12"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="CombinedCalculation"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<CursorPos X="36" Y="26"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory HistoryIndex="7">
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="33" Column="65" TopLine="12"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="50" Column="5" TopLine="11"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="35" Column="71" TopLine="11"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="25" Column="120"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="37" Column="86" TopLine="7"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="38" Column="66" TopLine="7"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="12" Column="20" TopLine="4"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation.lpr"/>
|
||||
<Caret Line="15" Column="33"/>
|
||||
</Position>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
BIN
gcode/Generator/Old/combinedcalculation2.exe
Normal file
BIN
gcode/Generator/Old/combinedcalculation2.exe
Normal file
Binary file not shown.
57
gcode/Generator/Old/combinedcalculation2.lpi
Normal file
57
gcode/Generator/Old/combinedcalculation2.lpi
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="My Application"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="combinedcalculation2.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="combinedcalculation2"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
123
gcode/Generator/Old/combinedcalculation2.lpr
Normal file
123
gcode/Generator/Old/combinedcalculation2.lpr
Normal file
|
@ -0,0 +1,123 @@
|
|||
program combinedcalculation2;
|
||||
|
||||
uses SysUtils, Math;
|
||||
|
||||
const
|
||||
LENGTH = 40.7;
|
||||
WIDTH = 5.6;
|
||||
ANGLE_DEGREES = 15;
|
||||
DISTANCE = 0.825;
|
||||
|
||||
var
|
||||
angleRadians, leftBottomX, leftBottomY: real;
|
||||
a, b, c, discriminant, t1, t2, theta1, theta2: real;
|
||||
|
||||
begin
|
||||
angleRadians := (ANGLE_DEGREES + 90) * Pi / 180;
|
||||
|
||||
leftBottomX := -LENGTH / 2 * Cos(angleRadians) - LENGTH / 2 * Cos(angleRadians) - WIDTH / 2 * Sin(angleRadians);
|
||||
leftBottomY := -LENGTH / 2 * Sin(angleRadians) - LENGTH / 2 * Sin(angleRadians) + WIDTH / 2 * Cos(angleRadians);
|
||||
|
||||
|
||||
writeln('Координаты левого нижнего угла: (', leftBottomX:0:6, ', ', leftBottomY:0:6, ')');
|
||||
|
||||
// Вычисление коэффициентов квадратного уравнения
|
||||
a := sqr(leftBottomY) - sqr(DISTANCE);
|
||||
b := 2 * leftBottomY * leftBottomX;
|
||||
c := sqr(leftBottomX) - sqr(DISTANCE);
|
||||
|
||||
// Вычисление дискриминанта
|
||||
discriminant := sqr(b) - 4 * a * c;
|
||||
|
||||
// Проверка наличия решений
|
||||
if discriminant >= 0 then
|
||||
begin
|
||||
// Вычисление корней квадратного уравнения
|
||||
t1 := (-b + sqrt(discriminant)) / (2 * a);
|
||||
t2 := (-b - sqrt(discriminant)) / (2 * a);
|
||||
|
||||
// Вычисление углов в градусах
|
||||
theta1 := ArcTan(t1) * 180 / Pi;
|
||||
theta2 := ArcTan(t2) * 180 / Pi;
|
||||
|
||||
// Вывод результатов
|
||||
writeln('Угол 1: ', theta1:0:10);
|
||||
writeln('Угол 2: ', theta2:0:10);
|
||||
end
|
||||
else
|
||||
begin
|
||||
writeln('Дискриминант отрицательный, нет вещественных решений.');
|
||||
end;
|
||||
|
||||
readln;
|
||||
end.
|
||||
|
||||
|
||||
(*
|
||||
program combinedcalculation2;
|
||||
|
||||
uses SysUtils, Math; // Для работы с math
|
||||
|
||||
var
|
||||
length, width, angleDegrees, angleRadians, centerX, centerY, halfLength, halfWidth, leftBottomX, leftBottomY: real;
|
||||
x0, y0, d, a, b, c, discriminant, t1, t2, theta1, theta2: real;
|
||||
|
||||
begin
|
||||
length := 40.7;
|
||||
width := 5.6;
|
||||
angleDegrees := 15;
|
||||
angleRadians := ((angleDegrees+90)) * Pi / 180;
|
||||
|
||||
centerX := 0;
|
||||
centerY := 0;
|
||||
|
||||
halfLength := length / 2;
|
||||
halfWidth := width / 2;
|
||||
|
||||
centerX := centerX - halfLength * Cos(angleRadians);
|
||||
centerY := centerY - halfLength * Sin(angleRadians);
|
||||
|
||||
leftBottomX := centerX - halfLength * Cos(angleRadians) - halfWidth * Sin(angleRadians);
|
||||
leftBottomY := centerY - halfLength * Sin(angleRadians) + halfWidth * Cos(angleRadians);
|
||||
//leftBottomY := centerY - halfWidth * Sin(angleRadians) - halfLength * Cos(angleRadians);
|
||||
|
||||
writeln('Координаты левого нижнего угла: (', leftBottomX:0:6, ', ', leftBottomY:0:6, ')');
|
||||
|
||||
// Исходные данные
|
||||
x0 := leftBottomY;
|
||||
y0 := leftBottomX;
|
||||
d := 0.825;
|
||||
|
||||
// Вычисление коэффициентов квадратного уравнения
|
||||
a := x0 * x0 - d * d;
|
||||
b := 2 * x0 * y0;
|
||||
c := y0 * y0 - d * d;
|
||||
|
||||
// Вычисление дискриминанта
|
||||
discriminant := b * b - 4 * a * c;
|
||||
|
||||
// Проверка наличия решений
|
||||
if discriminant >= 0 then
|
||||
begin
|
||||
// Вычисление корней квадратного уравнения
|
||||
t1 := (-b + sqrt(discriminant)) / (2 * a);
|
||||
t2 := (-b - sqrt(discriminant)) / (2 * a);
|
||||
|
||||
// Вычисление углов в градусах
|
||||
theta1 := ArcTan(t1) * 180 / Pi;
|
||||
theta2 := ArcTan(t2) * 180 / Pi;
|
||||
|
||||
// Вывод результатов
|
||||
writeln('Угол 1: ', theta1:0:10);
|
||||
writeln('Угол 2: ', theta2:0:10);
|
||||
end
|
||||
else
|
||||
begin
|
||||
writeln('Дискриминант отрицательный, нет вещественных решений.');
|
||||
end;
|
||||
|
||||
readln; // Чтобы консоль не закрылась сразу
|
||||
|
||||
|
||||
end.
|
||||
*)
|
29
gcode/Generator/Old/combinedcalculation2.lps
Normal file
29
gcode/Generator/Old/combinedcalculation2.lps
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="12"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="combinedcalculation2.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="14"/>
|
||||
<CursorPos X="5" Y="53"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation2.lpr"/>
|
||||
<Caret Line="33" Column="70"/>
|
||||
</Position>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
BIN
gcode/Generator/Old/combinedcalculation3.exe
Normal file
BIN
gcode/Generator/Old/combinedcalculation3.exe
Normal file
Binary file not shown.
62
gcode/Generator/Old/combinedcalculation3.lpi
Normal file
62
gcode/Generator/Old/combinedcalculation3.lpi
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="My Application"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="combinedcalculation3"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf3"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
98
gcode/Generator/Old/combinedcalculation3.lpr
Normal file
98
gcode/Generator/Old/combinedcalculation3.lpr
Normal file
|
@ -0,0 +1,98 @@
|
|||
program combinedcalculation3;
|
||||
|
||||
uses SysUtils, Math;
|
||||
|
||||
const
|
||||
lengthConst = 40.7;
|
||||
widthConst = 5.6;
|
||||
angleDegreesConst = 15;
|
||||
distanceConst = 0.825;
|
||||
|
||||
|
||||
function CalculateMaxMinAngle(rodLength, rodWidth, angle, clearance: double): double;
|
||||
var
|
||||
angleRadians, leftBottomX, leftBottomY: double;
|
||||
leftBottomX2, leftBottomY2: double;
|
||||
a, b, c, discriminant, t1, t2, theta1, theta2: double;
|
||||
a2, b2, c2, discriminant2, t12, t22, theta12, theta22: double;
|
||||
begin
|
||||
CalculateMaxMinAngle := 0; // Изначально нет решений
|
||||
|
||||
angleRadians := (angle + 90) * Pi / 180;
|
||||
|
||||
leftBottomX := -rodLength / 2 * Cos(angleRadians) - rodLength / 2 * Cos(angleRadians) - rodWidth / 2 * Sin(angleRadians);
|
||||
leftBottomY := -rodLength / 2 * Sin(angleRadians) - rodLength / 2 * Sin(angleRadians) + rodWidth / 2 * Cos(angleRadians);
|
||||
|
||||
writeln('Coordinates bottom-left corner: (', leftBottomX:0:6, ', ', leftBottomY:0:6, ')');
|
||||
|
||||
leftBottomY2 := -rodLength / 2 * Cos(0) - rodLength / 2 * Cos(0) - rodWidth / 2 * Sin(0);
|
||||
leftBottomX2 := -rodLength / 2 * Sin(0) - rodLength / 2 * Sin(0) + rodWidth / 2 * Cos(0);
|
||||
|
||||
writeln('Coordinates second bottom-left corner: (', leftBottomX2:0:6, ', ', leftBottomY2:0:6, ')');
|
||||
|
||||
|
||||
a := sqr(leftBottomY) - sqr(clearance);
|
||||
b := 2 * leftBottomY * leftBottomX;
|
||||
c := sqr(leftBottomX) - sqr(clearance);
|
||||
|
||||
discriminant := sqr(b) - 4 * a * c;
|
||||
|
||||
if discriminant >= 0 then
|
||||
begin
|
||||
t1 := (-b + sqrt(discriminant)) / (2 * a);
|
||||
t2 := (-b - sqrt(discriminant)) / (2 * a);
|
||||
|
||||
theta1 := ArcTan(t1) * 180 / Pi;
|
||||
theta2 := ArcTan(t2) * 180 / Pi;
|
||||
|
||||
(* // Возвращаем меньший угол
|
||||
if theta1 < theta2 then
|
||||
CalculateMaxMinAngle := theta1
|
||||
else
|
||||
CalculateMaxMinAngle := theta2;*)
|
||||
|
||||
writeln('theta1: ', theta1:0:6);
|
||||
writeln('theta2: ', theta2:0:6);
|
||||
writeln();
|
||||
|
||||
if theta2 < theta1 then theta1 := theta2;
|
||||
|
||||
a2 := sqr(leftBottomY2) - sqr(clearance);
|
||||
b2 := 2 * leftBottomY2 * leftBottomX2;
|
||||
c2 := sqr(leftBottomX2) - sqr(clearance);
|
||||
|
||||
discriminant2 := sqr(b2) - 4 * a2 * c2;
|
||||
|
||||
if discriminant2 >= 0 then
|
||||
begin
|
||||
t12 := (-b2 + sqrt(discriminant2)) / (2 * a2);
|
||||
t22 := (-b2 - sqrt(discriminant2)) / (2 * a2);
|
||||
|
||||
theta12 := ArcTan(t12) * 180 / Pi;
|
||||
theta22 := ArcTan(t22) * 180 / Pi;
|
||||
|
||||
writeln('theta12: ', theta12:0:6);
|
||||
writeln('theta22: ', theta22:0:6);
|
||||
writeln();
|
||||
|
||||
|
||||
if theta22 > theta12 then theta12 := theta22;
|
||||
|
||||
CalculateMaxMinAngle:= (theta12 + theta22)/2;
|
||||
writeln('CalculateMaxMinAngle: ', CalculateMaxMinAngle:0:6);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
minAngle: double;
|
||||
begin
|
||||
minAngle := CalculateMaxMinAngle(lengthConst, widthConst, angleDegreesConst, distanceConst);
|
||||
|
||||
if minAngle <> 0 then
|
||||
writeln('Меньший угол: ', minAngle:0:10)
|
||||
else
|
||||
writeln('Дискриминант отрицательный, нет вещественных решений.');
|
||||
|
||||
readln;
|
||||
end.
|
49
gcode/Generator/Old/combinedcalculation3.lps
Normal file
49
gcode/Generator/Old/combinedcalculation3.lps
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="12"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="59"/>
|
||||
<CursorPos Y="98"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory HistoryIndex="5">
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<Caret Line="12" Column="29"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<Caret Line="28" Column="68"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<Caret Line="67" Column="5" TopLine="28"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<Caret Line="32" Column="64"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<Caret Line="25" Column="76"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="combinedcalculation3.lpr"/>
|
||||
<Caret Line="82" Column="67" TopLine="50"/>
|
||||
</Position>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<Compiler Value="C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.exe" Date="1497193866"/>
|
||||
<Params Value=" -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -FiD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\lib\x86_64-win64 -FuD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\ -FUD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\lib\x86_64-win64\ -FED:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\ -oD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\calculateangles.exe calculateangles.lpr"/>
|
||||
</CONFIG>
|
BIN
gcode/Generator/Old/lib/x86_64-win64/calculateangles.o
Normal file
BIN
gcode/Generator/Old/lib/x86_64-win64/calculateangles.o
Normal file
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<Compiler Value="C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.exe" Date="1497193866"/>
|
||||
<Params Value=" -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -FiD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\lib\x86_64-win64 -FuD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\ -FUD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\lib\x86_64-win64\ -FED:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\ -oD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\calculaterectanglecorner.exe calculaterectanglecorner.lpr"/>
|
||||
</CONFIG>
|
BIN
gcode/Generator/Old/lib/x86_64-win64/calculaterectanglecorner.o
Normal file
BIN
gcode/Generator/Old/lib/x86_64-win64/calculaterectanglecorner.o
Normal file
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<Compiler Value="C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.exe" Date="1497193866"/>
|
||||
<Params Value=" -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -FiD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\lib\x86_64-win64 -FuD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\ -FUD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\lib\x86_64-win64\ -FED:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\ -oD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\combinedcalculation.exe combinedcalculation.lpr"/>
|
||||
</CONFIG>
|
BIN
gcode/Generator/Old/lib/x86_64-win64/combinedcalculation.o
Normal file
BIN
gcode/Generator/Old/lib/x86_64-win64/combinedcalculation.o
Normal file
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<Compiler Value="C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.exe" Date="1497193866"/>
|
||||
<Params Value=" -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -FiD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\lib\x86_64-win64 -FuD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\ -FUD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\lib\x86_64-win64\ -FED:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\ -oD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\combinedcalculation2.exe combinedcalculation2.lpr"/>
|
||||
</CONFIG>
|
BIN
gcode/Generator/Old/lib/x86_64-win64/combinedcalculation2.o
Normal file
BIN
gcode/Generator/Old/lib/x86_64-win64/combinedcalculation2.o
Normal file
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<Compiler Value="C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.exe" Date="1497193866"/>
|
||||
<Params Value=" -MObjFPC -Scghi -O1 -gw3 -gl -l -vewnhibq -FiD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\lib\x86_64-win64 -FuD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\ -FUD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\lib\x86_64-win64\ -FED:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\ -oD:\Documents\GitHub\motor-wire-winder\gcode\Generator\Old\combinedcalculation3.exe combinedcalculation3.lpr"/>
|
||||
</CONFIG>
|
BIN
gcode/Generator/Old/lib/x86_64-win64/combinedcalculation3.o
Normal file
BIN
gcode/Generator/Old/lib/x86_64-win64/combinedcalculation3.o
Normal file
Binary file not shown.
|
@ -9,18 +9,14 @@
|
|||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="385"/>
|
||||
<CursorPos X="48" Y="407"/>
|
||||
<FoldState Value=" TC6B2 T3iD2{i5 piZm02K T0p04Ue"/>
|
||||
<TopLine Value="402"/>
|
||||
<CursorPos Y="418"/>
|
||||
<FoldState Value=" TC6B2 T3iD2{i411 Pj4m021"/>
|
||||
<UsageCount Value="220"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory HistoryIndex="23">
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="261" Column="19" TopLine="62"/>
|
||||
</Position>
|
||||
<JumpHistory HistoryIndex="29">
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="327" Column="6" TopLine="300"/>
|
||||
|
@ -113,6 +109,34 @@
|
|||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="409" Column="49" TopLine="379"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="333" Column="31" TopLine="328"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="408" Column="11" TopLine="381"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="389" Column="70" TopLine="381"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="430" Column="64" TopLine="391"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="409" Column="33" TopLine="389"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="342" Column="20" TopLine="322"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="408" Column="42" TopLine="386"/>
|
||||
</Position>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
|
|
@ -348,7 +348,7 @@ begin
|
|||
for i := 0 to 360 do
|
||||
begin
|
||||
coords := CircleCoordinates(CoilRadius*2, i+180);
|
||||
writeln(OutFile,'CoilRadius*2= ',CoilRadius*2:0:5,' X=', coords.X:0:3, ' Y=', coords.Y:0:5);
|
||||
// writeln(OutFile,'CoilRadius*2= ',CoilRadius*2:0:5,' X=', coords.X:0:3, ' Y=', coords.Y:0:5);
|
||||
angle := CalculateAngle(coords.Y, CurrentZ);
|
||||
|
||||
// writeln(OutFile, ';G1 X', coords.X:0:3, ' Y', angle:0:5,' Z', CurrentZ:0:5);
|
||||
|
@ -375,49 +375,68 @@ begin
|
|||
end
|
||||
else if (StatorParams.RayShape = 'rect') then
|
||||
begin
|
||||
writeln(OutFile, ';Rect? ');
|
||||
while (LayerNumber < MaxLayers) do
|
||||
begin
|
||||
writeln(OutFile, ';Layer ', LayerNumber);
|
||||
//Ñ÷èòàåì äëèíó êàòóøêè è êîëè÷åñòâî âèòêîâ
|
||||
RequiredSpacing:=StatorParams.PathClearance*2+(LayerNumber-1)*StatorParams.WireDiameter*2+StatorParams.NeedleDiameter;
|
||||
|
||||
writeln(OutFile, ';RayWidth ', StatorParams.RayWidth:0:5);
|
||||
writeln(OutFile, ';RequiredSpacing ', RequiredSpacing:0:5);
|
||||
writeln(OutFile, ';AngleBetweenRays ', AngleBetweenRays:0:5);
|
||||
|
||||
MaxDepth:=DepthCheck(StatorParams.RayWidth, RequiredSpacing, AngleBetweenRays);
|
||||
writeln(OutFile, ';MaxDepth ', MaxDepth:0:5);
|
||||
writeln(OutFile);
|
||||
If (MaxDepth < (StatorParams.BaseRadius)) then CoilLength:=StatorParams.RayLength else if (MaxDepth > (StatorParams.RayLength+StatorParams.BaseRadius)) then break else
|
||||
CoilLength:=StatorParams.RayLength+StatorParams.BaseRadius-MaxDepth;
|
||||
writeln(OutFile, ';CoilLength ', CoilLength:0:5);
|
||||
CurrentCoilTurns := ceil(CoilLength/StatorParams.WireDiameter);
|
||||
// CurrentCoilTurns := ceil(CoilLength/StatorParams.WireDiameter);
|
||||
CurrentCoilTurns := round(CoilLength/StatorParams.WireDiameter);
|
||||
writeln(OutFile, ';CurrentCoilTurns ', CurrentCoilTurns);
|
||||
// CurrentCoilTurns := round(CoilLength/StatorParams.WireDiameter);
|
||||
|
||||
CoilTurnsSum := CoilTurnsSum+CurrentCoilTurns;
|
||||
writeln(OutFile, ';CoilTurnsSum ', CoilTurnsSum);
|
||||
writeln(OutFile);
|
||||
writeln(OutFile, ';We make ',CurrentCoilTurns, ' turns on ', LayerNumber, ' layer.' );
|
||||
|
||||
writeln(OutFile,';CoilWidth = ',CoilWidth:0:5);
|
||||
|
||||
|
||||
for j := 0 to CurrentCoilTurns do
|
||||
begin
|
||||
|
||||
writeln(OutFile,';CoilWidth = ',CoilWidth:0:5);
|
||||
angle := CalculateAngle(CoilWidth/2, CurrentZ);
|
||||
writeln(OutFile,';Coil¹ = ',j);
|
||||
writeln(OutFile,'M117 ',j);
|
||||
//angle := CalculateAngle(CoilWidth/2, CurrentZ);
|
||||
angle := AngleBetweenRays/2;
|
||||
//Divide the path into 100 points
|
||||
(* for k := 1 to 100 do
|
||||
begin
|
||||
end; *)
|
||||
|
||||
writeln(OutFile, 'G1 X', -1*CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Top Left Corner
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
writeln(OutFile, 'M0');
|
||||
//writeln(OutFile, 'M0');
|
||||
|
||||
// angle := CalculateAngle(CoilWidth/2, CurrentZ);
|
||||
writeln(OutFile, 'G1 X', CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Top Right Corner
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
writeln(OutFile, 'M0');
|
||||
//writeln(OutFile, 'M0');
|
||||
|
||||
angle := CalculateAngle(-1*CoilWidth/2, CurrentZ);
|
||||
writeln(OutFile, 'G1 X', CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Bottom Right Corner
|
||||
// angle := CalculateAngle(-1*CoilWidth/2, CurrentZ);
|
||||
writeln(OutFile, 'G1 X', CoilHeight/2:0:3, ' Y', -angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Bottom Right Corner
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
writeln(OutFile, 'M0');
|
||||
//writeln(OutFile, 'M0');
|
||||
|
||||
// angle := CalculateAngle(CoilWidth/2, CurrentZ);
|
||||
writeln(OutFile, 'G1 X', -1*CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Bottom Left Corner
|
||||
writeln(OutFile, 'G1 X', -1*CoilHeight/2:0:3, ' Y', -angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Bottom Left Corner
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
writeln(OutFile, 'M0');
|
||||
//writeln(OutFile, 'M0');
|
||||
end;
|
||||
|
||||
|
||||
writeln(OutFile, 'M0');
|
||||
// writeln(OutFile, 'G91');
|
||||
// writeln(OutFile, 'G1 Y50');
|
||||
// writeln(OutFile, 'G90');
|
||||
|
|
62
gcode/Generator/backup/gcodegenerator_v3.lpi
Normal file
62
gcode/Generator/backup/gcodegenerator_v3.lpi
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="gcodegenerator_v3"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="gcodegenerator_v3.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="gcodegenerator_v3"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf3"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
44
gcode/Generator/backup/gcodegenerator_v3.lps
Normal file
44
gcode/Generator/backup/gcodegenerator_v3.lps
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="12"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="gcodegenerator_v3.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="442"/>
|
||||
<CursorPos X="141" Y="459"/>
|
||||
<FoldState Value=" TC6B2 T3iD2{i5 piZm02K T0p34U^"/>
|
||||
<UsageCount Value="220"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v3.pas"/>
|
||||
<Caret Line="417" Column="42" TopLine="393"/>
|
||||
</Position>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes ActiveMode="default">
|
||||
<Mode Name="default">
|
||||
<local>
|
||||
<CommandLineParams Value="input.txt output.gcode"/>
|
||||
</local>
|
||||
</Mode>
|
||||
</Modes>
|
||||
</RunParams>
|
||||
<HistoryLists>
|
||||
<List Name="LaunchingApplication" Type="File" Count="1">
|
||||
<Item1 Value="C:\Windows\system32\cmd.exe /C ${TargetCmdLine}"/>
|
||||
</List>
|
||||
<List Name="CommandLineParameters" Count="1">
|
||||
<Item1 Value="input.txt output.gcode"/>
|
||||
</List>
|
||||
</HistoryLists>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
522
gcode/Generator/backup/gcodegenerator_v3.pas
Normal file
522
gcode/Generator/backup/gcodegenerator_v3.pas
Normal file
|
@ -0,0 +1,522 @@
|
|||
program gcodegenerator_v3;
|
||||
|
||||
uses
|
||||
SysUtils, StrUtils, Math;
|
||||
|
||||
type
|
||||
TPoint = record
|
||||
X, Y: double;
|
||||
end;
|
||||
|
||||
type
|
||||
TStatorParams = record
|
||||
BaseDiameter: Double;
|
||||
BaseRadius: Double;
|
||||
NumberOfRays: Integer;
|
||||
RayShape: string;
|
||||
RayDiameter: Double;
|
||||
RayWidth: Double;
|
||||
RayHeight: Double;
|
||||
RayLength: Double;
|
||||
|
||||
RayTopShape: string;
|
||||
RayTopDiameter: Double;
|
||||
RayTopWidth: Double;
|
||||
RayTopHeight: Double;
|
||||
|
||||
RayCenterOffset: Double;
|
||||
WireDiameter: Double;
|
||||
NeedleDiameter: Double;
|
||||
PathClearance: Double;
|
||||
|
||||
WorkSpeed :integer;
|
||||
end;
|
||||
|
||||
var
|
||||
InputFileName, OutputFileName: string;
|
||||
StatorParams: TStatorParams;
|
||||
InFile, OutFile: TextFile;
|
||||
Line: string;
|
||||
CoilRadius,CoilWidth,CoilHeight :double;
|
||||
CurrentZ: double;
|
||||
coords: TPoint;
|
||||
normalizecoords: TPoint;
|
||||
i, j, k: Integer;
|
||||
CoilLength :double;
|
||||
CurrentCoilTurns, CoilTurnsSum :Integer;
|
||||
AngleBetweenRays :double;
|
||||
RequiredSpacing: Double;
|
||||
LayerNumber :Integer;
|
||||
MaxLayers :Integer;
|
||||
angle :double;
|
||||
MaxDepth,MaxPath :double;
|
||||
MoveForward:boolean;
|
||||
|
||||
|
||||
|
||||
function ParseLine(Line: string): Boolean;
|
||||
var
|
||||
Parts: array of string;
|
||||
Value: string;
|
||||
TrimmedLine: string;
|
||||
begin
|
||||
TrimmedLine := Trim(Line); // Óäàëÿåì ïðîáåëû â íà÷àëå è êîíöå ñòðîêè
|
||||
if Length(TrimmedLine) = 0 then
|
||||
begin
|
||||
exit(true); // Ïóñòàÿ ñòðîêà - ïðîïóñêàåì
|
||||
end
|
||||
else if TrimmedLine[1] in [';','#'] then
|
||||
begin
|
||||
exit(true); // Ñòðîêà êîììåíòàðèÿ - ïðîïóñêàåì
|
||||
end;
|
||||
|
||||
Parts := SplitString(TrimmedLine, '='); // Èñïîëüçóåì TrimmedLine
|
||||
Result := Length(Parts) = 2;
|
||||
if Result then
|
||||
begin
|
||||
Value := LowerCase(Trim(Parts[1])); // Ïðèâîäèì ê íèæíåìó ðåãèñòðó
|
||||
case Trim(Parts[0]) of
|
||||
'base_dia': begin
|
||||
StatorParams.BaseDiameter := StrToFloat(Value);
|
||||
writeln('Base Diameter: ', StatorParams.BaseDiameter:8:2);
|
||||
writeln();
|
||||
StatorParams.BaseRadius := StatorParams.BaseDiameter/2;
|
||||
writeln('Base Radius: ', StatorParams.BaseRadius:8:2);
|
||||
writeln();
|
||||
|
||||
end;
|
||||
'num_rays': begin
|
||||
StatorParams.NumberOfRays := StrToInt(Value);
|
||||
writeln('Number of Rays: ', StatorParams.NumberOfRays);
|
||||
AngleBetweenRays := 360/StatorParams.NumberOfRays;
|
||||
writeln('Angle Between Rays: ', AngleBetweenRays);
|
||||
writeln();
|
||||
end;
|
||||
'ray_shape': begin
|
||||
if Pos(Value, 'circle, rect, superellipse') = 0 then
|
||||
raise Exception.Create('Invalid value for ray_shape: ' + Value);
|
||||
StatorParams.RayShape := Value;
|
||||
writeln('Ray Shape: ', StatorParams.RayShape);
|
||||
writeln();
|
||||
end;
|
||||
'ray_dia': begin
|
||||
StatorParams.RayDiameter := StrToFloat(Value);
|
||||
writeln('Ray Diameter: ', StatorParams.RayDiameter:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'ray_w': begin
|
||||
StatorParams.RayWidth := StrToFloat(Value);
|
||||
writeln('Ray Width: ', StatorParams.RayWidth:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'ray_h': begin
|
||||
StatorParams.RayHeight := StrToFloat(Value);
|
||||
writeln('Ray Height: ', StatorParams.RayHeight:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'ray_len': begin
|
||||
StatorParams.RayLength := StrToFloat(Value);
|
||||
writeln('Ray Length: ', StatorParams.RayLength:8:2);
|
||||
writeln();
|
||||
end;
|
||||
|
||||
'raytop_shape': begin
|
||||
if Pos(Value, 'circle, rect, superellipse') = 0 then
|
||||
raise Exception.Create('Invalid value for ray_top: ' + Value);
|
||||
StatorParams.RayTopShape := Value;
|
||||
writeln('Ray Top Shape: ', StatorParams.RayTopShape);
|
||||
end;
|
||||
|
||||
'raytop_dia': begin
|
||||
StatorParams.RayTopDiameter := StrToFloat(Value);
|
||||
writeln('Ray Top Diameter: ', StatorParams.RayTopDiameter:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'raytop_w': begin
|
||||
StatorParams.RayTopWidth := StrToFloat(Value);
|
||||
writeln('Ray Top Width: ', StatorParams.RayTopWidth:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'raytop_h': begin
|
||||
StatorParams.RayTopHeight := StrToFloat(Value);
|
||||
writeln('Ray Top Height: ', StatorParams.RayTopHeight:8:2);
|
||||
writeln();
|
||||
end;
|
||||
|
||||
'ray_offset': begin
|
||||
StatorParams.RayCenterOffset := StrToFloat(Value);
|
||||
writeln('Ray Center Offset: ', StatorParams.RayCenterOffset:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'wire_diameter': begin
|
||||
StatorParams.WireDiameter := StrToFloat(Value);
|
||||
writeln('Wire Diameter: ', StatorParams.WireDiameter:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'needle_diameter': begin
|
||||
StatorParams.NeedleDiameter := StrToFloat(Value);
|
||||
writeln('Needle Diameter: ', StatorParams.NeedleDiameter:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'path_clearance': begin
|
||||
StatorParams.PathClearance := StrToFloat(Value);
|
||||
writeln('Path Clearance: ', StatorParams.PathClearance:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'work_speed': begin
|
||||
StatorParams.WorkSpeed := StrToInt(Value);
|
||||
writeln('Work Speed: ', StatorParams.WorkSpeed);
|
||||
writeln();
|
||||
end;
|
||||
|
||||
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
if not Result then
|
||||
begin
|
||||
writeln('Error: Unknown parameter: ', Parts[0]);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ReadInputFile();
|
||||
Begin
|
||||
// **Opening the input file**
|
||||
AssignFile(InFile, InputFileName);
|
||||
try
|
||||
Reset(InFile); // **This line opens the file for reading**
|
||||
while not EOF(InFile) do
|
||||
begin
|
||||
ReadLn(InFile, Line);
|
||||
if Length(Line) > 0 then
|
||||
if not ParseLine(Line) then
|
||||
writeln('Error: Invalid line: ', Line);
|
||||
end;
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
writeln('Error opening or reading input file: ', E.Message);
|
||||
Halt(1);
|
||||
end;
|
||||
end;
|
||||
CloseFile(InFile);
|
||||
end;
|
||||
|
||||
function CircleCoordinates(diameter, angleDegrees: Double): TPoint;
|
||||
var
|
||||
radius: Double;
|
||||
angleRadians: Double;
|
||||
begin
|
||||
radius := diameter / 2;
|
||||
// angleRadians := -1*angleDegrees * PI / 180; // Ïåðåâîä ãðàäóñîâ â ðàäèàíû
|
||||
angleRadians := -1 * DegToRad(angleDegrees);
|
||||
|
||||
Result.X := radius * Cos(angleRadians);
|
||||
Result.Y := radius * Sin(angleRadians);
|
||||
end;
|
||||
|
||||
function CalculateAngle(opposite, adjacent: Double): Double;
|
||||
begin
|
||||
if adjacent = 0 then
|
||||
raise Exception.Create('Adjacent side cannot be zero');
|
||||
// CalculateAngle := ArcTan(opposite / adjacent) * 180 / PI;
|
||||
CalculateAngle := RadToDeg(ArcTan(opposite / adjacent));
|
||||
end;
|
||||
|
||||
function NormalizeZ(radius: Real; thetaDeg: Real): Real;
|
||||
var
|
||||
thetaRad, alphaRad, xKas, yKas, mTang, bTang: Real;
|
||||
begin
|
||||
// 1. Ïðåîáðàçîâàíèå óãëà èç ãðàäóñîâ â ðàäèàíû.
|
||||
thetaRad := DegToRad(thetaDeg);
|
||||
|
||||
// 2. Âû÷èñëåíèå êîîðäèíàò òî÷êè êàñàíèÿ íà îêðóæíîñòè (îòíîñèòåëüíî öåíòðà 0,0).
|
||||
xKas := radius * Cos(thetaRad);
|
||||
yKas := radius * Sin(thetaRad);
|
||||
|
||||
// 3. Âû÷èñëåíèå óãëà, ïåðïåíäèêóëÿðíîãî ðàäèóñ-âåêòîðó (êàñàòåëüíîé).
|
||||
alphaRad := thetaRad + PI / 2;
|
||||
|
||||
// 4. Âû÷èñëåíèå óãëîâîãî êîýôôèöèåíòà êàñàòåëüíîé.
|
||||
mTang := Tan(alphaRad);
|
||||
|
||||
// 5. Âû÷èñëåíèå ñâîáîäíîãî ÷ëåíà óðàâíåíèÿ êàñàòåëüíîé (y = mTang * x + bTang).
|
||||
bTang := yKas - mTang * xKas;
|
||||
|
||||
// 6. Âû÷èñëåíèå êîîðäèíàòû X òî÷êè ïåðåñå÷åíèÿ êàñàòåëüíîé ñ îñüþ X (y = 0).
|
||||
// 0 = mTang * x + bTang
|
||||
// x = -bTang / mTang
|
||||
if mTang = 0 then
|
||||
begin
|
||||
// Êàñàòåëüíàÿ ïàðàëëåëüíà îñè X - íåò òî÷êè ïåðåñå÷åíèÿ. Âîçâðàùàåì NaN.
|
||||
NormalizeZ := NaN;
|
||||
end
|
||||
else
|
||||
begin
|
||||
NormalizeZ := -bTang / mTang;
|
||||
end;
|
||||
end;
|
||||
|
||||
function DepthCheck(thickness, lineLength, angleDeg: double): double;
|
||||
var
|
||||
xIntersection, distanceToIntersection, radius: double;
|
||||
begin
|
||||
xIntersection := (thickness/2 + thickness/2 * cos(DegToRad(angleDeg)))/sin(DegToRad(angleDeg));
|
||||
distanceToIntersection := sqrt(sqr(xIntersection) + sqr(1.2));
|
||||
radius := lineLength / (2 * tan(DegToRad(angleDeg) / 2));
|
||||
DepthCheck := distanceToIntersection + radius;
|
||||
end;
|
||||
|
||||
function CalculateMaxPath(length, width, angleDegrees: double): double;
|
||||
var
|
||||
topLeftX, topLeftY, rotatedX, rotatedY, angleRadians, distance: double;
|
||||
begin
|
||||
// Âû÷èñëÿåì êîîðäèíàòû âåðõíåãî ëåâîãî óãëà ïðÿìîóãîëüíèêà
|
||||
topLeftX := -length;
|
||||
topLeftY := width / 2;
|
||||
|
||||
// Ïðåîáðàçóåì óãîë â ðàäèàíû (ñ ó÷åòîì âðàùåíèÿ ïî ÷àñîâîé ñòðåëêå)
|
||||
angleRadians := degToRad(-angleDegrees);
|
||||
|
||||
// Âû÷èñëÿåì êîîðäèíàòû ïîâåðíóòîãî íèæíåãî ëåâîãî óãëà âòîðîãî ïðÿìîóãîëüíèêà
|
||||
rotatedX := -length * cos(angleRadians) - (-width / 2) * sin(angleRadians);
|
||||
rotatedY := -length * sin(angleRadians) + (-width / 2) * cos(angleRadians);
|
||||
|
||||
// Âû÷èñëÿåì ðàññòîÿíèå ìåæäó òî÷êàìè
|
||||
distance := sqrt(sqr(rotatedX - topLeftX) + sqr(rotatedY - topLeftY));
|
||||
|
||||
// Âîçâðàùàåì ðåçóëüòàò
|
||||
MaxPath := distance;
|
||||
end;
|
||||
|
||||
begin
|
||||
// Command line argument handling
|
||||
if ParamCount < 2 then
|
||||
begin
|
||||
Writeln('Usage: GCodeGenerator <input_file.txt> <output_file.gcode>');
|
||||
Halt(1);
|
||||
end;
|
||||
InputFileName := ParamStr(1);
|
||||
OutputFileName := ParamStr(2);
|
||||
|
||||
ReadInputFile();
|
||||
|
||||
// G-code generation
|
||||
AssignFile(OutFile, OutputFileName);
|
||||
try
|
||||
Rewrite(OutFile);
|
||||
// *** Your G-code generation logic here ***
|
||||
writeln(OutFile, '; G-code for stator winding');
|
||||
writeln(OutFile, 'G90 ; Absolute coordinate system');
|
||||
writeln(OutFile, 'G1 Y-10');
|
||||
writeln(OutFile, 'G28 X Y Z');
|
||||
writeln(OutFile, 'G1 X0 Y0');
|
||||
//writeln(OutFile, 'G28 O'); //Home all "untrusted" axes
|
||||
writeln(OutFile);
|
||||
// Move to center of ray along Y axis and reset coordinate
|
||||
writeln(OutFile, 'G1 X', StatorParams.RayCenterOffset:0:2);
|
||||
writeln(OutFile, 'G92 X0');
|
||||
|
||||
//îòâîäèì èãëó ëåâåå è íèæå âåðøèíû ëó÷à
|
||||
CoilRadius:=(StatorParams.RayTopHeight/2+StatorParams.NeedleDiameter/2+StatorParams.PathClearance);
|
||||
CoilWidth:=(StatorParams.RayTopWidth+StatorParams.NeedleDiameter+StatorParams.PathClearance*2);
|
||||
CoilHeight:=(StatorParams.RayTopHeight+StatorParams.NeedleDiameter+StatorParams.PathClearance*2);
|
||||
writeln(OutFile, ';CoilRadius = ', CoilRadius:0:3);
|
||||
writeln(OutFile, ';CoilWidth = ', CoilWidth:0:3);
|
||||
writeln(OutFile, ';CoilHeight = ', CoilHeight:0:3);
|
||||
writeln(OutFile, 'G1 X', -1*CoilHeight/2:0:3, ' Y',-1*AngleBetweenRays/2:0:3);
|
||||
|
||||
//ïðèáëèæàåìñÿ ê îñíîâàíèþ ñòàòîðà.
|
||||
CurrentZ:=(StatorParams.BaseDiameter/2)+StatorParams.PathClearance;
|
||||
writeln(OutFile, 'G1 Z', CurrentZ:0:2, ' F', StatorParams.WorkSpeed);
|
||||
//Âñòà¸ì íà ïàóçó äëÿ òîãî, ÷òîáû ïðèâÿçàòü êîíåö ïðîâîëîêè
|
||||
writeln(OutFile, 'M0');
|
||||
|
||||
writeln(OutFile, ';Start coil');
|
||||
//Íà÷èíàåì ìîòàòü êàòóøêó.
|
||||
//Ñ÷èòàåì, ñêîëüêî ñëî¸â ìîæåì íàìîòàòü.
|
||||
MaxPath:=CalculateMaxPath((StatorParams.RayLength+StatorParams.BaseRadius), StatorParams.RayWidth, AngleBetweenRays);
|
||||
// MaxLayers :=trunc(((MaxPath-RequiredSpacing)/2/StatorParams.WireDiameter));
|
||||
MaxLayers :=round(((MaxPath-RequiredSpacing)/2/StatorParams.WireDiameter));
|
||||
writeln(OutFile, ';MaxLayers ', MaxLayers);
|
||||
Inc(LayerNumber);
|
||||
//Äâèãàåìñÿ îò öåíòðà ê êðàþ
|
||||
MoveForward:=true;
|
||||
if (StatorParams.RayShape = 'circle') then
|
||||
begin
|
||||
for j := 0 to CurrentCoilTurns do
|
||||
begin
|
||||
for i := 0 to 360 do
|
||||
begin
|
||||
coords := CircleCoordinates(CoilRadius*2, i+180);
|
||||
// writeln(OutFile,'CoilRadius*2= ',CoilRadius*2:0:5,' X=', coords.X:0:3, ' Y=', coords.Y:0:5);
|
||||
angle := CalculateAngle(coords.Y, CurrentZ);
|
||||
|
||||
// writeln(OutFile, ';G1 X', coords.X:0:3, ' Y', angle:0:5,' Z', CurrentZ:0:5);
|
||||
writeln(OutFile, 'G1 X', coords.X:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5);
|
||||
// writeln(OutFile);
|
||||
|
||||
CurrentZ:=CurrentZ+StatorParams.WireDiameter/360;
|
||||
end;
|
||||
writeln(OutFile, ';Next coil.');
|
||||
end;
|
||||
writeln(OutFile, ';Second coil');
|
||||
Inc(LayerNumber);
|
||||
// RequiredSpacing:=StatorParams.RayWidth+StatorParams.NeedleDiameter+StatorParams.PathClearance*2+LayerNumber*StatorParams.WireDiameter*2;
|
||||
// writeln(OutFile, ';RequiredSpacing = ',RequiredSpacing:0:5);
|
||||
RequiredSpacing:=StatorParams.RayTopWidth;
|
||||
writeln(OutFile, ';RequiredSpacing = ',RequiredSpacing:0:5);
|
||||
RequiredSpacing:=RequiredSpacing+StatorParams.NeedleDiameter;
|
||||
writeln(OutFile, ';RequiredSpacing = ',RequiredSpacing:0:5);
|
||||
RequiredSpacing:=RequiredSpacing+StatorParams.PathClearance*2+LayerNumber*StatorParams.WireDiameter*2;
|
||||
writeln(OutFile, ';RequiredSpacing = ',RequiredSpacing:0:5);
|
||||
|
||||
CurrentZ:=RequiredSpacing/(2 * tan(AngleBetweenRays*PI/180/2));
|
||||
writeln(OutFile, ';CurrentZ = ',CurrentZ:0:3);
|
||||
end
|
||||
else if (StatorParams.RayShape = 'rect') then
|
||||
begin
|
||||
// writeln(OutFile, ';Rect? ');
|
||||
while (LayerNumber <= MaxLayers) do
|
||||
begin
|
||||
//writeln(OutFile, ';Layer ', LayerNumber);
|
||||
//Ñ÷èòàåì äëèíó êàòóøêè è êîëè÷åñòâî âèòêîâ
|
||||
//Äëÿ ýòîãî ñ÷èòàåì íåîáõîäèìîå ðàññòîÿíèå ìåæäó ëó÷àìè. 2 äèàìåòðà ïðîâîäà + äèàìåòð èãëû + 2 çàçîðà áåçîïàñíîñòè
|
||||
RequiredSpacing:=StatorParams.PathClearance*2+(LayerNumber-1)*StatorParams.WireDiameter*2+StatorParams.NeedleDiameter;
|
||||
//Èñïîëüçóÿ íåîáõîäèìîå ðàññòîÿíèå, ðàññ÷èòûâàåì íà êàêóþ, ìàêñèìàëüíóþ ãëóáèíó ìîæåò ïîãðóçèòüñÿ èãîëêà. (ðàññòîÿíèå îò öåíòðà ñòàòîðà)
|
||||
MaxDepth:=DepthCheck(StatorParams.RayWidth, RequiredSpacing, AngleBetweenRays);
|
||||
writeln(OutFile, ';RayWidth ', StatorParams.RayWidth:0:5);
|
||||
writeln(OutFile, ';RequiredSpacing ', RequiredSpacing:0:5);
|
||||
writeln(OutFile, ';AngleBetweenRays ', AngleBetweenRays:0:5);
|
||||
writeln(OutFile, ';MaxDepth ', MaxDepth:0:5);
|
||||
writeln(OutFile);
|
||||
//Åñëè äîïóñòèìàÿ ãëóáèíà ìåíüøå, ÷åì äèàìåòð îñíîâàíèÿ, òîãäà äëèíà êàòóøêè ðàâíà äëèíå ëó÷à.
|
||||
//Åñëè äîïóñòèìàÿ ãëóáèíà áîëüøå, ÷åì äèàìåòð + äëèíà ëó÷à, ïðåêðàùàåì äâèæ.
|
||||
//Èíà÷å äëèíà êàòóøêè ðàâíà "ðàäèóñ_îñíîâàíèÿ + äëèíà_ëó÷à - ãëóáèíà)
|
||||
If (MaxDepth < (StatorParams.BaseRadius)) then CoilLength:=StatorParams.RayLength else if (MaxDepth > (StatorParams.RayLength+StatorParams.BaseRadius)) then break else
|
||||
CoilLength:=StatorParams.RayLength+StatorParams.BaseRadius-MaxDepth;
|
||||
writeln(OutFile, ';CoilLength ', CoilLength:0:5);
|
||||
// CurrentCoilTurns := ceil(CoilLength/StatorParams.WireDiameter);
|
||||
//Èñõîäÿ èç äëèíû êàòóøêè ñ÷èòàåì êîëè÷åñòâî âèòêîâ. È ñêëàäûâàåì ñêîëüêî âñåãî âèòêîâ íà êàòóøêå.
|
||||
CurrentCoilTurns := round(CoilLength/StatorParams.WireDiameter);
|
||||
writeln(OutFile, ';CurrentCoilTurns ', CurrentCoilTurns);
|
||||
CoilTurnsSum := CoilTurnsSum+CurrentCoilTurns;
|
||||
writeln(OutFile, ';CoilTurnsSum ', CoilTurnsSum);
|
||||
writeln(OutFile);
|
||||
//Ïåðåä êàæäûì ñëîåì íóæíî ïåðåñ÷èòàòü êîîðäèíàòó Z
|
||||
write(OutFile,';RecalculateZ. CurrentZ=',CurrentZ:0:5);
|
||||
if (MoveForward = false) then CurrentZ:=StatorParams.RayLength+StatorParams.BaseRadius-StatorParams.WireDiameter/2
|
||||
else CurrentZ:=StatorParams.RayLength+StatorParams.BaseRadius-StatorParams.WireDiameter*(CurrentCoilTurns-0.5);
|
||||
writeln(OutFile,'; NewZ=',CurrentZ:0:5);
|
||||
//Íà÷èíàåì ìîòàòü.
|
||||
writeln(OutFile, ';We make ',CurrentCoilTurns, ' turns on ', LayerNumber, ' layer.' );
|
||||
for j := 0 to CurrentCoilTurns do
|
||||
begin
|
||||
writeln(OutFile,';Coil¹ = ',j);
|
||||
writeln(OutFile,'M117 ',j);
|
||||
//angle := CalculateAngle(CoilWidth/2, CurrentZ);
|
||||
angle := AngleBetweenRays/2;
|
||||
|
||||
//Divide the path into 100 points
|
||||
//Move from left-down to left-up
|
||||
for k := 1 to 100 do
|
||||
begin
|
||||
angle := AngleBetweenRays/2;
|
||||
angle := ((-1*angle)+2*(angle/100*k));
|
||||
writeln(OutFile, 'G1 X', -1*CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5, ' ;CurrentZ= ',CurrentZ:0:5); // Top Left Corner
|
||||
end;
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
|
||||
// writeln(OutFile, 'G1 X', -1*CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Top Left Corner
|
||||
// if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
//writeln(OutFile, 'M0');
|
||||
|
||||
// angle := CalculateAngle(CoilWidth/2, CurrentZ);
|
||||
angle := AngleBetweenRays/2;
|
||||
writeln(OutFile, 'G1 X', CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5, ' ;CurrentZ= ',CurrentZ:0:5); // Top Right Corner
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
//writeln(OutFile, 'M0');
|
||||
|
||||
//Divide the path into 100 points
|
||||
//Move from left-down to rt-up
|
||||
for k := 1 to 100 do
|
||||
begin
|
||||
angle := AngleBetweenRays/2;
|
||||
angle := (angle-(2*(angle/100*k)));
|
||||
writeln(OutFile, 'G1 X', CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5, ' ;CurrentZ= ',CurrentZ:0:5); // Bottom Right Corner
|
||||
end;
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
|
||||
// angle := CalculateAngle(-1*CoilWidth/2, CurrentZ);
|
||||
// writeln(OutFile, 'G1 X', CoilHeight/2:0:3, ' Y', -angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Bottom Right Corner
|
||||
// if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
//writeln(OutFile, 'M0');
|
||||
|
||||
// angle := CalculateAngle(CoilWidth/2, CurrentZ);
|
||||
angle := AngleBetweenRays/2;
|
||||
writeln(OutFile, 'G1 X', -1*CoilHeight/2:0:3, ' Y', -angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5, ' ;CurrentZ= ',CurrentZ:0:5); // Bottom Left Corner
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
//writeln(OutFile, 'M0');
|
||||
end;
|
||||
|
||||
writeln(OutFile, 'M0');
|
||||
// writeln(OutFile, 'G91');
|
||||
// writeln(OutFile, 'G1 Y50');
|
||||
// writeln(OutFile, 'G90');
|
||||
Inc(LayerNumber);
|
||||
CoilWidth:=CoilWidth+StatorParams.WireDiameter*2;
|
||||
MoveForward:= not MoveForward;
|
||||
writeln(OutFile,';MoveForward: ', MoveForward);
|
||||
end;
|
||||
|
||||
|
||||
(* writeln(OutFile);
|
||||
writeln(OutFile, ';Second coil');
|
||||
Inc(LayerNumber);
|
||||
RequiredSpacing:=StatorParams.PathClearance*2+LayerNumber*StatorParams.WireDiameter*2+StatorParams.NeedleDiameter;
|
||||
writeln(OutFile, ';RequiredSpacing = ',RequiredSpacing:0:5);
|
||||
|
||||
For i:=1 to 20 do
|
||||
begin
|
||||
LayerNumber:=i;
|
||||
writeln(OutFile, ';Layer ', i);
|
||||
RequiredSpacing:=StatorParams.PathClearance*2+(LayerNumber-1)*StatorParams.WireDiameter*2+StatorParams.NeedleDiameter;
|
||||
writeln(OutFile, ';RequiredSpacing ', RequiredSpacing:0:5);
|
||||
|
||||
MaxDepth:=DepthCheck(StatorParams.RayWidth, RequiredSpacing, AngleBetweenRays);
|
||||
writeln(OutFile, ';MaxDepth ', MaxDepth:0:5);
|
||||
|
||||
If (MaxDepth < (StatorParams.BaseRadius)) then CoilLength:=StatorParams.RayLength else if (MaxDepth > (StatorParams.RayLength+StatorParams.BaseRadius)) then break else
|
||||
CoilLength:=StatorParams.RayLength+StatorParams.BaseRadius-MaxDepth;
|
||||
writeln(OutFile, ';CoilLength ', CoilLength:0:5);
|
||||
|
||||
// CurrentCoilTurns := round(CoilLength/StatorParams.WireDiameter);
|
||||
// CurrentCoilTurns := ceil(CoilLength/StatorParams.WireDiameter);
|
||||
CurrentCoilTurns := floor(CoilLength/StatorParams.WireDiameter);
|
||||
writeln(OutFile, ';CurrentCoilTurns ', CurrentCoilTurns);
|
||||
|
||||
CoilTurnsSum := CoilTurnsSum+CurrentCoilTurns;
|
||||
writeln(OutFile, ';CoilTurnsSum ', CoilTurnsSum);
|
||||
writeln(OutFile);
|
||||
end;*)
|
||||
|
||||
end;
|
||||
|
||||
|
||||
|
||||
// *** Your G-code generation logic here ***
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
writeln('Error writing to output file: ', E.Message);
|
||||
Halt(1);
|
||||
end;
|
||||
end;
|
||||
CloseFile(OutFile);
|
||||
|
||||
writeln('G-code generated to: ', OutputFileName);
|
||||
writeln('Press Enter... ');
|
||||
Readln;
|
||||
end.
|
Binary file not shown.
|
@ -9,18 +9,14 @@
|
|||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="327"/>
|
||||
<CursorPos X="3" Y="351"/>
|
||||
<TopLine Value="302"/>
|
||||
<CursorPos X="24" Y="326"/>
|
||||
<FoldState Value=" TC6B2 T3iD2{i5 piZm02KT"/>
|
||||
<UsageCount Value="220"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory HistoryIndex="25">
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="261" Column="19" TopLine="62"/>
|
||||
</Position>
|
||||
<JumpHistory HistoryIndex="29">
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="327" Column="6" TopLine="300"/>
|
||||
|
@ -119,7 +115,27 @@
|
|||
</Position>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="327" Column="35" TopLine="382"/>
|
||||
<Caret Line="408" Column="11" TopLine="381"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="389" Column="70" TopLine="381"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="430" Column="64" TopLine="391"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="409" Column="33" TopLine="389"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="342" Column="20" TopLine="322"/>
|
||||
</Position>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v2.pas"/>
|
||||
<Caret Line="408" Column="42" TopLine="386"/>
|
||||
</Position>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
|
|
|
@ -323,7 +323,7 @@ begin
|
|||
CoilRadius:=(StatorParams.RayTopHeight/2+StatorParams.NeedleDiameter/2+StatorParams.PathClearance);
|
||||
CoilWidth:=(StatorParams.RayTopWidth+StatorParams.NeedleDiameter+StatorParams.PathClearance*2);
|
||||
CoilHeight:=(StatorParams.RayTopHeight+StatorParams.NeedleDiameter+StatorParams.PathClearance*2);
|
||||
writeln('CoilRadius = ', CoilRadius:0:3);
|
||||
writeln(OutFile, ';CoilRadius = ', CoilRadius:0:3);
|
||||
writeln(OutFile, 'G1 X', -1*CoilRadius:0:3);
|
||||
|
||||
//ïðèáëèæàåìñÿ ê îñíîâàíèþ ñòàòîðà.
|
||||
|
@ -375,49 +375,68 @@ begin
|
|||
end
|
||||
else if (StatorParams.RayShape = 'rect') then
|
||||
begin
|
||||
writeln(OutFile, ';Rect? ');
|
||||
while (LayerNumber < MaxLayers) do
|
||||
begin
|
||||
writeln(OutFile, ';Layer ', LayerNumber);
|
||||
//Ñ÷èòàåì äëèíó êàòóøêè è êîëè÷åñòâî âèòêîâ
|
||||
RequiredSpacing:=StatorParams.PathClearance*2+(LayerNumber-1)*StatorParams.WireDiameter*2+StatorParams.NeedleDiameter;
|
||||
|
||||
writeln(OutFile, ';RayWidth ', StatorParams.RayWidth:0:5);
|
||||
writeln(OutFile, ';RequiredSpacing ', RequiredSpacing:0:5);
|
||||
writeln(OutFile, ';AngleBetweenRays ', AngleBetweenRays:0:5);
|
||||
|
||||
MaxDepth:=DepthCheck(StatorParams.RayWidth, RequiredSpacing, AngleBetweenRays);
|
||||
writeln(OutFile, ';MaxDepth ', MaxDepth:0:5);
|
||||
writeln(OutFile);
|
||||
If (MaxDepth < (StatorParams.BaseRadius)) then CoilLength:=StatorParams.RayLength else if (MaxDepth > (StatorParams.RayLength+StatorParams.BaseRadius)) then break else
|
||||
CoilLength:=StatorParams.RayLength+StatorParams.BaseRadius-MaxDepth;
|
||||
writeln(OutFile, ';CoilLength ', CoilLength:0:5);
|
||||
CurrentCoilTurns := ceil(CoilLength/StatorParams.WireDiameter);
|
||||
// CurrentCoilTurns := ceil(CoilLength/StatorParams.WireDiameter);
|
||||
CurrentCoilTurns := round(CoilLength/StatorParams.WireDiameter);
|
||||
writeln(OutFile, ';CurrentCoilTurns ', CurrentCoilTurns);
|
||||
// CurrentCoilTurns := round(CoilLength/StatorParams.WireDiameter);
|
||||
|
||||
CoilTurnsSum := CoilTurnsSum+CurrentCoilTurns;
|
||||
writeln(OutFile, ';CoilTurnsSum ', CoilTurnsSum);
|
||||
writeln(OutFile);
|
||||
writeln(OutFile, ';We make ',CurrentCoilTurns, ' turns on ', LayerNumber, ' layer.' );
|
||||
|
||||
writeln(OutFile,';CoilWidth = ',CoilWidth:0:5);
|
||||
|
||||
|
||||
for j := 0 to CurrentCoilTurns do
|
||||
begin
|
||||
|
||||
writeln(OutFile,';CoilWidth = ',CoilWidth:0:5);
|
||||
angle := CalculateAngle(CoilWidth/2, CurrentZ);
|
||||
writeln(OutFile,';Coil¹ = ',j);
|
||||
writeln(OutFile,'M117 ',j);
|
||||
//angle := CalculateAngle(CoilWidth/2, CurrentZ);
|
||||
angle := AngleBetweenRays/2;
|
||||
//Divide the path into 100 points
|
||||
(* for k := 1 to 100 do
|
||||
begin
|
||||
end; *)
|
||||
|
||||
writeln(OutFile, 'G1 X', -1*CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Top Left Corner
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
writeln(OutFile, 'M0');
|
||||
//writeln(OutFile, 'M0');
|
||||
|
||||
// angle := CalculateAngle(CoilWidth/2, CurrentZ);
|
||||
writeln(OutFile, 'G1 X', CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Top Right Corner
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
writeln(OutFile, 'M0');
|
||||
//writeln(OutFile, 'M0');
|
||||
|
||||
angle := CalculateAngle(-1*CoilWidth/2, CurrentZ);
|
||||
writeln(OutFile, 'G1 X', CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Bottom Right Corner
|
||||
// angle := CalculateAngle(-1*CoilWidth/2, CurrentZ);
|
||||
writeln(OutFile, 'G1 X', CoilHeight/2:0:3, ' Y', -angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Bottom Right Corner
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
writeln(OutFile, 'M0');
|
||||
//writeln(OutFile, 'M0');
|
||||
|
||||
// angle := CalculateAngle(CoilWidth/2, CurrentZ);
|
||||
writeln(OutFile, 'G1 X', -1*CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Bottom Left Corner
|
||||
writeln(OutFile, 'G1 X', -1*CoilHeight/2:0:3, ' Y', -angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Bottom Left Corner
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
writeln(OutFile, 'M0');
|
||||
//writeln(OutFile, 'M0');
|
||||
end;
|
||||
|
||||
|
||||
writeln(OutFile, 'M0');
|
||||
// writeln(OutFile, 'G91');
|
||||
// writeln(OutFile, 'G1 Y50');
|
||||
// writeln(OutFile, 'G90');
|
||||
|
|
BIN
gcode/Generator/gcodegenerator_v3.exe
Normal file
BIN
gcode/Generator/gcodegenerator_v3.exe
Normal file
Binary file not shown.
62
gcode/Generator/gcodegenerator_v3.lpi
Normal file
62
gcode/Generator/gcodegenerator_v3.lpi
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="gcodegenerator_v3"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="gcodegenerator_v3.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="gcodegenerator_v3"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf3"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
44
gcode/Generator/gcodegenerator_v3.lps
Normal file
44
gcode/Generator/gcodegenerator_v3.lps
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="12"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="gcodegenerator_v3.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="403"/>
|
||||
<CursorPos X="19" Y="415"/>
|
||||
<FoldState Value=" TC6B2 T3iD2{i5 piZm02K T0p34U^"/>
|
||||
<UsageCount Value="220"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<JumpHistory>
|
||||
<Position>
|
||||
<Filename Value="gcodegenerator_v3.pas"/>
|
||||
<Caret Line="417" Column="42" TopLine="393"/>
|
||||
</Position>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes ActiveMode="default">
|
||||
<Mode Name="default">
|
||||
<local>
|
||||
<CommandLineParams Value="input.txt output.gcode"/>
|
||||
</local>
|
||||
</Mode>
|
||||
</Modes>
|
||||
</RunParams>
|
||||
<HistoryLists>
|
||||
<List Name="LaunchingApplication" Type="File" Count="1">
|
||||
<Item1 Value="C:\Windows\system32\cmd.exe /C ${TargetCmdLine}"/>
|
||||
</List>
|
||||
<List Name="CommandLineParameters" Count="1">
|
||||
<Item1 Value="input.txt output.gcode"/>
|
||||
</List>
|
||||
</HistoryLists>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
522
gcode/Generator/gcodegenerator_v3.pas
Normal file
522
gcode/Generator/gcodegenerator_v3.pas
Normal file
|
@ -0,0 +1,522 @@
|
|||
program gcodegenerator_v3;
|
||||
|
||||
uses
|
||||
SysUtils, StrUtils, Math;
|
||||
|
||||
type
|
||||
TPoint = record
|
||||
X, Y: double;
|
||||
end;
|
||||
|
||||
type
|
||||
TStatorParams = record
|
||||
BaseDiameter: Double;
|
||||
BaseRadius: Double;
|
||||
NumberOfRays: Integer;
|
||||
RayShape: string;
|
||||
RayDiameter: Double;
|
||||
RayWidth: Double;
|
||||
RayHeight: Double;
|
||||
RayLength: Double;
|
||||
|
||||
RayTopShape: string;
|
||||
RayTopDiameter: Double;
|
||||
RayTopWidth: Double;
|
||||
RayTopHeight: Double;
|
||||
|
||||
RayCenterOffset: Double;
|
||||
WireDiameter: Double;
|
||||
NeedleDiameter: Double;
|
||||
PathClearance: Double;
|
||||
|
||||
WorkSpeed :integer;
|
||||
end;
|
||||
|
||||
var
|
||||
InputFileName, OutputFileName: string;
|
||||
StatorParams: TStatorParams;
|
||||
InFile, OutFile: TextFile;
|
||||
Line: string;
|
||||
CoilRadius,CoilWidth,CoilHeight :double;
|
||||
CurrentZ: double;
|
||||
coords: TPoint;
|
||||
normalizecoords: TPoint;
|
||||
i, j, k: Integer;
|
||||
CoilLength :double;
|
||||
CurrentCoilTurns, CoilTurnsSum :Integer;
|
||||
AngleBetweenRays :double;
|
||||
RequiredSpacing: Double;
|
||||
LayerNumber :Integer;
|
||||
MaxLayers :Integer;
|
||||
angle :double;
|
||||
MaxDepth,MaxPath :double;
|
||||
MoveForward:boolean;
|
||||
|
||||
|
||||
|
||||
function ParseLine(Line: string): Boolean;
|
||||
var
|
||||
Parts: array of string;
|
||||
Value: string;
|
||||
TrimmedLine: string;
|
||||
begin
|
||||
TrimmedLine := Trim(Line); // Óäàëÿåì ïðîáåëû â íà÷àëå è êîíöå ñòðîêè
|
||||
if Length(TrimmedLine) = 0 then
|
||||
begin
|
||||
exit(true); // Ïóñòàÿ ñòðîêà - ïðîïóñêàåì
|
||||
end
|
||||
else if TrimmedLine[1] in [';','#'] then
|
||||
begin
|
||||
exit(true); // Ñòðîêà êîììåíòàðèÿ - ïðîïóñêàåì
|
||||
end;
|
||||
|
||||
Parts := SplitString(TrimmedLine, '='); // Èñïîëüçóåì TrimmedLine
|
||||
Result := Length(Parts) = 2;
|
||||
if Result then
|
||||
begin
|
||||
Value := LowerCase(Trim(Parts[1])); // Ïðèâîäèì ê íèæíåìó ðåãèñòðó
|
||||
case Trim(Parts[0]) of
|
||||
'base_dia': begin
|
||||
StatorParams.BaseDiameter := StrToFloat(Value);
|
||||
writeln('Base Diameter: ', StatorParams.BaseDiameter:8:2);
|
||||
writeln();
|
||||
StatorParams.BaseRadius := StatorParams.BaseDiameter/2;
|
||||
writeln('Base Radius: ', StatorParams.BaseRadius:8:2);
|
||||
writeln();
|
||||
|
||||
end;
|
||||
'num_rays': begin
|
||||
StatorParams.NumberOfRays := StrToInt(Value);
|
||||
writeln('Number of Rays: ', StatorParams.NumberOfRays);
|
||||
AngleBetweenRays := 360/StatorParams.NumberOfRays;
|
||||
writeln('Angle Between Rays: ', AngleBetweenRays);
|
||||
writeln();
|
||||
end;
|
||||
'ray_shape': begin
|
||||
if Pos(Value, 'circle, rect, superellipse') = 0 then
|
||||
raise Exception.Create('Invalid value for ray_shape: ' + Value);
|
||||
StatorParams.RayShape := Value;
|
||||
writeln('Ray Shape: ', StatorParams.RayShape);
|
||||
writeln();
|
||||
end;
|
||||
'ray_dia': begin
|
||||
StatorParams.RayDiameter := StrToFloat(Value);
|
||||
writeln('Ray Diameter: ', StatorParams.RayDiameter:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'ray_w': begin
|
||||
StatorParams.RayWidth := StrToFloat(Value);
|
||||
writeln('Ray Width: ', StatorParams.RayWidth:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'ray_h': begin
|
||||
StatorParams.RayHeight := StrToFloat(Value);
|
||||
writeln('Ray Height: ', StatorParams.RayHeight:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'ray_len': begin
|
||||
StatorParams.RayLength := StrToFloat(Value);
|
||||
writeln('Ray Length: ', StatorParams.RayLength:8:2);
|
||||
writeln();
|
||||
end;
|
||||
|
||||
'raytop_shape': begin
|
||||
if Pos(Value, 'circle, rect, superellipse') = 0 then
|
||||
raise Exception.Create('Invalid value for ray_top: ' + Value);
|
||||
StatorParams.RayTopShape := Value;
|
||||
writeln('Ray Top Shape: ', StatorParams.RayTopShape);
|
||||
end;
|
||||
|
||||
'raytop_dia': begin
|
||||
StatorParams.RayTopDiameter := StrToFloat(Value);
|
||||
writeln('Ray Top Diameter: ', StatorParams.RayTopDiameter:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'raytop_w': begin
|
||||
StatorParams.RayTopWidth := StrToFloat(Value);
|
||||
writeln('Ray Top Width: ', StatorParams.RayTopWidth:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'raytop_h': begin
|
||||
StatorParams.RayTopHeight := StrToFloat(Value);
|
||||
writeln('Ray Top Height: ', StatorParams.RayTopHeight:8:2);
|
||||
writeln();
|
||||
end;
|
||||
|
||||
'ray_offset': begin
|
||||
StatorParams.RayCenterOffset := StrToFloat(Value);
|
||||
writeln('Ray Center Offset: ', StatorParams.RayCenterOffset:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'wire_diameter': begin
|
||||
StatorParams.WireDiameter := StrToFloat(Value);
|
||||
writeln('Wire Diameter: ', StatorParams.WireDiameter:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'needle_diameter': begin
|
||||
StatorParams.NeedleDiameter := StrToFloat(Value);
|
||||
writeln('Needle Diameter: ', StatorParams.NeedleDiameter:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'path_clearance': begin
|
||||
StatorParams.PathClearance := StrToFloat(Value);
|
||||
writeln('Path Clearance: ', StatorParams.PathClearance:8:2);
|
||||
writeln();
|
||||
end;
|
||||
'work_speed': begin
|
||||
StatorParams.WorkSpeed := StrToInt(Value);
|
||||
writeln('Work Speed: ', StatorParams.WorkSpeed);
|
||||
writeln();
|
||||
end;
|
||||
|
||||
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
if not Result then
|
||||
begin
|
||||
writeln('Error: Unknown parameter: ', Parts[0]);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ReadInputFile();
|
||||
Begin
|
||||
// **Opening the input file**
|
||||
AssignFile(InFile, InputFileName);
|
||||
try
|
||||
Reset(InFile); // **This line opens the file for reading**
|
||||
while not EOF(InFile) do
|
||||
begin
|
||||
ReadLn(InFile, Line);
|
||||
if Length(Line) > 0 then
|
||||
if not ParseLine(Line) then
|
||||
writeln('Error: Invalid line: ', Line);
|
||||
end;
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
writeln('Error opening or reading input file: ', E.Message);
|
||||
Halt(1);
|
||||
end;
|
||||
end;
|
||||
CloseFile(InFile);
|
||||
end;
|
||||
|
||||
function CircleCoordinates(diameter, angleDegrees: Double): TPoint;
|
||||
var
|
||||
radius: Double;
|
||||
angleRadians: Double;
|
||||
begin
|
||||
radius := diameter / 2;
|
||||
// angleRadians := -1*angleDegrees * PI / 180; // Ïåðåâîä ãðàäóñîâ â ðàäèàíû
|
||||
angleRadians := -1 * DegToRad(angleDegrees);
|
||||
|
||||
Result.X := radius * Cos(angleRadians);
|
||||
Result.Y := radius * Sin(angleRadians);
|
||||
end;
|
||||
|
||||
function CalculateAngle(opposite, adjacent: Double): Double;
|
||||
begin
|
||||
if adjacent = 0 then
|
||||
raise Exception.Create('Adjacent side cannot be zero');
|
||||
// CalculateAngle := ArcTan(opposite / adjacent) * 180 / PI;
|
||||
CalculateAngle := RadToDeg(ArcTan(opposite / adjacent));
|
||||
end;
|
||||
|
||||
function NormalizeZ(radius: Real; thetaDeg: Real): Real;
|
||||
var
|
||||
thetaRad, alphaRad, xKas, yKas, mTang, bTang: Real;
|
||||
begin
|
||||
// 1. Ïðåîáðàçîâàíèå óãëà èç ãðàäóñîâ â ðàäèàíû.
|
||||
thetaRad := DegToRad(thetaDeg);
|
||||
|
||||
// 2. Âû÷èñëåíèå êîîðäèíàò òî÷êè êàñàíèÿ íà îêðóæíîñòè (îòíîñèòåëüíî öåíòðà 0,0).
|
||||
xKas := radius * Cos(thetaRad);
|
||||
yKas := radius * Sin(thetaRad);
|
||||
|
||||
// 3. Âû÷èñëåíèå óãëà, ïåðïåíäèêóëÿðíîãî ðàäèóñ-âåêòîðó (êàñàòåëüíîé).
|
||||
alphaRad := thetaRad + PI / 2;
|
||||
|
||||
// 4. Âû÷èñëåíèå óãëîâîãî êîýôôèöèåíòà êàñàòåëüíîé.
|
||||
mTang := Tan(alphaRad);
|
||||
|
||||
// 5. Âû÷èñëåíèå ñâîáîäíîãî ÷ëåíà óðàâíåíèÿ êàñàòåëüíîé (y = mTang * x + bTang).
|
||||
bTang := yKas - mTang * xKas;
|
||||
|
||||
// 6. Âû÷èñëåíèå êîîðäèíàòû X òî÷êè ïåðåñå÷åíèÿ êàñàòåëüíîé ñ îñüþ X (y = 0).
|
||||
// 0 = mTang * x + bTang
|
||||
// x = -bTang / mTang
|
||||
if mTang = 0 then
|
||||
begin
|
||||
// Êàñàòåëüíàÿ ïàðàëëåëüíà îñè X - íåò òî÷êè ïåðåñå÷åíèÿ. Âîçâðàùàåì NaN.
|
||||
NormalizeZ := NaN;
|
||||
end
|
||||
else
|
||||
begin
|
||||
NormalizeZ := -bTang / mTang;
|
||||
end;
|
||||
end;
|
||||
|
||||
function DepthCheck(thickness, lineLength, angleDeg: double): double;
|
||||
var
|
||||
xIntersection, distanceToIntersection, radius: double;
|
||||
begin
|
||||
xIntersection := (thickness/2 + thickness/2 * cos(DegToRad(angleDeg)))/sin(DegToRad(angleDeg));
|
||||
distanceToIntersection := sqrt(sqr(xIntersection) + sqr(1.2));
|
||||
radius := lineLength / (2 * tan(DegToRad(angleDeg) / 2));
|
||||
DepthCheck := distanceToIntersection + radius;
|
||||
end;
|
||||
|
||||
function CalculateMaxPath(length, width, angleDegrees: double): double;
|
||||
var
|
||||
topLeftX, topLeftY, rotatedX, rotatedY, angleRadians, distance: double;
|
||||
begin
|
||||
// Âû÷èñëÿåì êîîðäèíàòû âåðõíåãî ëåâîãî óãëà ïðÿìîóãîëüíèêà
|
||||
topLeftX := -length;
|
||||
topLeftY := width / 2;
|
||||
|
||||
// Ïðåîáðàçóåì óãîë â ðàäèàíû (ñ ó÷åòîì âðàùåíèÿ ïî ÷àñîâîé ñòðåëêå)
|
||||
angleRadians := degToRad(-angleDegrees);
|
||||
|
||||
// Âû÷èñëÿåì êîîðäèíàòû ïîâåðíóòîãî íèæíåãî ëåâîãî óãëà âòîðîãî ïðÿìîóãîëüíèêà
|
||||
rotatedX := -length * cos(angleRadians) - (-width / 2) * sin(angleRadians);
|
||||
rotatedY := -length * sin(angleRadians) + (-width / 2) * cos(angleRadians);
|
||||
|
||||
// Âû÷èñëÿåì ðàññòîÿíèå ìåæäó òî÷êàìè
|
||||
distance := sqrt(sqr(rotatedX - topLeftX) + sqr(rotatedY - topLeftY));
|
||||
|
||||
// Âîçâðàùàåì ðåçóëüòàò
|
||||
MaxPath := distance;
|
||||
end;
|
||||
|
||||
begin
|
||||
// Command line argument handling
|
||||
if ParamCount < 2 then
|
||||
begin
|
||||
Writeln('Usage: GCodeGenerator <input_file.txt> <output_file.gcode>');
|
||||
Halt(1);
|
||||
end;
|
||||
InputFileName := ParamStr(1);
|
||||
OutputFileName := ParamStr(2);
|
||||
|
||||
ReadInputFile();
|
||||
|
||||
// G-code generation
|
||||
AssignFile(OutFile, OutputFileName);
|
||||
try
|
||||
Rewrite(OutFile);
|
||||
// *** Your G-code generation logic here ***
|
||||
writeln(OutFile, '; G-code for stator winding');
|
||||
writeln(OutFile, 'G90 ; Absolute coordinate system');
|
||||
writeln(OutFile, 'G1 Y-10');
|
||||
writeln(OutFile, 'G28 X Y Z');
|
||||
writeln(OutFile, 'G1 X0 Y0');
|
||||
//writeln(OutFile, 'G28 O'); //Home all "untrusted" axes
|
||||
writeln(OutFile);
|
||||
// Move to center of ray along Y axis and reset coordinate
|
||||
writeln(OutFile, 'G1 X', StatorParams.RayCenterOffset:0:2);
|
||||
writeln(OutFile, 'G92 X0');
|
||||
|
||||
//îòâîäèì èãëó ëåâåå è íèæå âåðøèíû ëó÷à
|
||||
CoilRadius:=(StatorParams.RayTopHeight/2+StatorParams.NeedleDiameter/2+StatorParams.PathClearance);
|
||||
CoilWidth:=(StatorParams.RayTopWidth+StatorParams.NeedleDiameter+StatorParams.PathClearance*2);
|
||||
CoilHeight:=(StatorParams.RayTopHeight+StatorParams.NeedleDiameter+StatorParams.PathClearance*2);
|
||||
writeln(OutFile, ';CoilRadius = ', CoilRadius:0:3);
|
||||
writeln(OutFile, ';CoilWidth = ', CoilWidth:0:3);
|
||||
writeln(OutFile, ';CoilHeight = ', CoilHeight:0:3);
|
||||
writeln(OutFile, 'G1 X', -1*CoilHeight/2:0:3, ' Y',-1*AngleBetweenRays/2:0:3);
|
||||
|
||||
//ïðèáëèæàåìñÿ ê îñíîâàíèþ ñòàòîðà.
|
||||
CurrentZ:=(StatorParams.BaseDiameter/2)+StatorParams.PathClearance;
|
||||
writeln(OutFile, 'G1 Z', CurrentZ:0:2, ' F', StatorParams.WorkSpeed);
|
||||
//Âñòà¸ì íà ïàóçó äëÿ òîãî, ÷òîáû ïðèâÿçàòü êîíåö ïðîâîëîêè
|
||||
writeln(OutFile, 'M0');
|
||||
|
||||
writeln(OutFile, ';Start coil');
|
||||
//Íà÷èíàåì ìîòàòü êàòóøêó.
|
||||
//Ñ÷èòàåì, ñêîëüêî ñëî¸â ìîæåì íàìîòàòü.
|
||||
MaxPath:=CalculateMaxPath((StatorParams.RayLength+StatorParams.BaseRadius), StatorParams.RayWidth, AngleBetweenRays);
|
||||
// MaxLayers :=trunc(((MaxPath-RequiredSpacing)/2/StatorParams.WireDiameter));
|
||||
MaxLayers :=round(((MaxPath-RequiredSpacing)/2/StatorParams.WireDiameter));
|
||||
writeln(OutFile, ';MaxLayers ', MaxLayers);
|
||||
Inc(LayerNumber);
|
||||
//Äâèãàåìñÿ îò öåíòðà ê êðàþ
|
||||
MoveForward:=true;
|
||||
if (StatorParams.RayShape = 'circle') then
|
||||
begin
|
||||
for j := 0 to CurrentCoilTurns do
|
||||
begin
|
||||
for i := 0 to 360 do
|
||||
begin
|
||||
coords := CircleCoordinates(CoilRadius*2, i+180);
|
||||
// writeln(OutFile,'CoilRadius*2= ',CoilRadius*2:0:5,' X=', coords.X:0:3, ' Y=', coords.Y:0:5);
|
||||
angle := CalculateAngle(coords.Y, CurrentZ);
|
||||
|
||||
// writeln(OutFile, ';G1 X', coords.X:0:3, ' Y', angle:0:5,' Z', CurrentZ:0:5);
|
||||
writeln(OutFile, 'G1 X', coords.X:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5);
|
||||
// writeln(OutFile);
|
||||
|
||||
CurrentZ:=CurrentZ+StatorParams.WireDiameter/360;
|
||||
end;
|
||||
writeln(OutFile, ';Next coil.');
|
||||
end;
|
||||
writeln(OutFile, ';Second coil');
|
||||
Inc(LayerNumber);
|
||||
// RequiredSpacing:=StatorParams.RayWidth+StatorParams.NeedleDiameter+StatorParams.PathClearance*2+LayerNumber*StatorParams.WireDiameter*2;
|
||||
// writeln(OutFile, ';RequiredSpacing = ',RequiredSpacing:0:5);
|
||||
RequiredSpacing:=StatorParams.RayTopWidth;
|
||||
writeln(OutFile, ';RequiredSpacing = ',RequiredSpacing:0:5);
|
||||
RequiredSpacing:=RequiredSpacing+StatorParams.NeedleDiameter;
|
||||
writeln(OutFile, ';RequiredSpacing = ',RequiredSpacing:0:5);
|
||||
RequiredSpacing:=RequiredSpacing+StatorParams.PathClearance*2+LayerNumber*StatorParams.WireDiameter*2;
|
||||
writeln(OutFile, ';RequiredSpacing = ',RequiredSpacing:0:5);
|
||||
|
||||
CurrentZ:=RequiredSpacing/(2 * tan(AngleBetweenRays*PI/180/2));
|
||||
writeln(OutFile, ';CurrentZ = ',CurrentZ:0:3);
|
||||
end
|
||||
else if (StatorParams.RayShape = 'rect') then
|
||||
begin
|
||||
// writeln(OutFile, ';Rect? ');
|
||||
while (LayerNumber <= MaxLayers) do
|
||||
begin
|
||||
//writeln(OutFile, ';Layer ', LayerNumber);
|
||||
//Ñ÷èòàåì äëèíó êàòóøêè è êîëè÷åñòâî âèòêîâ
|
||||
//Äëÿ ýòîãî ñ÷èòàåì íåîáõîäèìîå ðàññòîÿíèå ìåæäó ëó÷àìè. 2 äèàìåòðà ïðîâîäà + äèàìåòð èãëû + 2 çàçîðà áåçîïàñíîñòè
|
||||
RequiredSpacing:=StatorParams.PathClearance*2+(LayerNumber-1)*StatorParams.WireDiameter*2+StatorParams.NeedleDiameter;
|
||||
//Èñïîëüçóÿ íåîáõîäèìîå ðàññòîÿíèå, ðàññ÷èòûâàåì íà êàêóþ, ìàêñèìàëüíóþ ãëóáèíó ìîæåò ïîãðóçèòüñÿ èãîëêà. (ðàññòîÿíèå îò öåíòðà ñòàòîðà)
|
||||
MaxDepth:=DepthCheck(StatorParams.RayWidth, RequiredSpacing, AngleBetweenRays);
|
||||
writeln(OutFile, ';RayWidth ', StatorParams.RayWidth:0:5);
|
||||
writeln(OutFile, ';RequiredSpacing ', RequiredSpacing:0:5);
|
||||
writeln(OutFile, ';AngleBetweenRays ', AngleBetweenRays:0:5);
|
||||
writeln(OutFile, ';MaxDepth ', MaxDepth:0:5);
|
||||
writeln(OutFile);
|
||||
//Åñëè äîïóñòèìàÿ ãëóáèíà ìåíüøå, ÷åì äèàìåòð îñíîâàíèÿ, òîãäà äëèíà êàòóøêè ðàâíà äëèíå ëó÷à.
|
||||
//Åñëè äîïóñòèìàÿ ãëóáèíà áîëüøå, ÷åì äèàìåòð + äëèíà ëó÷à, ïðåêðàùàåì äâèæ.
|
||||
//Èíà÷å äëèíà êàòóøêè ðàâíà "ðàäèóñ_îñíîâàíèÿ + äëèíà_ëó÷à - ãëóáèíà)
|
||||
If (MaxDepth < (StatorParams.BaseRadius)) then CoilLength:=StatorParams.RayLength else if (MaxDepth > (StatorParams.RayLength+StatorParams.BaseRadius)) then break else
|
||||
CoilLength:=StatorParams.RayLength+StatorParams.BaseRadius-MaxDepth;
|
||||
writeln(OutFile, ';CoilLength ', CoilLength:0:5);
|
||||
// CurrentCoilTurns := ceil(CoilLength/StatorParams.WireDiameter);
|
||||
//Èñõîäÿ èç äëèíû êàòóøêè ñ÷èòàåì êîëè÷åñòâî âèòêîâ. È ñêëàäûâàåì ñêîëüêî âñåãî âèòêîâ íà êàòóøêå.
|
||||
CurrentCoilTurns := round(CoilLength/StatorParams.WireDiameter);
|
||||
writeln(OutFile, ';CurrentCoilTurns ', CurrentCoilTurns);
|
||||
CoilTurnsSum := CoilTurnsSum+CurrentCoilTurns;
|
||||
writeln(OutFile, ';CoilTurnsSum ', CoilTurnsSum);
|
||||
writeln(OutFile);
|
||||
//Ïåðåä êàæäûì ñëîåì íóæíî ïåðåñ÷èòàòü êîîðäèíàòó Z
|
||||
write(OutFile,';RecalculateZ. CurrentZ=',CurrentZ:0:5);
|
||||
if (MoveForward = false) then CurrentZ:=StatorParams.RayLength+StatorParams.BaseRadius-StatorParams.WireDiameter/2
|
||||
else CurrentZ:=StatorParams.RayLength+StatorParams.BaseRadius-StatorParams.WireDiameter*(CurrentCoilTurns-0.5);
|
||||
writeln(OutFile,'; NewZ=',CurrentZ:0:5);
|
||||
//Íà÷èíàåì ìîòàòü.
|
||||
writeln(OutFile, ';We make ',CurrentCoilTurns, ' turns on ', LayerNumber, ' layer.' );
|
||||
for j := 1 to CurrentCoilTurns do
|
||||
begin
|
||||
writeln(OutFile,';Coil¹ = ',j);
|
||||
writeln(OutFile,'M117 ',j);
|
||||
//angle := CalculateAngle(CoilWidth/2, CurrentZ);
|
||||
angle := AngleBetweenRays/2;
|
||||
|
||||
//Divide the path into 100 points
|
||||
//Move from left-down to left-up
|
||||
for k := 1 to 100 do
|
||||
begin
|
||||
angle := AngleBetweenRays/2;
|
||||
angle := ((-1*angle)+2*(angle/100*k));
|
||||
writeln(OutFile, 'G1 X', -1*CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5, ' ;CurrentZ= ',CurrentZ:0:5); // Top Left Corner
|
||||
end;
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
|
||||
// writeln(OutFile, 'G1 X', -1*CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Top Left Corner
|
||||
// if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
//writeln(OutFile, 'M0');
|
||||
|
||||
// angle := CalculateAngle(CoilWidth/2, CurrentZ);
|
||||
angle := AngleBetweenRays/2;
|
||||
writeln(OutFile, 'G1 X', CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5, ' ;CurrentZ= ',CurrentZ:0:5); // Top Right Corner
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
//writeln(OutFile, 'M0');
|
||||
|
||||
//Divide the path into 100 points
|
||||
//Move from left-down to rt-up
|
||||
for k := 1 to 100 do
|
||||
begin
|
||||
angle := AngleBetweenRays/2;
|
||||
angle := (angle-(2*(angle/100*k)));
|
||||
writeln(OutFile, 'G1 X', CoilHeight/2:0:3, ' Y', angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5, ' ;CurrentZ= ',CurrentZ:0:5); // Bottom Right Corner
|
||||
end;
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
|
||||
// angle := CalculateAngle(-1*CoilWidth/2, CurrentZ);
|
||||
// writeln(OutFile, 'G1 X', CoilHeight/2:0:3, ' Y', -angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5); // Bottom Right Corner
|
||||
// if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
//writeln(OutFile, 'M0');
|
||||
|
||||
// angle := CalculateAngle(CoilWidth/2, CurrentZ);
|
||||
angle := AngleBetweenRays/2;
|
||||
writeln(OutFile, 'G1 X', -1*CoilHeight/2:0:3, ' Y', -angle:0:5,' Z', NormalizeZ(CurrentZ, angle):0:5, ' ;CurrentZ= ',CurrentZ:0:5); // Bottom Left Corner
|
||||
if MoveForward then CurrentZ:=CurrentZ+StatorParams.WireDiameter/4 else CurrentZ:=CurrentZ-StatorParams.WireDiameter/4;
|
||||
//writeln(OutFile, 'M0');
|
||||
end;
|
||||
|
||||
writeln(OutFile, 'M0');
|
||||
// writeln(OutFile, 'G91');
|
||||
// writeln(OutFile, 'G1 Y50');
|
||||
// writeln(OutFile, 'G90');
|
||||
Inc(LayerNumber);
|
||||
CoilWidth:=CoilWidth+StatorParams.WireDiameter*2;
|
||||
MoveForward:= not MoveForward;
|
||||
writeln(OutFile,';MoveForward: ', MoveForward);
|
||||
end;
|
||||
|
||||
|
||||
(* writeln(OutFile);
|
||||
writeln(OutFile, ';Second coil');
|
||||
Inc(LayerNumber);
|
||||
RequiredSpacing:=StatorParams.PathClearance*2+LayerNumber*StatorParams.WireDiameter*2+StatorParams.NeedleDiameter;
|
||||
writeln(OutFile, ';RequiredSpacing = ',RequiredSpacing:0:5);
|
||||
|
||||
For i:=1 to 20 do
|
||||
begin
|
||||
LayerNumber:=i;
|
||||
writeln(OutFile, ';Layer ', i);
|
||||
RequiredSpacing:=StatorParams.PathClearance*2+(LayerNumber-1)*StatorParams.WireDiameter*2+StatorParams.NeedleDiameter;
|
||||
writeln(OutFile, ';RequiredSpacing ', RequiredSpacing:0:5);
|
||||
|
||||
MaxDepth:=DepthCheck(StatorParams.RayWidth, RequiredSpacing, AngleBetweenRays);
|
||||
writeln(OutFile, ';MaxDepth ', MaxDepth:0:5);
|
||||
|
||||
If (MaxDepth < (StatorParams.BaseRadius)) then CoilLength:=StatorParams.RayLength else if (MaxDepth > (StatorParams.RayLength+StatorParams.BaseRadius)) then break else
|
||||
CoilLength:=StatorParams.RayLength+StatorParams.BaseRadius-MaxDepth;
|
||||
writeln(OutFile, ';CoilLength ', CoilLength:0:5);
|
||||
|
||||
// CurrentCoilTurns := round(CoilLength/StatorParams.WireDiameter);
|
||||
// CurrentCoilTurns := ceil(CoilLength/StatorParams.WireDiameter);
|
||||
CurrentCoilTurns := floor(CoilLength/StatorParams.WireDiameter);
|
||||
writeln(OutFile, ';CurrentCoilTurns ', CurrentCoilTurns);
|
||||
|
||||
CoilTurnsSum := CoilTurnsSum+CurrentCoilTurns;
|
||||
writeln(OutFile, ';CoilTurnsSum ', CoilTurnsSum);
|
||||
writeln(OutFile);
|
||||
end;*)
|
||||
|
||||
end;
|
||||
|
||||
|
||||
|
||||
// *** Your G-code generation logic here ***
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
writeln('Error writing to output file: ', E.Message);
|
||||
Halt(1);
|
||||
end;
|
||||
end;
|
||||
CloseFile(OutFile);
|
||||
|
||||
writeln('G-code generated to: ', OutputFileName);
|
||||
writeln('Press Enter... ');
|
||||
Readln;
|
||||
end.
|
|
@ -1,18 +1,18 @@
|
|||
# диаметр основания статора
|
||||
base_dia=38
|
||||
base_dia=37,8
|
||||
# количество лучей статора
|
||||
num_rays=1
|
||||
|
||||
# форма луча статора (circle, rect, superellipse)
|
||||
ray_shape=circle
|
||||
ray_shape=rect
|
||||
# диаметр луча статора
|
||||
ray_dia=5,0
|
||||
# ray_dia=5,0
|
||||
# ширина луча статора
|
||||
ray_w=8,9
|
||||
ray_w=2,4
|
||||
# высота луча статора
|
||||
ray_h=8,9
|
||||
ray_h=5
|
||||
# длина луча статора
|
||||
ray_len=10,0
|
||||
ray_len=9,0
|
||||
|
||||
# форма вершины луча
|
||||
raytop_shape=circle
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<Compiler Value="C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.exe" Date="1497193866"/>
|
||||
<Params Value=" -MObjFPC -Scghi -O1 -gw3 -gl -l -vewnhibq -FuD:\Documents\GitHub\motor-wire-winder\gcode\Generator\ -FUD:\Documents\GitHub\motor-wire-winder\gcode\Generator\lib\x86_64-win64\ -FED:\Documents\GitHub\motor-wire-winder\gcode\Generator\ -oD:\Documents\GitHub\motor-wire-winder\gcode\Generator\gcodegenerator_v3.exe gcodegenerator_v3.pas"/>
|
||||
</CONFIG>
|
BIN
gcode/Generator/lib/x86_64-win64/gcodegenerator_v3.o
Normal file
BIN
gcode/Generator/lib/x86_64-win64/gcodegenerator_v3.o
Normal file
Binary file not shown.
|
@ -1,15 +1,12 @@
|
|||
# диаметр основания статора
|
||||
base_dia=38
|
||||
base_dia=37,8
|
||||
# количество лучей статора
|
||||
num_rays=24
|
||||
|
||||
# форма луча статора (circle, rect, superellipse)
|
||||
# ray_shape=circle
|
||||
ray_shape=rect
|
||||
|
||||
# диаметр луча статора
|
||||
# ray_dia=5,0
|
||||
|
||||
# ширина луча статора
|
||||
ray_w=2,4
|
||||
# высота луча статора
|
||||
|
@ -18,7 +15,7 @@ ray_h=5
|
|||
ray_len=9,0
|
||||
|
||||
# форма вершины луча
|
||||
# raytop_shape=rect
|
||||
raytop_shape=rect
|
||||
|
||||
# диаметр вершины луча
|
||||
# raytop_dia=8,9
|
||||
|
@ -31,13 +28,13 @@ raytop_h=11,0
|
|||
# смещение центра луча
|
||||
ray_offset=14,7
|
||||
# диаметр провода
|
||||
wire_diameter=0,21
|
||||
wire_diameter=0,23
|
||||
# диаметр иглы
|
||||
needle_diameter=1,25
|
||||
|
||||
# зазор пути
|
||||
path_clearance=0,2
|
||||
path_clearance=0,4
|
||||
|
||||
# скорость намотки
|
||||
work_speed=1000
|
||||
work_speed=500
|
||||
# work_speed=20000
|
File diff suppressed because it is too large
Load diff
1291
gcode/Generator/trident_output2.gcode
Normal file
1291
gcode/Generator/trident_output2.gcode
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1 +1 @@
|
|||
gcodegenerator_v2.exe trident_input.txt trident_output.gcode
|
||||
gcodegenerator_v3.exe trident_input.txt trident_output.gcode
|
Binary file not shown.
Binary file not shown.
BIN
src/3d_printed_parts/Test_piptik.STL
Normal file
BIN
src/3d_printed_parts/Test_piptik.STL
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/holder_for_injector_needle.SLDPRT
Normal file
BIN
src/3d_printed_parts/holder_for_injector_needle.SLDPRT
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/holder_for_injector_needle.STL
Normal file
BIN
src/3d_printed_parts/holder_for_injector_needle.STL
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/main_carriage.STL
Normal file
BIN
src/3d_printed_parts/main_carriage.STL
Normal file
Binary file not shown.
Binary file not shown.
BIN
src/3d_printed_parts/needle_holder_for_075mm_tube.SLDPRT
Normal file
BIN
src/3d_printed_parts/needle_holder_for_075mm_tube.SLDPRT
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/needle_holder_for_075mm_tube_tmp.SLDPRT
Normal file
BIN
src/3d_printed_parts/needle_holder_for_075mm_tube_tmp.SLDPRT
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/needle_holder_for_075mm_tube_tmp.STL
Normal file
BIN
src/3d_printed_parts/needle_holder_for_075mm_tube_tmp.STL
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/needle_holder_spacer.SLDPRT
Normal file
BIN
src/3d_printed_parts/needle_holder_spacer.SLDPRT
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/needle_holder_spacer.STL
Normal file
BIN
src/3d_printed_parts/needle_holder_spacer.STL
Normal file
Binary file not shown.
Binary file not shown.
BIN
src/3d_printed_parts/needle_holder_top.STL
Normal file
BIN
src/3d_printed_parts/needle_holder_top.STL
Normal file
Binary file not shown.
Binary file not shown.
BIN
src/3d_printed_parts/organizer_my_2.STL
Normal file
BIN
src/3d_printed_parts/organizer_my_2.STL
Normal file
Binary file not shown.
Binary file not shown.
BIN
src/3d_printed_parts/x_axis_cariage.SLDPRT
Normal file
BIN
src/3d_printed_parts/x_axis_cariage.SLDPRT
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/x_axis_cariage.STL
Normal file
BIN
src/3d_printed_parts/x_axis_cariage.STL
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/Еще одна деталь для резинки.SLDPRT
Normal file
BIN
src/3d_printed_parts/Еще одна деталь для резинки.SLDPRT
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/Еще одна деталь для резинки.STL
Normal file
BIN
src/3d_printed_parts/Еще одна деталь для резинки.STL
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/Катушка_для_резинок.SLDPRT
Normal file
BIN
src/3d_printed_parts/Катушка_для_резинок.SLDPRT
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/Катушка_для_резинок.STL
Normal file
BIN
src/3d_printed_parts/Катушка_для_резинок.STL
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/Рычаг.SLDPRT
Normal file
BIN
src/3d_printed_parts/Рычаг.SLDPRT
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/Рычаг.STL
Normal file
BIN
src/3d_printed_parts/Рычаг.STL
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/Часть для резинки.SLDPRT
Normal file
BIN
src/3d_printed_parts/Часть для резинки.SLDPRT
Normal file
Binary file not shown.
BIN
src/3d_printed_parts/Часть для резинки.STL
Normal file
BIN
src/3d_printed_parts/Часть для резинки.STL
Normal file
Binary file not shown.
BIN
src/Calc.SLDPRT
BIN
src/Calc.SLDPRT
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.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue