OmagCUT :
- correzioni a spianature con fresa (tagli diretti) - migliorie a foro singolo (tagli diretti).
This commit is contained in:
@@ -228,6 +228,7 @@ Module ConstGen
|
|||||||
Public Const INFO_ROUNDOFF As String = "RoundOff"
|
Public Const INFO_ROUNDOFF As String = "RoundOff"
|
||||||
Public Const INFO_DIRECTCUT As String = "DirectCut"
|
Public Const INFO_DIRECTCUT As String = "DirectCut"
|
||||||
Public Const INFO_STEP_TYPE As String = "StepType"
|
Public Const INFO_STEP_TYPE As String = "StepType"
|
||||||
|
Public Const INFO_ENGR_MILL As String = "EngravingWithMill"
|
||||||
' Info in entità da tagliare per taglio ristretto
|
' Info in entità da tagliare per taglio ristretto
|
||||||
Public Const INFO_STRICT As String = "Strict"
|
Public Const INFO_STRICT As String = "Strict"
|
||||||
' Info in entità da tagliare per angolo di lato e tallone
|
' Info in entità da tagliare per angolo di lato e tallone
|
||||||
|
|||||||
@@ -259,7 +259,7 @@
|
|||||||
Public Const K_MACH_MILLING_ON_SINKS As String = "MillingOnSinks"
|
Public Const K_MACH_MILLING_ON_SINKS As String = "MillingOnSinks"
|
||||||
Public Const K_MACH_MILLING_SHORTENING As String = "MillingShortening"
|
Public Const K_MACH_MILLING_SHORTENING As String = "MillingShortening"
|
||||||
Public Const K_MACH_ENGRAVING_WITHMILL As String = "EngravingWithMill"
|
Public Const K_MACH_ENGRAVING_WITHMILL As String = "EngravingWithMill"
|
||||||
Public Const K_MACH_STARTCENERTOOLPATH As String = "StartCenterToolPath"
|
Public Const K_MACH_STARTCENTERTOOLPATH As String = "StartCenterToolPath"
|
||||||
Public Const K_MACH_ENGRAVING_DEPTH As String = "EngravingDepth"
|
Public Const K_MACH_ENGRAVING_DEPTH As String = "EngravingDepth"
|
||||||
Public Const K_MACH_ENGRAVING_WIDTH As String = "EngravingWidth"
|
Public Const K_MACH_ENGRAVING_WIDTH As String = "EngravingWidth"
|
||||||
Public Const K_MACH_WATERJET_OPTIMIZE As String = "WjOptimize"
|
Public Const K_MACH_WATERJET_OPTIMIZE As String = "WjOptimize"
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ Public Class FlatteningCut
|
|||||||
OkBtn.ToolTip = EgtMsg(90230) ' Esegui
|
OkBtn.ToolTip = EgtMsg(90230) ' Esegui
|
||||||
' tipo di utensile in uso per la lavorazione
|
' tipo di utensile in uso per la lavorazione
|
||||||
m_ToolsArray(TOOL.SAW) = EgtMsg(90224) ' Lama
|
m_ToolsArray(TOOL.SAW) = EgtMsg(90224) ' Lama
|
||||||
m_ToolsArray(TOOL.MILL) = EgtMsg(91237) ' Mill
|
m_ToolsArray(TOOL.MILL) = EgtMsg(91237) ' Fresa
|
||||||
SelToolCmBx.ItemsSource = m_ToolsArray
|
SelToolCmBx.ItemsSource = m_ToolsArray
|
||||||
' Carico i dati dell'ultimo taglio
|
' Carico i dati dell'ultimo taglio
|
||||||
m_dDepth = GetPrivateProfileDouble(S_DIRECTCUTS, K_DC_FLATT_DEPTH, m_dDepth, m_MainWindow.GetIniFile())
|
m_dDepth = GetPrivateProfileDouble(S_DIRECTCUTS, K_DC_FLATT_DEPTH, m_dDepth, m_MainWindow.GetIniFile())
|
||||||
@@ -186,7 +186,7 @@ Public Class FlatteningCut
|
|||||||
TypeCmBx.SelectedIndex = m_nMachType
|
TypeCmBx.SelectedIndex = m_nMachType
|
||||||
RotLockChBx.IsChecked = m_bRotLock
|
RotLockChBx.IsChecked = m_bRotLock
|
||||||
ChainedPathChBx.IsChecked = m_bChainedPath
|
ChainedPathChBx.IsChecked = m_bChainedPath
|
||||||
' Assegno l'utensile in definito in macchina per la fresatura
|
' Assegno l'utensile definito in macchina per la fresatura
|
||||||
SelToolCmBx.SelectedIndex = m_nTool
|
SelToolCmBx.SelectedIndex = m_nTool
|
||||||
' Reset taglio e disabilito bottone esecuzione
|
' Reset taglio e disabilito bottone esecuzione
|
||||||
m_bCutOk = False
|
m_bCutOk = False
|
||||||
@@ -339,7 +339,7 @@ Public Class FlatteningCut
|
|||||||
m_dAngO = dTAngO + 90
|
m_dAngO = dTAngO + 90
|
||||||
DirectionTxBx.Text = DoubleToString(m_dAngO - m_MainWindow.m_CurrentMachine.dDeltaC, 2)
|
DirectionTxBx.Text = DoubleToString(m_dAngO - m_MainWindow.m_CurrentMachine.dDeltaC, 2)
|
||||||
|
|
||||||
' Altrimenti da disegno
|
' Altrimenti da disegno
|
||||||
Else
|
Else
|
||||||
' Assegno punto selezionato nel disegno a m_ptTipP1
|
' Assegno punto selezionato nel disegno a m_ptTipP1
|
||||||
m_ptTipP1 = m_ptPrev
|
m_ptTipP1 = m_ptPrev
|
||||||
@@ -493,11 +493,9 @@ Public Class FlatteningCut
|
|||||||
' Recupero il valore di larghezza impostato
|
' Recupero il valore di larghezza impostato
|
||||||
Dim dWidth As Double = 0
|
Dim dWidth As Double = 0
|
||||||
StringToLen(WidthTxBx.Text, dWidth)
|
StringToLen(WidthTxBx.Text, dWidth)
|
||||||
' Recupero lo spessore della lama corrente
|
' Recupero l'impronta dell'utensile corrente
|
||||||
EgtTdbSetCurrTool(m_MainWindow.m_CurrentMachine.sCurrSaw)
|
Dim dThick As Double = GetToolFootprint()
|
||||||
Dim dThick As Double = GetFootPrintTool()
|
' La larghezza della spianatura non può essere inferiore all'impronta dell'utensile (spessore per lama, diametro per fresa)
|
||||||
'EgtTdbGetCurrToolParam(MCH_TP.THICK, dThick)
|
|
||||||
' La larghezza della spianatura nono può essere inferiore allo spessore della lama
|
|
||||||
m_dWid = Math.Max(dWidth, dThick)
|
m_dWid = Math.Max(dWidth, dThick)
|
||||||
WidthTxBx.Text = LenToString(m_dWid, 2)
|
WidthTxBx.Text = LenToString(m_dWid, 2)
|
||||||
' Disegno il taglio
|
' Disegno il taglio
|
||||||
@@ -523,8 +521,7 @@ Public Class FlatteningCut
|
|||||||
|
|
||||||
Private Sub OverlapTxBx_EgtClosed(sender As Object, e As EventArgs) Handles OverlapTxBx.EgtClosed
|
Private Sub OverlapTxBx_EgtClosed(sender As Object, e As EventArgs) Handles OverlapTxBx.EgtClosed
|
||||||
' Recupero spessore della lama correntemente attiva
|
' Recupero spessore della lama correntemente attiva
|
||||||
Dim dThick As Double = GetFootPrintTool()
|
Dim dThick As Double = GetToolFootprint()
|
||||||
'EgtTdbGetCurrToolParam(MCH_TP.THICK, dThick)
|
|
||||||
' Verifico che la sovrapposizione non sia superiore allo spessore della lama (meno 1mm di offset)
|
' Verifico che la sovrapposizione non sia superiore allo spessore della lama (meno 1mm di offset)
|
||||||
Dim dOverlap As Double = 0
|
Dim dOverlap As Double = 0
|
||||||
Const MIN_OFFSET As Double = 1.0
|
Const MIN_OFFSET As Double = 1.0
|
||||||
@@ -684,23 +681,26 @@ Public Class FlatteningCut
|
|||||||
m_MainWindow.m_DirectCutPageUC.m_ControlsDirectCutUC.LeftButtonGrid.Children.Remove(Me)
|
m_MainWindow.m_DirectCutPageUC.m_ControlsDirectCutUC.LeftButtonGrid.Children.Remove(Me)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
' ricavo l'ingombro di lavorazione in funzione dell'utensile selezionato
|
' ricavo impronta di lavorazione (in larghezza) in funzione dell'utensile selezionato
|
||||||
Private Function GetFootPrintTool() As Double
|
Private Function GetToolFootprint() As Double
|
||||||
' vedere nella pagina Allarm il capito "Incisioni"
|
|
||||||
Dim bForceUseMill As Boolean = (m_nTool = TOOL.MILL)
|
|
||||||
Dim dFootPrint As Double = 0
|
Dim dFootPrint As Double = 0
|
||||||
' verifico quale lavorazione è attiva
|
' se richiesta lama
|
||||||
If Not String.IsNullOrEmpty(m_MainWindow.m_CurrentMachine.sCurrSawing) AndAlso Not bForceUseMill Then
|
If m_nTool <> TOOL.MILL Then
|
||||||
Dim bSetTool As Boolean = EgtTdbSetCurrTool(m_MainWindow.m_CurrentMachine.sCurrSaw)
|
If EgtTdbSetCurrTool(m_MainWindow.m_CurrentMachine.sCurrSaw) Then
|
||||||
If Not bSetTool Then EgtOutLog("Erro nel settaggio utensile lama " & m_MainWindow.m_CurrentMachine.sCurrSaw)
|
EgtTdbGetCurrToolParam(MCH_TP.THICK, dFootPrint)
|
||||||
EgtTdbGetCurrToolParam(MCH_TP.THICK, dFootPrint)
|
Else
|
||||||
ElseIf Not String.IsNullOrEmpty(m_MainWindow.m_CurrentMachine.sCurrMilling) Then
|
EgtOutLog("In ToolDB missing saw " & m_MainWindow.m_CurrentMachine.sCurrSaw)
|
||||||
|
End If
|
||||||
|
' altrimenti è richiesta fresa
|
||||||
|
Else
|
||||||
Dim sCurrMill = m_MainWindow.m_CurrentMachine.sCurrMill
|
Dim sCurrMill = m_MainWindow.m_CurrentMachine.sCurrMill
|
||||||
'GetDrillFromDrilling(sCurrMill, m_MainWindow.m_CurrentMachine.sCurrMilling)
|
If String.IsNullOrWhiteSpace( sCurrMill) Then sCurrMill = GetMillFromMilling(m_MainWindow.m_CurrentMachine.sCurrMilling)
|
||||||
GetMillFromMilling(sCurrMill, m_MainWindow.m_CurrentMachine.sCurrMilling)
|
|
||||||
' recupero informazioni della fresa in uso
|
' recupero informazioni della fresa in uso
|
||||||
EgtTdbSetCurrTool(sCurrMill)
|
If EgtTdbSetCurrTool(sCurrMill) Then
|
||||||
EgtTdbGetCurrToolParam(MCH_TP.DIAM, dFootPrint)
|
EgtTdbGetCurrToolParam(MCH_TP.DIAM, dFootPrint)
|
||||||
|
Else
|
||||||
|
EgtOutLog("In ToolDB missing mill " & m_MainWindow.m_CurrentMachine.sCurrSaw)
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
Return dFootPrint
|
Return dFootPrint
|
||||||
End Function
|
End Function
|
||||||
@@ -718,35 +718,40 @@ Public Class FlatteningCut
|
|||||||
' Disattivo eventuali lavorazioni presenti
|
' Disattivo eventuali lavorazioni presenti
|
||||||
DeactivateAllMachinings()
|
DeactivateAllMachinings()
|
||||||
' Creo nuovo pezzo per il taglio diretto
|
' Creo nuovo pezzo per il taglio diretto
|
||||||
Dim nPartId = EgtCreateGroup(GDB_ID.ROOT)
|
Dim nPartId As Integer = EgtCreateGroup(GDB_ID.ROOT)
|
||||||
EgtSetName(nPartId, NAME_DIRECTCUT)
|
EgtSetName(nPartId, NAME_DIRECTCUT)
|
||||||
Dim nLayerId = EgtCreateGroup(nPartId)
|
Dim nLayerId As Integer = EgtCreateGroup(nPartId)
|
||||||
' EgtSetName(nLayerId, NAME_OUTLOOP)
|
|
||||||
EgtSetName(nLayerId, NAME_ONPATH)
|
EgtSetName(nLayerId, NAME_ONPATH)
|
||||||
' Creo il taglio
|
' Creo il taglio
|
||||||
Dim ptStart As Point3d = m_ptTipP1
|
Dim ptStart As Point3d = m_ptTipP1
|
||||||
ptStart.z = 0
|
ptStart.z = 0
|
||||||
Dim nCutId = EgtCreateLinePDL(nLayerId, ptStart, m_dAngO, m_dLen)
|
Dim nCutId As Integer = EgtCreateLinePDL(nLayerId, ptStart, m_dAngO, m_dLen)
|
||||||
' Inidico che è un taglio Diretto di tipo Flattening
|
' Indico che è un taglio Diretto di tipo Flattening
|
||||||
EgtSetInfo(nCutId, INFO_DIRECTCUT, FlagDirectCuts.Flattening)
|
EgtSetInfo(nCutId, INFO_DIRECTCUT, FlagDirectCuts.Flattening)
|
||||||
|
EgtSetInfo(nCutId, INFO_ENGR_MILL, m_nTool)
|
||||||
' Imposto affondamento e angolo di fianco sul taglio
|
' Imposto affondamento e angolo di fianco sul taglio
|
||||||
EgtSetInfo(nCutId, INFO_DEPTH, m_dDepth)
|
EgtSetInfo(nCutId, INFO_DEPTH, m_dDepth)
|
||||||
If (m_nTool = TOOL.MILL) Then
|
Dim dThick As Double = GetToolFootprint()
|
||||||
EgtSetInfo(nCutId, INFO_WIDTH, GetFootPrintTool)
|
EgtSetInfo(nCutId, INFO_WIDTH, dThick)
|
||||||
End If
|
|
||||||
EgtSetInfo(nCutId, INFO_SIDE_ANGLE, 0)
|
EgtSetInfo(nCutId, INFO_SIDE_ANGLE, 0)
|
||||||
' Imposto prima direzione
|
' Imposto prima direzione
|
||||||
EgtSetInfo(nCutId, INFO_DIR, 1)
|
EgtSetInfo(nCutId, INFO_DIR, 1)
|
||||||
' Imposto se iniziare la fresatura dal punto indicato
|
' Eventuale riduzione lavorazione
|
||||||
Dim bReducePath As Boolean = Not GetPrivateProfileInt(S_MACH_NEST, K_MACH_STARTCENERTOOLPATH, 0, m_MainWindow.GetMachIniFile()) <> 0
|
Dim bReducePath As Boolean = ( GetPrivateProfileInt(S_MACH_NEST, K_MACH_STARTCENTERTOOLPATH, 0, m_MainWindow.GetMachIniFile()) = 0)
|
||||||
If Not bReducePath Then EgtSetInfo(nCutId, INFO_STRICT, 0)
|
' Per fresatura eventuale riduzione della geometria
|
||||||
|
If m_nTool = TOOL.MILL Then
|
||||||
|
If bReducePath Then ExtendLenghtMillPath(nCutId, -dThick / 2)
|
||||||
|
EgtSetInfo(nCutId, INFO_STRICT, 0)
|
||||||
|
' per tagli con lama eventuale riduzione della lavorazione
|
||||||
|
Else
|
||||||
|
EgtSetInfo(nCutId, INFO_STRICT, If( bReducePath, 3, 0))
|
||||||
|
End If
|
||||||
' Eventuale bloccaggio rotazione asse C tra le passate
|
' Eventuale bloccaggio rotazione asse C tra le passate
|
||||||
If RotLockChBx.IsChecked Then
|
If RotLockChBx.IsChecked Then
|
||||||
EgtSetInfo(nCutId, INFO_ENABLE_INVERT, False)
|
EgtSetInfo(nCutId, INFO_ENABLE_INVERT, False)
|
||||||
End If
|
End If
|
||||||
EgtSetInfo(nCutId, INFO_STEP_TYPE, m_nMachType)
|
EgtSetInfo(nCutId, INFO_STEP_TYPE, m_nMachType)
|
||||||
' Funzione che crea i tagli successivi al primo
|
' Funzione che crea eventuali tagli successivi al primo
|
||||||
MultiplyCut(nLayerId, nCutId)
|
MultiplyCut(nLayerId, nCutId)
|
||||||
' Creo layer per crocetta di riferimento
|
' Creo layer per crocetta di riferimento
|
||||||
Dim nCrossLayerId = EgtCreateGroup(nPartId)
|
Dim nCrossLayerId = EgtCreateGroup(nPartId)
|
||||||
@@ -778,131 +783,78 @@ Public Class FlatteningCut
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function MultiplyCut(nLayerId As Integer, nCutId As Integer) As Boolean
|
Private Function MultiplyCut(nLayerId As Integer, nCutId As Integer) As Boolean
|
||||||
Dim bEngWithMill As Boolean = (m_nTool = TOOL.MILL)
|
|
||||||
Dim bReducePath As Boolean = Not GetPrivateProfileInt(S_MACH_NEST, K_MACH_STARTCENERTOOLPATH, 0, m_MainWindow.GetMachIniFile()) <> 0
|
|
||||||
|
|
||||||
' Recupero spessore della lama (utensile) correntemente attiva
|
' Recupero impronta della lama o fresa utilizzata
|
||||||
Dim dThick As Double = GetFootPrintTool()
|
Dim dThick As Double = GetToolFootprint()
|
||||||
If dThick = 0 Then Return False
|
If dThick = 0 Then Return False
|
||||||
|
|
||||||
' Salvo la prima curva nella lista dei percorsi da concatenare
|
' Salvo la curva originale nella lista dei percorsi da concatenare
|
||||||
Dim CutsList As New List(Of Integer)
|
Dim CutsList As New List(Of Integer)
|
||||||
CutsList.Add(nCutId)
|
CutsList.Add(nCutId)
|
||||||
|
|
||||||
' Imposto angolo di rotazione a seconda del lato dei tagli
|
' Imposto angolo di rotazione a seconda del lato dei tagli
|
||||||
Dim dRotAngO As Double = If(SideChBx.IsChecked(), -90, 90)
|
Dim dRotAngO As Double = If(SideChBx.IsChecked(), -90, 90)
|
||||||
' Definisco vettore di spostamento
|
|
||||||
Dim vtDelta As Vector3d
|
|
||||||
vtDelta = Vector3d.FromPolar(1, m_dAngO)
|
|
||||||
vtDelta.Rotate(Vector3d.Z_AX, dRotAngO)
|
|
||||||
|
|
||||||
' Calcolo numero di iterazioni necessarie a coprire l'area impostata e lunghezza vettore delta
|
' Calcolo numero di passate necessarie a coprire l'area impostata e lunghezza vettore delta
|
||||||
Dim nStepNum As Integer
|
Dim dDelta As Double = dThick - m_dOverlap
|
||||||
Dim dDelta As Double
|
Dim dWidth As Double = m_dWid - dThick
|
||||||
Dim dWidth As Double = m_dWid
|
Dim nStepNum As Integer = CInt(Math.Ceiling(dWidth / dDelta)) + 1
|
||||||
dDelta = dThick - m_dOverlap
|
If nStepNum > 1 Then dDelta = dWidth / (nStepNum - 1)
|
||||||
dWidth -= dThick
|
' Definisco vettore di spostamento
|
||||||
nStepNum = CInt(Math.Ceiling(dWidth / dDelta)) + 1
|
Dim vtDelta As Vector3d = Vector3d.FromPolar(dDelta, m_dAngO)
|
||||||
If nStepNum > 1 Then
|
vtDelta.Rotate(Vector3d.Z_AX, dRotAngO)
|
||||||
dDelta = dWidth / (nStepNum - 1)
|
' Creo le ripetizioni
|
||||||
End If
|
|
||||||
' definisco la larghezza dell'utensile (solo per la fresa)
|
|
||||||
EgtSetInfo(nCutId, INFO_WIDTH, dThick)
|
|
||||||
' definisco il tipo di utensile da utilizzare
|
|
||||||
EgtSetInfo(nCutId, "EngravingWithMill", m_nTool)
|
|
||||||
' Creo vettore delta
|
|
||||||
vtDelta *= dDelta
|
|
||||||
' Creo indice per impostare info che indica tipologia di spianatura
|
|
||||||
Dim nTypeIndex As Integer = 1
|
|
||||||
For Index As Integer = 1 To nStepNum - 1
|
For Index As Integer = 1 To nStepNum - 1
|
||||||
Dim vtPerpMove As Vector3d = Index * vtDelta
|
Dim vtPerpMove As Vector3d = Index * vtDelta
|
||||||
' Creo copie
|
' Creo copie
|
||||||
Dim nCut2Id = EgtCopyGlob(nCutId, nLayerId)
|
Dim nCut2Id = EgtCopyGlob(nCutId, nLayerId)
|
||||||
EgtSetInfo(nCut2Id, INFO_WIDTH, dThick)
|
|
||||||
EgtSetInfo(nCutId, "EngravingWithMill", m_nTool)
|
|
||||||
' Assegno info direzione a seconda del tipo di spianatura
|
|
||||||
If TypeCmBx.SelectedIndex = MACH_TYPE.ZIGZAG Then
|
|
||||||
If nTypeIndex = 1 Then
|
|
||||||
EgtSetInfo(nCut2Id, INFO_DIR, 2)
|
|
||||||
nTypeIndex = 2
|
|
||||||
Else
|
|
||||||
EgtSetInfo(nCut2Id, INFO_DIR, 1)
|
|
||||||
nTypeIndex = 1
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
EgtSetInfo(nCut2Id, INFO_DIR, 1)
|
|
||||||
End If
|
|
||||||
EgtMove(nCut2Id, vtPerpMove, GDB_RT.GLOB)
|
EgtMove(nCut2Id, vtPerpMove, GDB_RT.GLOB)
|
||||||
|
' Assegno info direzione a seconda del tipo di spianatura
|
||||||
' ----------------------- CREO SEGMENTI PER CONCATENAMENTO CURVE -----------------------
|
Dim nDir As Integer = 1
|
||||||
If m_bChainedPath And bEngWithMill Then
|
If TypeCmBx.SelectedIndex = MACH_TYPE.ZIGZAG And Index Mod 2 <> 0 Then nDir = 2
|
||||||
If bReducePath Then
|
EgtSetInfo(nCut2Id, INFO_DIR, nDir)
|
||||||
If Index < nStepNum - 1 Then
|
' Inserisco nell'elenco delle curve eventualmente da concatenare
|
||||||
ExtendLenghtMillPath(nCut2Id, -dThick / 2)
|
CutsList.Add(nCut2Id)
|
||||||
ElseIf Index = nStepNum - 1 Then
|
|
||||||
If nStepNum Mod 2 = 0 Then
|
|
||||||
ExtendLenghtMillPath(nCut2Id, -dThick / 2, False, True)
|
|
||||||
Else
|
|
||||||
ExtendLenghtMillPath(nCut2Id, -dThick / 2, True, False)
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
CutsList.Add(nCut2Id)
|
|
||||||
End If
|
|
||||||
' ----------------------- CREO SEGMENTI PER CONCATENAMENTO CURVE -----------------------
|
|
||||||
|
|
||||||
Next
|
Next
|
||||||
|
|
||||||
' ----------------------- CREO UN UNICO PERCORSO CONCATENATO -----------------------
|
' Se fresatura e richiesto percorso concatenato
|
||||||
If m_bChainedPath And bEngWithMill Then
|
If m_nTool = TOOL.MILL And m_bChainedPath Then
|
||||||
' Decidere se accorciare i tagli del valore del raggio utensile!
|
' Trasformo la prima curva in composita (copiando tutte le info)
|
||||||
If bReducePath Then
|
Dim vsInfo As String() = Nothing
|
||||||
ExtendLenghtMillPath(CutsList(0), -dThick / 2, False, True)
|
EgtGetAllInfo( CutsList(0), vsInfo)
|
||||||
End If
|
Dim nCompoCrv As Integer = EgtCreateCurveCompo(nLayerId, CutsList(0), True)
|
||||||
For Index As Integer = 0 To CutsList.Count - 2
|
For Each sInfo As String In vsInfo
|
||||||
If Index Mod 2 <> 0 Then
|
Dim KeyAndVal As String() = sInfo.Split( "=".ToCharArray)
|
||||||
' Costruisco la linea di collegamento tra due curve adiacenti
|
If KeyAndVal.Count() >= 2 Then EgtSetInfo( nCompoCrv, KeyAndVal(0), KeyAndVal(1))
|
||||||
Dim PtStart_1 As Point3d
|
Next
|
||||||
EgtStartPoint(CutsList(Index), GDB_RT.GLOB, PtStart_1)
|
' Accodo opportunamente le curve successive
|
||||||
Dim PtStart_2 As Point3d
|
For Index As Integer = 1 To CutsList.Count - 1
|
||||||
EgtStartPoint(CutsList(Index + 1), GDB_RT.GLOB, PtStart_2)
|
' Inverto le curve di ritorno (di indice dispari in lista)
|
||||||
CutsList.Add(EgtCreateLine(nLayerId, PtStart_1, PtStart_2))
|
If Index Mod 2 <> 0 Then EgtInvertCurve( CutsList(Index))
|
||||||
Else
|
' Aggiungo il collegamento
|
||||||
' Costruisco la linea di collegamento tra due curve adiacenti
|
Dim ptStart As Point3d
|
||||||
Dim PtStart_1 As Point3d
|
EgtStartPoint(CutsList(Index), CutsList(Index), ptStart)
|
||||||
EgtEndPoint(CutsList(Index), GDB_RT.GLOB, PtStart_1)
|
EgtAddCurveCompoLine( nCompoCrv, ptStart)
|
||||||
Dim PtStart_2 As Point3d
|
' Aggiungo la curva
|
||||||
EgtEndPoint(CutsList(Index + 1), GDB_RT.GLOB, PtStart_2)
|
EgtAddCurveCompoCurve( nCompoCrv, CutsList(Index), true)
|
||||||
CutsList.Add(EgtCreateLine(nLayerId, PtStart_1, PtStart_2))
|
|
||||||
End If
|
|
||||||
Next
|
Next
|
||||||
Dim ptNear As Point3d
|
|
||||||
EgtStartPoint(CutsList(0), ptNear)
|
|
||||||
Dim IdJointCurv As Integer = EgtCreateCurveCompoByChain(nLayerId, CutsList.ToArray, ptNear, True)
|
|
||||||
' Inidico che è un taglio Diretto di tipo Flattening
|
|
||||||
EgtSetInfo(IdJointCurv, INFO_DIRECTCUT, FlagDirectCuts.Flattening)
|
|
||||||
EgtSetInfo(IdJointCurv, INFO_STEP_TYPE, m_nMachType)
|
|
||||||
EgtSetInfo(IdJointCurv, INFO_WIDTH, dThick)
|
|
||||||
' Se unisco il percorso devo per forza usare la fresa!
|
|
||||||
EgtSetInfo(IdJointCurv, "EngravingWithMill", 1)
|
|
||||||
If Not bReducePath Then EgtSetInfo(IdJointCurv, INFO_STRICT, 0)
|
|
||||||
End If
|
End If
|
||||||
' ----------------------- CREO UN UNICO PERCORSO CONCATENATO -----------------------
|
|
||||||
|
|
||||||
Return True
|
Return True
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Sub ExtendLenghtMillPath(ByVal IdCurv As Integer, ByVal ReduceVal As Double,
|
Private Sub ExtendLenghtMillPath(IdCurv As Integer, dExtend As Double,
|
||||||
ByVal Optional bStart As Boolean = True, ByVal Optional bEnd As Boolean = True)
|
Optional bStart As Boolean = True, Optional bEnd As Boolean = True)
|
||||||
Dim PtStart As Point3d
|
If bStart Then
|
||||||
EgtStartPoint(IdCurv, GDB_RT.GLOB, PtStart)
|
Dim ptStart As Point3d
|
||||||
Dim PtEnd As Point3d
|
EgtStartPoint(IdCurv, IdCurv, ptStart)
|
||||||
EgtEndPoint(IdCurv, GDB_RT.GLOB, PtEnd)
|
EgtTrimExtendCurveByLen(IdCurv, dExtend, ptStart)
|
||||||
If bStart Then EgtTrimExtendCurveByLen(IdCurv, ReduceVal, PtStart, GDB_RT.GLOB)
|
End If
|
||||||
If bEnd Then EgtTrimExtendCurveByLen(IdCurv, ReduceVal, PtEnd, GDB_RT.GLOB)
|
If bEnd Then
|
||||||
Dim dLenLine As Double
|
Dim ptEnd As Point3d
|
||||||
EgtCurveLength(IdCurv, dLenLine)
|
EgtEndPoint(IdCurv, IdCurv, ptEnd)
|
||||||
EgtOutLog("Lunghezza segmento ridotto: " & dLenLine.ToString)
|
EgtTrimExtendCurveByLen(IdCurv, dExtend, ptEnd)
|
||||||
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function CreateCross(nLayerId As Integer, ptP As Point3d) As Boolean
|
Private Function CreateCross(nLayerId As Integer, ptP As Point3d) As Boolean
|
||||||
|
|||||||
@@ -72,13 +72,14 @@ Public Class SingleDrillUC
|
|||||||
|
|
||||||
Private Sub SingleDrill_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
Private Sub SingleDrill_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||||
m_sCurrDrill = m_CurrentMachine.sCurrDrill
|
m_sCurrDrill = m_CurrentMachine.sCurrDrill
|
||||||
GetDrillFromDrilling(m_sCurrDrill, m_CurrentMachine.sCurrDrilling)
|
If String.IsNullOrWhiteSpace(m_sCurrDrill) Then m_sCurrDrill = GetDrillFromDrilling(m_CurrentMachine.sCurrDrilling)
|
||||||
' rimuovo utensile su uscite 1
|
' rimuovo utensile su uscite 1
|
||||||
EgtSetCalcTool("", "H1", 1)
|
EgtSetCalcTool("", "H1", 1)
|
||||||
' imposto utensile su uscita 2
|
' imposto utensile su uscita 2
|
||||||
EgtSetCalcTool(m_sCurrDrill, "H1", 2)
|
EgtSetCalcTool(m_sCurrDrill, "H1", 2)
|
||||||
' recupero informazioni del foretto usato
|
' recupero informazioni del foretto usato
|
||||||
EgtTdbSetCurrTool(m_sCurrDrill)
|
EgtTdbSetCurrTool(m_sCurrDrill)
|
||||||
|
m_dDiameter = 0
|
||||||
EgtTdbGetCurrToolParam(MCH_TP.DIAM, m_dDiameter)
|
EgtTdbGetCurrToolParam(MCH_TP.DIAM, m_dDiameter)
|
||||||
|
|
||||||
' Attivo la pagina
|
' Attivo la pagina
|
||||||
@@ -412,34 +413,34 @@ Public Class SingleDrillUC
|
|||||||
EgtEmptyGroup(m_nTempLay)
|
EgtEmptyGroup(m_nTempLay)
|
||||||
' Spessore grezzo
|
' Spessore grezzo
|
||||||
Dim dRawHeight As Double = m_ptRawMax.z - m_ptRawMin.z
|
Dim dRawHeight As Double = m_ptRawMax.z - m_ptRawMin.z
|
||||||
' Recupero spessore lama corrente
|
' Recupero diametro foretto corrente
|
||||||
Dim sDrill As String = m_sCurrDrill
|
Dim sDrill As String = m_sCurrDrill
|
||||||
GetDrillFromDrilling(sDrill, m_MainWindow.m_CurrentMachine.sCurrDrilling)
|
If String.IsNullOrWhiteSpace( sDrill) Then sDrill = GetDrillFromDrilling(m_MainWindow.m_CurrentMachine.sCurrDrilling)
|
||||||
EgtTdbSetCurrTool(sDrill)
|
EgtTdbSetCurrTool(sDrill)
|
||||||
Dim dDiam As Double = 0
|
m_dDiameter = 0
|
||||||
EgtTdbGetCurrToolParam(MCH_TP.DIAM, dDiam)
|
EgtTdbGetCurrToolParam(MCH_TP.DIAM, m_dDiameter)
|
||||||
' Rimuovo eventuale vecchio pezzo per taglio diretto
|
' Rimuovo eventuale vecchio pezzo per taglio diretto
|
||||||
EraseDirectCutPart()
|
EraseDirectCutPart()
|
||||||
' Disattivo eventuali lavorazioni presenti
|
' Disattivo eventuali lavorazioni presenti
|
||||||
DeactivateAllMachinings()
|
DeactivateAllMachinings()
|
||||||
|
|
||||||
' Creo nuovo pezzo per il taglio diretto
|
' Creo nuovo pezzo per il taglio diretto
|
||||||
Dim nPartId = CreateDirectCutPart()
|
Dim nPartId As Integer = CreateDirectCutPart()
|
||||||
Dim nLayerId = EgtCreateGroup(nPartId)
|
Dim nLayerId As Integer = EgtCreateGroup(nPartId)
|
||||||
EgtSetName(nLayerId, NAME_INLOOP)
|
EgtSetName(nLayerId, NAME_INLOOP)
|
||||||
' Creo il Drill
|
' Creo il Drill
|
||||||
Dim ptStart As Point3d = m_ptTipP1
|
Dim ptStart As Point3d = m_ptTipP1
|
||||||
ptStart.z = 0
|
ptStart.z = 0
|
||||||
|
|
||||||
' Creo layer per crocetta di riferimento
|
' Creo layer per crocetta di riferimento
|
||||||
Dim nCrossLayerId = EgtCreateGroup(nPartId)
|
Dim nCrossLayerId As Integer = EgtCreateGroup(nPartId)
|
||||||
' Aggiungo crocetta/e
|
' Aggiungo crocetta/e
|
||||||
If m_bPointP1Ok Then
|
If m_bPointP1Ok Then
|
||||||
CreateCross(nCrossLayerId, ptStart)
|
CreateCross(nCrossLayerId, ptStart)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim nCutId = EgtCreateCircle(nLayerId, ptStart, m_dDiameter / 2)
|
Dim nCutId = EgtCreateCircle(nLayerId, ptStart, m_dDiameter / 2)
|
||||||
' Inidico che è un taglio Diretto di tipo SingleDrill
|
' Indico che è un taglio Diretto di tipo SingleDrill
|
||||||
EgtSetInfo(nCutId, INFO_DIRECTCUT, FlagDirectCuts.SingleDrill)
|
EgtSetInfo(nCutId, INFO_DIRECTCUT, FlagDirectCuts.SingleDrill)
|
||||||
' Calcolo punto di inserimento nel grezzo
|
' Calcolo punto di inserimento nel grezzo
|
||||||
Dim ptMin, ptMax As Point3d
|
Dim ptMin, ptMax As Point3d
|
||||||
|
|||||||
+59
-68
@@ -1,9 +1,6 @@
|
|||||||
Imports System.Globalization
|
Imports System.Globalization
|
||||||
Imports System.Diagnostics
|
|
||||||
Imports System.Collections.ObjectModel
|
|
||||||
Imports System.Text.RegularExpressions
|
|
||||||
Imports EgtWPFLib
|
|
||||||
Imports EgtUILib
|
Imports EgtUILib
|
||||||
|
Imports EgtWPFLib
|
||||||
|
|
||||||
Module Utility
|
Module Utility
|
||||||
Friend Function CompoColor(sIniFile As String) As Color3d
|
Friend Function CompoColor(sIniFile As String) As Color3d
|
||||||
@@ -401,76 +398,70 @@ Module Utility
|
|||||||
Return BackBottomColor
|
Return BackBottomColor
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Sub GetDrillFromDrilling(ByRef sCurrDrill As String, ByVal sCurrDrilling As String)
|
Public Function GetDrillFromDrilling(sCurrDrilling As String) As String
|
||||||
If String.IsNullOrEmpty(sCurrDrill) Or String.IsNullOrWhiteSpace(sCurrDrill) Then
|
' Se foratura non definita, esco subito
|
||||||
' creo l'elenco degli utensili di foratura
|
If String.IsNullOrWhiteSpace(sCurrDrilling) Then Return ""
|
||||||
Dim sToolName As String = String.Empty
|
' Salvo lavorazione e utensile correnti
|
||||||
Dim nType As Integer = MCH_TY.NONE
|
Dim sPrevMach As String = ""
|
||||||
Dim DrillToolList As New ObservableCollection(Of String)
|
EgtMdbGetCurrMachiningParam(MCH_MP.NAME, sPrevMach)
|
||||||
DrillToolList.Clear()
|
Dim sPrevTool As String = ""
|
||||||
If EgtTdbGetFirstTool(MCH_TF.DRILLBIT, sToolName, nType) Then
|
EgtTdbGetCurrToolParam(MCH_TP.NAME, sPrevTool)
|
||||||
DrillToolList.Add(sToolName)
|
' Inizializzo nome utensile a nessuno
|
||||||
While EgtTdbGetNextTool(MCH_TF.DRILLBIT, sToolName, nType)
|
Dim sCurrDrill As String = ""
|
||||||
DrillToolList.Add(sToolName)
|
' Se esiste la lavorazione
|
||||||
End While
|
If EgtMdbSetCurrMachining(sCurrDrilling) Then
|
||||||
|
' recupero il nome dell'utensile della lavorazione
|
||||||
|
Dim sTuuid As String = ""
|
||||||
|
Dim sToolName As String = ""
|
||||||
|
If Not EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTuuid) OrElse
|
||||||
|
Not EgtTdbGetToolFromUUID(sTuuid, sToolName) Then
|
||||||
|
EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, sToolName)
|
||||||
End If
|
End If
|
||||||
' recupero l'utensile associato alla lavorazione
|
' ne verifico il tipo
|
||||||
'Dim sCurrDrilling As String = m_MainWindow.m_CurrentMachine.sCurrDrilling
|
Dim nToolType As Integer = MCH_TY.NONE
|
||||||
Dim ToolString As String = String.Empty
|
If EgtTdbSetCurrTool( sToolName) AndAlso
|
||||||
EgtMdbSetCurrMachining(sCurrDrilling)
|
EgtTdbGetCurrToolParam( MCH_TP.TYPE, nToolType) AndAlso ( nToolType And MCH_TF.DRILLBIT) <> 0 Then
|
||||||
' Recupero nome utensile tramite TUUID
|
sCurrDrill = sToolName
|
||||||
Dim sTuuid As String = String.Empty
|
|
||||||
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTuuid)
|
|
||||||
EgtTdbGetToolFromUUID(sTuuid, ToolString)
|
|
||||||
Dim bToolExist As Boolean = False
|
|
||||||
For Each CurrTool As IEnumerable In DrillToolList
|
|
||||||
If CurrTool.ToString() = ToolString Then
|
|
||||||
bToolExist = True
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
If bToolExist Then
|
|
||||||
sCurrDrill = ToolString
|
|
||||||
Else
|
|
||||||
sCurrDrill = String.Empty
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End Sub
|
' Ripristino lavorazione e utensile correnti
|
||||||
|
EgtMdbSetCurrMachining(sPrevMach)
|
||||||
|
EgtTdbSetCurrTool(sPrevTool)
|
||||||
|
' Restituisco il nome dell'utensile
|
||||||
|
Return sCurrDrill
|
||||||
|
End Function
|
||||||
|
|
||||||
Public Sub GetMillFromMilling(ByRef sCurrMill As String, ByVal sCurrMilling As String)
|
Public Function GetMillFromMilling(sCurrMilling As String) As String
|
||||||
If String.IsNullOrEmpty(sCurrMill) Or String.IsNullOrWhiteSpace(sCurrMill) Then
|
' Se fresatura non definita, esco subito
|
||||||
' creo l'elenco degli utensili di foratura
|
If String.IsNullOrWhiteSpace(sCurrMilling) Then Return ""
|
||||||
Dim sToolName As String = String.Empty
|
' Salvo lavorazione e utensile correnti
|
||||||
Dim nType As Integer = MCH_TY.NONE
|
Dim sPrevMach As String = ""
|
||||||
Dim MillToolList As New ObservableCollection(Of String)
|
EgtMdbGetCurrMachiningParam(MCH_MP.NAME, sPrevMach)
|
||||||
MillToolList.Clear()
|
Dim sPrevTool As String = ""
|
||||||
If EgtTdbGetFirstTool(MCH_TF.MILL, sToolName, nType) Then
|
EgtTdbGetCurrToolParam(MCH_TP.NAME, sPrevTool)
|
||||||
MillToolList.Add(sToolName)
|
' Inizializzo nome utensile a nessuno
|
||||||
While EgtTdbGetNextTool(MCH_TF.MILL, sToolName, nType)
|
Dim sCurrMill As String = ""
|
||||||
MillToolList.Add(sToolName)
|
' Se esiste la lavorazione
|
||||||
End While
|
If EgtMdbSetCurrMachining(sCurrMilling) Then
|
||||||
|
' recupero il nome dell'utensile della lavorazione
|
||||||
|
Dim sTuuid As String = ""
|
||||||
|
Dim sToolName As String = ""
|
||||||
|
If Not EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTuuid) OrElse
|
||||||
|
Not EgtTdbGetToolFromUUID(sTuuid, sToolName) Then
|
||||||
|
EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, sToolName)
|
||||||
End If
|
End If
|
||||||
' recupero l'utensile associato alla lavorazione
|
' ne verifico il tipo
|
||||||
'Dim sCurrDrilling As String = m_MainWindow.m_CurrentMachine.sCurrDrilling
|
Dim nToolType As Integer = MCH_TY.NONE
|
||||||
Dim ToolString As String = String.Empty
|
If EgtTdbSetCurrTool( sToolName) AndAlso
|
||||||
EgtMdbSetCurrMachining(sCurrMilling)
|
EgtTdbGetCurrToolParam( MCH_TP.TYPE, nToolType) AndAlso ( nToolType And MCH_TF.MILL) <> 0 Then
|
||||||
' Recupero nome utensile tramite TUUID
|
sCurrMill = sToolName
|
||||||
Dim sTuuid As String = String.Empty
|
|
||||||
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTuuid)
|
|
||||||
EgtTdbGetToolFromUUID(sTuuid, ToolString)
|
|
||||||
Dim bToolExist As Boolean = False
|
|
||||||
For Each CurrTool As IEnumerable In MillToolList
|
|
||||||
If CurrTool.ToString() = ToolString Then
|
|
||||||
bToolExist = True
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
If bToolExist Then
|
|
||||||
sCurrMill = ToolString
|
|
||||||
Else
|
|
||||||
sCurrMill = String.Empty
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End Sub
|
' Ripristino lavorazione e utensile correnti
|
||||||
|
EgtMdbSetCurrMachining(sPrevMach)
|
||||||
|
EgtTdbSetCurrTool(sPrevTool)
|
||||||
|
' Restituisco il nome dell'utensile
|
||||||
|
Return sCurrMill
|
||||||
|
End Function
|
||||||
|
|
||||||
End Module
|
End Module
|
||||||
|
|||||||
Reference in New Issue
Block a user