CamAuto 3.1a1 :

- corretta gestione altezza taglio finale per tagli senza impostazione ultimo step.
This commit is contained in:
Dario Sassi
2026-01-19 11:05:44 +01:00
parent bb87b993c7
commit e1c303a5c6
3 changed files with 6027 additions and 93 deletions
+5785
View File
File diff suppressed because it is too large Load Diff
+242
View File
@@ -0,0 +1,242 @@
-- 2023/05/18 09:30:00
-- Programma per Lucidatura in OmagCut
-- Legenda codici errore (POLI.ERR) :
-- 0 = tutto bene
-- 10 = manca il grezzo
-- 20 = manca il kit
-- 30 = manca il contorno dell'area
-- 40 = kit vuoto o errore nella sua lettura
-- 50 = errore nel calcolo della lavorazione
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Versione
local POLISHING_VER = 'ver 2.5e1'
-- Recupero il grezzo
local nRawId = EgtGetFirstRawPart()
if not nRawId then
POLI.ERR = 10
return
end
-- Recupero la path del file dei kits
local sKitPath = EgtGetCurrMachineDir() .. '\\Machinings\\Kits.data'
-- Determinazioni da Ini di macchina
local sMachIni = EgtGetCurrMachineDir() .. '\\' .. EgtGetCurrMachineName() .. '.ini'
-- Se fresa e foretto devono lavorare con C=90deg (tavola 1 C90, tavola 2 C-90),
local nPolishingC90 = tonumber( EgtGetStringFromIni( 'Nest', 'PolishingC90', '0', sMachIni))
-- Reset stato di errore
POLI.ERR = 0
--------------------------------------------------------------------------------
-- Funzione locale per lettura di una lavorazione del kit
local function ReadMachKit( sSect, nMachInd)
local sKeyInd = string.format( '%02d', nMachInd or 0)
local sTuuid = EgtGetStringFromIni( sSect, sKeyInd .. '.Tool', '', sKitPath)
local sTname = EgtGetStringFromIni( sSect, sKeyInd .. '.ToolName', '', sKitPath)
if #sTuuid == 0 or #sTname == 0 then return nil end
local bActive = ( tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.Active', '', sKitPath) or 0) ~= 0)
local nCnt = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.Contour', '', sKitPath) or 0)
local dOffCnt = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.OffContour', '', sKitPath) or 0)
local nZzX = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.ZigZagX', '', sKitPath) or 0)
local dOffZzX = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.OffZigZagX', '', sKitPath) or 0)
local dStepX = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.StepX', '', sKitPath) or 0)
local dRadiusX = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.RadiusX', '', sKitPath) or 0)
local dDistanceX = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.DistanceX', '', sKitPath) or 0)
local nZzY = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.ZigZagY', '', sKitPath) or 0)
local dOffZzY = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.OffZigZagY', '', sKitPath) or 0)
local dStepY = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.StepY', '', sKitPath) or 0)
local dRadiusY = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.RadiusY', '', sKitPath) or 0)
local dDistanceY = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.DistanceY', '', sKitPath) or 0)
local nSpiral = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.Spiral', '', sKitPath) or 0)
local dOffSpiral = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.OffSpiral', '', sKitPath) or 0)
local dStepSpiral = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.StepSpiral', '', sKitPath) or 0)
local dRadiusSpiral = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.RadiusSpiral', '', sKitPath) or 0)
local dDistanceSpiral = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.DistanceSpiral', '', sKitPath) or 0)
local dLiLen = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.LiLen', '', sKitPath) or 0)
local dLiHei = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.LiHeight', '', sKitPath) or 0)
local dLiLoad = tonumber( EgtGetStringFromIni( sSect, sKeyInd .. '.LiLoad', '', sKitPath) or 0)
return { Tuuid=sTuuid, Tname=sTname, Act=bActive, Cnt=nCnt, OffCnt=-dOffCnt, ZigZagX=nZzX, OffZigZagX=-dOffZzX, StepX=dStepX, ZigZagY=nZzY, OffZigZagY=-dOffZzY,StepY=dStepY,
Spiral=nSpiral, OffSpiral=-dOffSpiral, StepSpiral=dStepSpiral, RadiusSpiral=dRadiusSpiral, DistanceSpiral=dDistanceSpiral, LiLen=dLiLen, LiHeight=dLiHei, LiLoad=dLiLoad}
end
--------------------------------------------------------------------------------
-- Funzione locale per lettura del kit
local function ReadKit( sKitName)
local kCurr = {}
local sSect = 'Kit.' .. sKitName
for nMachInd = 1, 50 do
local mkCurr = ReadMachKit( sSect, nMachInd)
if mkCurr then
table.insert( kCurr, mkCurr)
else
break
end
end
return kCurr
end
--------------------------------------------------------------------------------
-- Funzione per aggiungere le lucidature
function POLI.Add()
-- Recupero il kit
local sKitName = POLI.KITNAME
if not sKitName or sKitName == '' then
POLI.ERR = 20
return
end
-- Recupero il contorno dell'area da lucidare
local nCntId = POLI.CNTID
if not EgtExistsObj( nCntId) then
POLI.ERR = 30
return
end
-- Leggo i dati del kit
local kCurr = ReadKit( sKitName)
if #kCurr == 0 then
POLI.ERR = 40
return
end
-- Applico le lavorazioni
local bOk = true
for i = 1, #kCurr do
-- se attivo
if kCurr[i].Act then
-- contornatura
if kCurr[i].Cnt > 0 then
EgtCreateMachining( 'Cont_'..kCurr[i].Tname, MCH_MY.MILLING, kCurr[i].Tname)
EgtSetMachiningParam( MCH_MP.USERNOTES , 'Polishing')
EgtSetMachiningParam( MCH_MP.STARTPOS, 10)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.GLIDE)
EgtSetMachiningParam( MCH_MP.LITANG, kCurr[i].LiLen)
EgtSetMachiningParam( MCH_MP.LIELEV, kCurr[i].LiHeight)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI)
EgtSetMachiningParam( MCH_MP.OFFSR, kCurr[i].OffCnt)
-- se richiesto un solo giro
if kCurr[i].Cnt == 1 then
EgtSetMachiningParam( MCH_MP.DEPTH, kCurr[i].LiLoad)
-- altrimenti più giri con step di discesa trascurabile
else
local dStep = 0.002
local dAddDepth = kCurr[i].Cnt * dStep
local sUserNotes = 'Polishing;MaxElev=' .. EgtNumToString( dAddDepth, 3) .. ';'
EgtSetMachiningParam( MCH_MP.DEPTH, kCurr[i].LiLoad + dAddDepth)
EgtSetMachiningParam( MCH_MP.STEP, dStep)
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
EgtSetMachiningParam( MCH_MP.STEPTYPE, MCH_MILL_ST.SPIRAL)
end
local AngC = "C=" .. EgtNumToString(90*nPolishingC90,0)
EgtSetMachiningParam( MCH_MP.INITANGS, AngC)
EgtSetMachiningGeometry( {nCntId})
if not EgtApplyMachining() then
bOk = false
end
end
-- svuotature in X
for j = 1, kCurr[i].ZigZagX do
EgtCreateMachining( 'ZigZagX_'..kCurr[i].Tname, MCH_MY.POCKETING, kCurr[i].Tname)
EgtSetMachiningParam( MCH_MP.USERNOTES , 'Polishing')
EgtSetMachiningParam( MCH_MP.STARTPOS, 10)
EgtSetMachiningParam( MCH_MP.DEPTH, kCurr[i].LiLoad)
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.ZIGZAG)
EgtSetMachiningParam( MCH_MP.SIDESTEP, kCurr[i].StepX)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_POCK_LI.GLIDE)
EgtSetMachiningParam( MCH_MP.LITANG, kCurr[i].LiLen)
EgtSetMachiningParam( MCH_MP.LIELEV, kCurr[i].LiHeight)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_POCK_LO.GLIDE)
EgtSetMachiningParam( MCH_MP.LOTANG, kCurr[i].LiLen)
EgtSetMachiningParam( MCH_MP.LOELEV, kCurr[i].LiHeight)
EgtSetMachiningParam( MCH_MP.OFFSR, kCurr[i].OffZigZagX)
EgtSetMachiningParam( MCH_MP.INVERT, (( j % 2) == 0))
local AngC = "C=" .. EgtNumToString(90*nPolishingC90,0)
EgtSetMachiningParam( MCH_MP.INITANGS, AngC)
EgtSetMachiningGeometry( {nCntId})
if not EgtApplyMachining() then
bOk = false
end
end
-- svuotature in Y
for j = 1, kCurr[i].ZigZagY do
EgtCreateMachining( 'ZigZagY_'..kCurr[i].Tname, MCH_MY.POCKETING, kCurr[i].Tname)
EgtSetMachiningParam( MCH_MP.USERNOTES , 'Polishing')
EgtSetMachiningParam( MCH_MP.STARTPOS, 10)
EgtSetMachiningParam( MCH_MP.DEPTH, kCurr[i].LiLoad)
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.ZIGZAG)
EgtSetMachiningParam( MCH_MP.SIDEANGLE, 90)
EgtSetMachiningParam( MCH_MP.SIDESTEP, kCurr[i].StepY)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_POCK_LI.GLIDE)
EgtSetMachiningParam( MCH_MP.LITANG, kCurr[i].LiLen)
EgtSetMachiningParam( MCH_MP.LIELEV, kCurr[i].LiHeight)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_POCK_LO.GLIDE)
EgtSetMachiningParam( MCH_MP.LOTANG, kCurr[i].LiLen)
EgtSetMachiningParam( MCH_MP.LOELEV, kCurr[i].LiHeight)
EgtSetMachiningParam( MCH_MP.OFFSR, kCurr[i].OffZigZagY)
EgtSetMachiningParam( MCH_MP.INVERT, (( j % 2) == 0))
local AngC = "C=" .. EgtNumToString(90*nPolishingC90,0)
EgtSetMachiningParam( MCH_MP.INITANGS, AngC)
EgtSetMachiningGeometry( {nCntId})
if not EgtApplyMachining() then
bOk = false
end
end
-- svuotature a spirale (con epicicli)
for j = 1, kCurr[i].Spiral do
EgtCreateMachining( 'Spiral_'..kCurr[i].Tname, MCH_MY.POCKETING, kCurr[i].Tname)
EgtSetMachiningParam( MCH_MP.USERNOTES , 'Polishing')
EgtSetMachiningParam( MCH_MP.STARTPOS, 10)
EgtSetMachiningParam( MCH_MP.DEPTH, kCurr[i].LiLoad)
EgtSetMachiningParam( MCH_MP.SUBTYPE, EgtIf( ( j % 2) == 0, MCH_POCK_SUB.SPIRALOUT, MCH_POCK_SUB.SPIRALIN))
EgtSetMachiningParam( MCH_MP.SIDEANGLE, 0)
EgtSetMachiningParam( MCH_MP.SIDESTEP, kCurr[i].StepSpiral)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_POCK_LI.GLIDE)
EgtSetMachiningParam( MCH_MP.LITANG, kCurr[i].LiLen)
EgtSetMachiningParam( MCH_MP.LIELEV, kCurr[i].LiHeight)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_POCK_LO.GLIDE)
EgtSetMachiningParam( MCH_MP.LOTANG, kCurr[i].LiLen)
EgtSetMachiningParam( MCH_MP.LOELEV, kCurr[i].LiHeight)
EgtSetMachiningParam( MCH_MP.OFFSR, kCurr[i].OffSpiral)
EgtSetMachiningParam( MCH_MP.INVERT, (( j % 2) == 0))
EgtSetMachiningParam( MCH_MP.EPICYCLESRAD, kCurr[i].RadiusSpiral)
EgtSetMachiningParam( MCH_MP.EPICYCLESDIST, kCurr[i].DistanceSpiral)
local AngC = "C=" .. EgtNumToString(90*nPolishingC90,0)
EgtSetMachiningParam( MCH_MP.INITANGS, AngC)
EgtSetMachiningGeometry( {nCntId})
if not EgtApplyMachining() then
bOk = false
end
end
end
end
POLI.ERR = EgtIf( bOk, 0, 50)
end
--------------------------------------------------------------------------------
-- Funzione per cancellare le lucidature
function POLI.Remove()
-- Elimino tutte le lavorazioni di tipo lucidatura
local nOperId = EgtGetFirstOperation()
while nOperId do
local nNextOperId = EgtGetNextOperation( nOperId)
if EgtGetOperationType( nOperId) ~= MCH_OY.DISP then
EgtSetCurrMachining( nOperId)
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
if sUserNotes and sUserNotes:find( 'Polishing', 1, true) then
EgtErase( nOperId)
end
end
nOperId = nNextOperId
end
end
-93
View File
@@ -1,93 +0,0 @@
# OmagCUT_CamAuto
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
* [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
* [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://gitlab.steamware.net/egalware-cadcam/lua/omagcut_camauto.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
* [Set up project integrations](https://gitlab.steamware.net/egalware-cadcam/lua/omagcut_camauto/-/settings/integrations)
## Collaborate with your team
* [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
* [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
* [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
* [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
* [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
## Test and Deploy
Use the built-in continuous integration in GitLab.
* [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/)
* [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
* [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
* [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
* [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.