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