Compare commits

...

10 Commits

Author SHA1 Message Date
Nicola Pievani 97ec72e3e1 Costruzione solido in fase di definzione COMPO 2023-06-05 10:33:18 +02:00
Nicola Pievani ca3193b9a4 Correzione gestione apertura CN per Tagli Diretti 2023-05-31 12:27:08 +02:00
Nicola Pievani 93e7144753 Creata funzione condivisa per genrazione SOLIDO 2023-05-26 14:54:45 +02:00
Nicola Pievani 31e6bbaca7 Gestione script per creazione solido in FIloTop 2023-05-25 16:43:27 +02:00
Nicola Pievani 8935622888 Inizio gestione solido per FILOTOP 2023-05-25 12:22:18 +02:00
Nicola Pievani c47370405c Configurato Script per cereazione solido con lati smussati 2023-05-22 12:58:03 +02:00
Nicola Pievani a04e2cbe62 Gestione avanzata posizionamento pezzi VeinMatch 2023-05-18 14:43:03 +02:00
Nicola Pievani da980a649e Merge branch 'Features/Compo_Frames' into develop 2023-05-18 11:18:14 +02:00
Nicola Pievani 9c7d60d307 Aggiornati i messaggi 2023-05-15 14:57:25 +02:00
Nicola Pievani a7adcdcaca Correzione visualizzazione Pagine componenti 2023-05-15 12:14:54 +02:00
9 changed files with 247 additions and 132 deletions
+3 -1
View File
@@ -37,7 +37,7 @@ Public Class CompoDimensionUC
InternComponentBtn.Content = EgtMsg(MSG_COMPONENTPAGEUC + 47) ' Componenti interni InternComponentBtn.Content = EgtMsg(MSG_COMPONENTPAGEUC + 47) ' Componenti interni
If Not String.IsNullOrEmpty(sCompoDir) Then If Not String.IsNullOrEmpty(sCompoDir) Then
bEnableAlzFront = True bEnableAlzFront = True
AlzFrontBtn.Content = "Alzatine & Frontalini" AlzFrontBtn.Content = EgtMsg(91137)
Else Else
AlzFrontBtn.Visibility = Visibility.Collapsed AlzFrontBtn.Visibility = Visibility.Collapsed
End If End If
@@ -107,8 +107,10 @@ Public Class CompoDimensionUC
Friend Sub ShowAlzFrontBtn(ByVal value As Boolean) Friend Sub ShowAlzFrontBtn(ByVal value As Boolean)
If value Then If value Then
AlzFrontBtn.Visibility = Visibility.Visible AlzFrontBtn.Visibility = Visibility.Visible
m_MainWindow.m_DrawPageUC.MessageGrid.Visibility = Visibility.Hidden
Else Else
AlzFrontBtn.Visibility = Visibility.Hidden AlzFrontBtn.Visibility = Visibility.Hidden
m_MainWindow.m_DrawPageUC.MessageGrid.Visibility = Visibility.Visible
End If End If
End Sub End Sub
+6 -1
View File
@@ -618,6 +618,10 @@ Public Class DrawPageUC
MakePreview(sMsg) MakePreview(sMsg)
MessageTxBl.Text = sMsg MessageTxBl.Text = sMsg
MessageGrid.Background = If(m_bDrawOk, Brushes.Transparent, Application.Current.FindResource("OmagCut_Red")) MessageGrid.Background = If(m_bDrawOk, Brushes.Transparent, Application.Current.FindResource("OmagCut_Red"))
' EseguoUpdate del solido
Utility.CreateSolid3D(m_MainWindow.GetIniFile())
' aggiorno visualizzazione ' aggiorno visualizzazione
EgtSetView(VT.TOP, False) EgtSetView(VT.TOP, False)
EgtZoom(ZM.ALL) EgtZoom(ZM.ALL)
@@ -627,7 +631,8 @@ Public Class DrawPageUC
' Costruisco path completa del componente ' Costruisco path completa del componente
Dim sPath = m_sCompoDir & "\" & m_sCompoName Dim sPath = m_sCompoDir & "\" & m_sCompoName
' Carico il file ' Carico il file
Return EgtLuaExecFile(sPath) Dim bOk As Boolean = EgtLuaExecFile(sPath)
Return bOk
End Function End Function
Private Function ReadAndShowVariables() As Boolean Private Function ReadAndShowVariables() As Boolean
+9
View File
@@ -1,4 +1,5 @@
Imports EgtUILib Imports EgtUILib
Imports EgtWPFLib5
Public Class FiloTopUC Public Class FiloTopUC
@@ -40,6 +41,7 @@ Public Class FiloTopUC
' Imposto messaggi ' Imposto messaggi
ParameterTxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 10) ' Offset ParameterTxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 10) ' Offset
Parameter2TxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 11) ' Affondamento Parameter2TxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 11) ' Affondamento
Parameter3TxBl.Text = EgtMsg(91138)
If m_CallingPage = MainWindow.Pages.Draw Then If m_CallingPage = MainWindow.Pages.Draw Then
' Imposto questa come pagina correntemente visualizzata nella drawpage ' Imposto questa come pagina correntemente visualizzata nella drawpage
@@ -108,6 +110,9 @@ Public Class FiloTopUC
End While End While
nPartId = EgtGetNextPart(nPartId) nPartId = EgtGetNextPart(nPartId)
End While End While
Utility.CreateSolid3D(m_MainWindow.GetIniFile())
EgtDraw()
End Sub End Sub
Private Sub Parameter3ChBx_Checked() Handles Parameter3ChBx.Click Private Sub Parameter3ChBx_Checked() Handles Parameter3ChBx.Click
@@ -215,12 +220,16 @@ Public Class FiloTopUC
EgtRemoveInfo(nLayId, "FiloTopRef") EgtRemoveInfo(nLayId, "FiloTopRef")
EgtOutLog("Error in generation OffsetPreView in TopEgde ") EgtOutLog("Error in generation OffsetPreView in TopEgde ")
End If End If
If bOk Then Utility.CreateSolid3D(m_MainWindow.GetIniFile())
' ---------------------- Fine GESTIONE PREVIEW percorso ------------------------------- ' ---------------------- Fine GESTIONE PREVIEW percorso -------------------------------
End If End If
nLayId = EgtGetNextLayer(nLayId) nLayId = EgtGetNextLayer(nLayId)
End While End While
nPartId = EgtGetNextPart(nPartId) nPartId = EgtGetNextPart(nPartId)
End While End While
EgtDraw() EgtDraw()
End Sub End Sub
+1
View File
@@ -41,6 +41,7 @@ Public Class MainComponentPageUC
m_MainWindow.m_DrawPageUC.FiloTopBtn.IsEnabled = False m_MainWindow.m_DrawPageUC.FiloTopBtn.IsEnabled = False
m_MainWindow.m_DrawPageUC.EngraveBtn.IsEnabled = False m_MainWindow.m_DrawPageUC.EngraveBtn.IsEnabled = False
m_MainWindow.m_DrawPageUC.DripCutBtn.IsEnabled = False m_MainWindow.m_DrawPageUC.DripCutBtn.IsEnabled = False
m_MainWindow.m_DrawPageUC.m_bBackFromInternalCompo = False
End Sub End Sub
Private Function GetButton(ByVal nInd As Integer) As Button Private Function GetButton(ByVal nInd As Integer) As Button
+4
View File
@@ -579,6 +579,10 @@ Public Class SideAngleUC
' Creo le geometrie dei gocciolatoi ' Creo le geometrie dei gocciolatoi
CreateDripGeom(PartId) CreateDripGeom(PartId)
End If End If
' se abilitato e dimensione solido da sotto: creo il solido
Utility.CreateSolid3D(m_MainWindow.GetIniFile())
' Aggiorno visualizzazione ' Aggiorno visualizzazione
EgtDraw() EgtDraw()
End Sub End Sub
+2 -2
View File
@@ -61,8 +61,8 @@ Public Class PolishingsPageUC
RepeatTxBl.Text = EgtMsg(91093) ' Ripetizioni RepeatTxBl.Text = EgtMsg(91093) ' Ripetizioni
StepTxBl.Text = EgtMsg(90787) ' Passo StepTxBl.Text = EgtMsg(90787) ' Passo
OffSetTxBl.Text = EgtMsg(91089) ' Offset OffSetTxBl.Text = EgtMsg(91089) ' Offset
RadiusTxBl.Text = "Raggio" RadiusTxBl.Text = EgtMsg(91139) ' Raggio
DistanceTxBl.Text = "Distanza" DistanceTxBl.Text = EgtMsg(91140) ' Distanza
LiLoGpBx.Header = EgtMsg(91094) ' Attacco/Uscita LiLoGpBx.Header = EgtMsg(91094) ' Attacco/Uscita
LiLenTxBl.Text = EgtMsg(91097) ' Lunghezza LiLenTxBl.Text = EgtMsg(91097) ' Lunghezza
LiHeightTxBl.Text = EgtMsg(91095) ' Altezza LiHeightTxBl.Text = EgtMsg(91095) ' Altezza
+44 -5
View File
@@ -567,16 +567,55 @@ Public Class SimulationPageUC
End Sub End Sub
Private Sub GenerateXPIUC_Click(sender As Object, e As RoutedEventArgs) Private Sub GenerateXPIUC_Click(sender As Object, e As RoutedEventArgs)
' eventualmente fermo la simulazione
m_nStatus = MCH_SIM_ST.UI_STOP
m_bPlay = False
PlayPauseBtn_Click(Nothing, Nothing)
' se il bottone Shift è premuto apro il file CadCut1 nel programma NotePad ' se il bottone Shift è premuto apro il file CadCut1 nel programma NotePad
Dim IsPressedShiftKey As Boolean = False Dim IsPressedShiftKey As Boolean = False
If Keyboard.Modifiers And ModifierKeys.Shift Then If Keyboard.Modifiers And ModifierKeys.Shift Then
IsPressedShiftKey = True IsPressedShiftKey = True
End If End If
' Se nella pagina di tagli diretti
If m_MainWindow.DirectCutBtn.IsChecked And Not m_MainWindow.CadCutBtn.IsChecked Then
' Genero file CNC (lancio anche se errore in precedenza)
Dim sCncPathDirect As String = m_MainWindow.GetCncDir() & "\DirectCut" & m_MainWindow.m_CurrentMachine.sIsoFileExt
Dim bOkDirect As Boolean = EgtGenerate(sCncPathDirect, "OmagCut ver." & m_MainWindow.GetVersion())
' Costringo ad aggiornare UI
UpdateUI()
' Ripristino come fase corrente quella iniziale
EgtSetCurrPhase(1)
If bOkDirect Then
m_CurrProjPage.SetInfoMessage("Genarato file " & "DirectCut" & m_MainWindow.m_CurrentMachine.sIsoFileExt)
Else
m_CurrProjPage.SetErrorMessage(EgtMsg(90314)) 'Errore nella generazione del programma CN
End If
' procedo all'apertura del file CadCut1 apenna generato (solo se generazione corretta)
If bOkDirect And IsPressedShiftKey Then
Try
Process.Start("Notepad.exe", sCncPathDirect)
Catch ex As Exception
EgtOutLog(ex.ToString)
End Try
End If
' ricarico la pagina di simulazione
EgtSetCurrPhase(1)
' nascondo i pezzi in parcheggio
HideParkedParts(True)
' Avvio ambiente di simulazione
EgtSimInit()
EgtSimStart()
' Imposto stato corrente
SetStatus(MCH_SIM_ST.UI_STOP)
m_bPlay = True
' Costringo ad aggiornare UI
UpdateUI()
' esco
Return
End If
' eventualmente fermo la simulazione
m_nStatus = MCH_SIM_ST.UI_STOP
m_bPlay = False
PlayPauseBtn_Click(Nothing, Nothing)
Dim bOk As Boolean = True Dim bOk As Boolean = True
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx()) EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
' Elimino eventuale attrezzaggio da OmagOFFICE ' Elimino eventuale attrezzaggio da OmagOFFICE
+31 -1
View File
@@ -6,6 +6,36 @@ Imports EgtWPFLib
Imports EgtUILib Imports EgtUILib
Module Utility Module Utility
'--------------------------------------------------------------------------------------------------
#Region "COMPO SOLID3d"
Friend Function CreateSolid3D(sIniFile As String) As Boolean
EgtSaveFile("C:\EgtData\OmagCUT\Temp\Ribasso.nge", NGE.TEXT)
Dim bOk As Boolean = False
Dim dRawHeight As Double = GetPrivateProfileDouble(S_RAWPART, K_RAWHEIGHT, 30, sIniFile)
' se abilitato e dimensione solido da sotto: creo il solido
Dim sPathSOLID As String = String.Empty
If GetPrivateProfileString(S_SIDES, "CreateSOLID", "", sPathSOLID, sIniFile) <> 0 And
GetPrivateProfileInt(S_SIDES, K_SIZEALWAYSONTOP, 0, sIniFile) = 0 Then
' Recupero file LUA
EgtLuaExecFile(sPathSOLID)
Dim dThick As Double = dRawHeight
EgtLuaSetGlobNumVar("CMP.THICK", dThick)
bOk = EgtLuaExecLine("CMP_Draw(false)")
Dim nErr As Integer = 0
EgtLuaGetGlobIntVar("CMP.ERR", nErr)
' Reset lua
EgtLuaResetGlobVar("CMP")
Else
EgtOutLog("CreateSolid3d Failed: file '" & sPathSOLID & "' not found or parameter 'SizeAlwaysOnTop' is TRUE")
End If
Return bOk
End Function
#End Region ' Compo Solid3d
'--------------------------------------------------------------------------------------------------
Friend Function CompoColor(sIniFile As String) As Color3d Friend Function CompoColor(sIniFile As String) As Color3d
Dim InsertColor As New Color3d(89, 210, 210, 25) Dim InsertColor As New Color3d(89, 210, 210, 25)
Dim IndexColor As Integer = GetPrivateProfileInt(S_COMPO, K_LASTCOLOR, 1, sIniFile) Dim IndexColor As Integer = GetPrivateProfileInt(S_COMPO, K_LASTCOLOR, 1, sIniFile)
@@ -39,7 +69,7 @@ Module Utility
Friend Sub UpdateUI() Friend Sub UpdateUI()
' Costringo ad aggiornare UI ' Costringo ad aggiornare UI
Dim nDummy As Integer Dim nDummy As Integer
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, _ Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background,
New Action(Function() nDummy = 0)) New Action(Function() nDummy = 0))
End Sub End Sub
+38 -13
View File
@@ -4,6 +4,7 @@ Imports System.Collections.ObjectModel
Imports System.Runtime.InteropServices Imports System.Runtime.InteropServices
Imports EgtUILib Imports EgtUILib
Imports EgtWPFLib Imports EgtWPFLib
Imports OmagCUT.VeinMatchingWindow
Public Class VeinMatchingWindow Public Class VeinMatchingWindow
@@ -19,6 +20,11 @@ Public Class VeinMatchingWindow
Private m_nIdToSel As Integer = GDB_ID.NULL Private m_nIdToSel As Integer = GDB_ID.NULL
Private m_nIdToDesel As Integer = GDB_ID.NULL Private m_nIdToDesel As Integer = GDB_ID.NULL
Enum ALETTE
F = 2
A = 1
End Enum
Private Sub Window_Initialized(sender As Object, e As EventArgs) Private Sub Window_Initialized(sender As Object, e As EventArgs)
' Assegnazione scena all'host e posizionamento nella PlacePageGrid ' Assegnazione scena all'host e posizionamento nella PlacePageGrid
VeinMatchingSceneHost.Child = VeinMatchingScene VeinMatchingSceneHost.Child = VeinMatchingScene
@@ -377,6 +383,8 @@ Friend Module VeinMatching
ShowParkedParts() ShowParkedParts()
' Ripristino il contesto corrente ' Ripristino il contesto corrente
EgtSetCurrentContext(nCurrCtx) EgtSetCurrentContext(nCurrCtx)
' EgtSaveFile("C:\EgtData\OmagCUT\Temp\MyVeinMatch.nge", NGE.TEXT)
Return True Return True
End Function End Function
@@ -1039,37 +1047,44 @@ Friend Module VeinMatching
End Function End Function
Friend Function MoveAlettaSolid(ByRef Item As Aletta, ByRef ThicknessRaw As Double) As Boolean Friend Function MoveAlettaSolid(ByRef Item As Aletta, ByRef ThicknessRaw As Double) As Boolean
' A: alzatina, F: frontalino
Dim nType As Integer Dim nType As Integer
If Not EgtGetInfo(Item.IdSideRef, "AF", nType) Then Return False If Not EgtGetInfo(Item.IdSideRef, "AF", nType) Then Return False
Dim ptSRef, ptERef, ptE As Point3d Dim ptSRef, ptERef, ptS, ptE As Point3d
' Piano cucina
If Not EgtStartPoint(Item.IdSideRef, GDB_ID.ROOT, ptSRef) Then Return False If Not EgtStartPoint(Item.IdSideRef, GDB_ID.ROOT, ptSRef) Then Return False
If Not EgtEndPoint(Item.IdSideRef, GDB_ID.ROOT, ptERef) Then Return False If Not EgtEndPoint(Item.IdSideRef, GDB_ID.ROOT, ptERef) Then Return False
' AlzFront
If Not EgtStartPoint(Item.SideId, GDB_ID.ROOT, ptS) Then Return False
If Not EgtEndPoint(Item.SideId, GDB_ID.ROOT, ptE) Then Return False If Not EgtEndPoint(Item.SideId, GDB_ID.ROOT, ptE) Then Return False
' vettore lato cucina
Dim vtRotRef As Vector3d = ptERef - ptSRef
' vettore lato AlzFront
Dim vtRot As Vector3d = ptE - ptS
' ruoto il solido intorno al lato di riferimento ' ruoto il solido intorno al lato di riferimento
Dim vtRot As Vector3d = ptERef - ptSRef If nType = ALETTE.A Then
If nType = 1 Then
EgtRotate(Item.PartId, ptE, vtRot, -90, GDB_RT.GLOB)
ElseIf nType = 2 Then
EgtRotate(Item.PartId, ptE, vtRot, 90, GDB_RT.GLOB) EgtRotate(Item.PartId, ptE, vtRot, 90, GDB_RT.GLOB)
ElseIf nType = ALETTE.F Then
EgtRotate(Item.PartId, ptE, vtRot, -90, GDB_RT.GLOB)
End If End If
' punto di riferimento per la traslazione sul solido ' punto di riferimento per la traslazione sul solido
Dim ptSolid As Point3d Dim ptSolid As Point3d
If nType = 1 Then If nType = ALETTE.A Then
' cerco id della curva che definisce la front face ' cerco id della curva che definisce la front face
Dim nSolidGrp As Integer = EgtGetFirstNameInGroup(Item.PartId, NAME_VM_SOLID) Dim nSolidGrp As Integer = EgtGetFirstNameInGroup(Item.PartId, NAME_VM_SOLID)
Dim nFrontCrvId As Integer = EgtGetFirstInGroup(nSolidGrp) Dim nFrontCrvId As Integer = EgtGetFirstInGroup(nSolidGrp)
EgtStartPoint(nFrontCrvId, ptSolid) EgtStartPoint(nFrontCrvId, GDB_ID.ROOT, ptSolid)
ElseIf nType = 2 Then ElseIf nType = ALETTE.F Then
EgtStartPoint(Item.SideId, ptSolid) EgtStartPoint(Item.SideId, GDB_ID.ROOT, ptSolid)
End If End If
Dim ItemFrame As New Frame3d ' Dim ItemFrame As New Frame3d
If Not EgtGetGroupGlobFrame(Item.PartId, ItemFrame) Then Return False ' If Not EgtGetGroupGlobFrame(Item.PartId, ItemFrame) Then Return False
ptSolid.ToGlob(ItemFrame) ' ptSolid.ToGlob(ItemFrame)
'punto di riferimento per la traslazione sul piano cucina 'punto di riferimento per la traslazione sul piano cucina
Dim ptKitchen As Point3d = ptERef Dim ptKitchen As Point3d = ptERef
@@ -1077,6 +1092,16 @@ Friend Module VeinMatching
Dim vtMove As Vector3d = ptKitchen - ptSolid Dim vtMove As Vector3d = ptKitchen - ptSolid
EgtMove(Item.PartId, vtMove, GDB_RT.GLOB) EgtMove(Item.PartId, vtMove, GDB_RT.GLOB)
' eventualmente ruoto per allineare l'alzatina al piano cucina
Dim dLRef, dAngVRef, dAngHRef As Double
vtRotRef.ToSpherical(dLRef, dAngVRef, dAngHRef)
Dim dL, dAngV, dAngH As Double
vtRot.Rotate(Vector3d.Z_AX, 180)
vtRot.ToSpherical(dL, dAngV, dAngH)
Dim dDelta As Double = dAngHRef - dAngH
If Math.Abs(dDelta) < EPS_ANG_SMALL Then Return True
EgtRotate(Item.PartId, ptKitchen, Vector3d.Z_AX, dDelta, GDB_RT.GLOB)
Return True Return True
End Function End Function