Compare commits

...

19 Commits

Author SHA1 Message Date
NicolaP 601471482a Insrite funzioni per la gestione del DragRettangle 2022-02-15 19:14:47 +01:00
NicolaP 8e112dc210 Inserito comando DragRettangle (gestione da configurazione) 2022-02-07 18:42:01 +01:00
NicolaP 007ad8439c Aggiornamento versione 2.4a3 2022-01-24 19:35:21 +01:00
NicolaP 1ffca8b52c Correzione gestiione VeinMatch per assemblato 3D 2022-01-24 19:34:55 +01:00
NicolaP c96251ba99 Nuova gestione SpliAuto, abilitato alzatine e frontalini 2022-01-24 12:18:34 +01:00
NicolaP 19e347412c Modifica visualizzazione comandi "DB WAterJet" 2022-01-24 12:08:07 +01:00
NicolaP 8ff06da714 Coorezione visualizzazione parametri InclinaLati 2022-01-24 12:05:08 +01:00
DarioS a18408724c OmagOFFICE :
- piccole correzioni.
2022-01-24 09:11:49 +01:00
NicolaP 701f1f2b87 Correzione gestione Quality nel file CamAuto, eliminato la qualità "" 2022-01-20 19:27:27 +01:00
NicolaP 2bb53b0b06 Merge commit 'f456c168274c47995a47f4cc3fc414137f27dac6' 2022-01-19 16:21:50 +01:00
NicolaP f456c16827 Aggiornamento di versione 2.4a2 2022-01-19 16:21:30 +01:00
NicolaP 334bfa68f7 Aggiornamento versione 2.4a2 2022-01-19 11:11:48 +01:00
NicolaP 51bbaf0bfe Merge branch 'Features/DB_WaterJet' into Features/Alz_And_Front 2022-01-17 18:39:35 +01:00
NicolaP 57cf143306 Gestioen Modifica Inizio/FIne da comandi 2022-01-17 18:38:28 +01:00
NicolaP a804043d2e Correzione gestione selezione lavorazioni 2022-01-13 19:42:00 +01:00
NicolaP 59865b140e Merge commit '959cbfb28bfec9c9b8013b700fe251a8084b6534' into Features/DB_WaterJet 2022-01-13 18:06:38 +01:00
NicolaP 08cd099947 Inizio gestione Kerf negativo 2021-12-06 18:41:00 +01:00
NicolaP 7dfb843b36 Gestione colori in fase di importazione DXF 2021-12-01 11:03:53 +01:00
NicolaP 108b075e4f Gestione VeinMatch e colore pezzi 2021-11-29 18:29:41 +01:00
22 changed files with 1239 additions and 109 deletions
+17 -6
View File
@@ -67,8 +67,8 @@ Public Class CompoParamPageVM
Private m_AlzAndFront_Visibility As Visibility
Public Property AlzAndFront_Visibility As Visibility
Get
' !!!! Temporaneamente in attesa di completamento Frontalini e alzatine !!!!
Return Visibility.Collapsed
'' !!!! Temporaneamente in attesa di completamento Frontalini e alzatine !!!!
'Return Visibility.Collapsed
Return m_AlzAndFront_Visibility
End Get
Set(value As Visibility)
@@ -411,8 +411,13 @@ Public Class CompoParamPageVM
CompoWindowMap.refCompoSceneHostV.CompoScene,
SideEntityControlVM.ModeOpt.ENGRAVE)
SideEntityControl = New SideEntityControlV(m_SideEntityControlVM)
If m_SideEntityControlVM.SideEntityList.Count < 1 Then
' eventulmente stamnpare messaggio!
' OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
' OmagOFFICEMap.refStatusBarVM.SetOutputMessage("Lavorazioni non disponibile", MSG_TYPE.WARNING)
End If
Else
SideAngle_IsEnabled = True
SideAngle_IsEnabled = True
Drip_IsEnabled = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.UNDER_CUT) And
Not String.IsNullOrWhiteSpace(CurrentMachine.sCurrDripSaw)
FiloTop_IsEnabled = True
@@ -582,10 +587,13 @@ Public Class CompoParamPageVM
EgtLuaGetGlobBoolVar(LUA_CMP_WITHINT, bHasInternalCompo)
Internal_Visibility = If(bHasInternalCompo, Visibility.Visible, Visibility.Collapsed)
SideEntity_Visibility = Visibility.Visible
' verifico che esista la configurazione per le alzatine e i frontalini
Dim sVariable As String = String.Empty
Dim bEnableAlzAndFront As Boolean = GetMainPrivateProfileString("Alz&Front", "Alz&Front", "", sVariable) <> 0
' verifio se abilitare il bottone per inserire le Alz&Front
Dim sCMPName As String = String.Empty
If EgtLuaGetGlobStringVar("CMP.Nome", sCMPName) Then
If sCMPName.StartsWith("PCucina") Or sCMPName.StartsWith("PBagno") Then
If bEnableAlzAndFront And sCMPName.StartsWith("PCucina") Or sCMPName.StartsWith("PBagno") Then
AlzAndFront_Visibility = Visibility.Visible
Else
AlzAndFront_Visibility = Visibility.Collapsed
@@ -616,12 +624,15 @@ Public Class CompoParamPageVM
AddRemove_Visibility = Visibility.Collapsed
Back_Visibility = Visibility.Visible
Internal_Visibility = Visibility.Visible
AlzAndFront_Visibility = Visibility.Visible
' verifico che esista la configurazione per le alzatine e i frontalini
Dim sVariable As String = String.Empty
Dim bEnableAlzAndFront As Boolean = GetMainPrivateProfileString("Alz&Front", "Alz&Front", "", sVariable) <> 0
AlzAndFront_Visibility = If(bEnableAlzAndFront, Visibility.Visible, Visibility.Collapsed)
SideEntity_Visibility = Visibility.Visible
' verifio se abilitare il bottone per inserire le Alz&Front
Dim sCMPName As String = String.Empty
If EgtLuaGetGlobStringVar("CMP.Nome", sCMPName) Then
If sCMPName.StartsWith("PCucina") Or sCMPName.StartsWith("PBagno") Then
If bEnableAlzAndFront And sCMPName.StartsWith("PCucina") Or sCMPName.StartsWith("PBagno") Then
AlzAndFront_Visibility = Visibility.Visible
Else
AlzAndFront_Visibility = Visibility.Collapsed
+7 -7
View File
@@ -354,7 +354,7 @@ Public Class CompoWindowVM
Friend Function MakeMultipleInsert(ByVal nNbr As Integer, sName As String) As Boolean
'Dim InsertColor As Color3d = CompoColor(m_MainWindow.GetIniFile())
Dim InsertColor As Color3d = CompoColor(IniFile.m_sIniFile)
' Imposto il contesto corrente
EgtSetCurrentContext(CompoWindowMap.refCompoSceneHostV.CompoScene.GetCtx())
@@ -492,12 +492,12 @@ Public Class CompoWindowVM
EstCalc.SetTextColor(nRegLayId)
' Imposto il colore del pezzo inserito nel progetto
'EgtSetColor(nRegLayId, InsertColor)
'Dim EntId As Integer = EgtGetFirstInGroup(nRegLayId)
'While EntId <> GDB_ID.NULL
' If EgtGetType(EntId) = GDB_TY.SRF_FRGN Then EgtSetColor(EntId, InsertColor)
' EntId = EgtGetNext(EntId)
'End While
EgtSetColor(nRegLayId, InsertColor)
Dim EntId As Integer = EgtGetFirstInGroup(nRegLayId)
While EntId <> GDB_ID.NULL
If EgtGetType(EntId) = GDB_TY.SRF_FRGN Then EgtSetColor(EntId, InsertColor)
EntId = EgtGetNext(EntId)
End While
' Esporto il pezzo in un file temporaneo
Dim sTmpFile As String = OmagOFFICEMap.refMainWindowVM.MainWindowM.sTempDir & "\FlatPartCompo.Nge"
+6
View File
@@ -86,6 +86,8 @@ Module ConstIni
Public Const K_SIDEMODE As String = "SideMode"
Public Const K_TRFDATA As String = "TrfData"
Public Const K_CSVDATA As String = "CsvData"
Public Const K_LASTCOLOR As String = "LastColor"
Public Const K_COLOR As String = "Color"
Public Const S_FLATPARTS As String = "FlatParts"
Public Const K_FLPCURRDIR As String = "CurrDir"
@@ -119,6 +121,10 @@ Module ConstIni
Public Const K_TEXTCOLOR As String = "TextColor"
Public Const K_AUTOMATICOPTIMIZE As String = "AutomaticOptimize"
Public Const K_AUTOMATICMAXTIME As String = "AutomaticMaxTime"
Public Const K_DRAGRETTANGLE As String = "DragRettangle"
Public Const S_SPLIT As String = "Split"
Public Const K_MOVE_LEV As String = "MoveLevel"
Public Const S_CSV As String = "Csv"
Public Const K_CSVDIRECT As String = "Direct"
+3 -2
View File
@@ -659,7 +659,7 @@ Public Class CurrMachWindowVM
Dim MachiningMaterials() = SysNotes.Split(";".ToCharArray)
If CurrentMachine.bWaterJet And CurrentMachine.bFromDBWaterJet Then
For Each Material As Object In MachiningMaterials
For Each Material As String In MachiningMaterials
Dim Param() As String = Material.Split(",".ToCharArray)
If Param.Count() < 2 Then Continue For
Dim CurrMatId As String = String.Empty
@@ -672,7 +672,8 @@ Public Class CurrMachWindowVM
End If
Next
Dim SubParam() As String = Param(0).Split(".".ToCharArray)
If SubParam(0) = CurrentMachine.CurrMat.nId.ToString() AndAlso SubParam.Count > 1 AndAlso SubParam(1) = CurrentMachine.CurrMat.SubId.ToString() Then
If Not IsNothing( CurrentMachine.CurrMat) AndAlso SubParam(0) = CurrentMachine.CurrMat.nId.ToString() AndAlso
SubParam.Count > 1 AndAlso SubParam(1) = CurrentMachine.CurrMat.SubId.ToString() Then
Dim MatMinH As Double = 0
StringToDouble(Param(1), MatMinH)
Dim MatMaxH As Double = 0
+33
View File
@@ -909,6 +909,36 @@ Public Class DxfImportWindowVM
NotifyPropertyChanged("MsgColor")
End Sub
' metodo utilizzato per definire il colore dei pezzi DXF importati
Private Sub ColorRegion(nCtx As Integer)
' Leggo dati corrispondenza colore
Dim InsertColor As Color3d = CompoColor(IniFile.m_sIniFile)
' Imposto contesto corrente
EgtSetCurrentContext(nCtx)
' Ciclo sui pezzi
Dim PartId As Integer = EgtGetFirstPart()
While PartId <> GDB_ID.NULL
' Ciclo sui layer delle regioni
Dim RegionId As Integer = EgtGetFirstNameInGroup(PartId, NAME_REGION)
While RegionId <> GDB_ID.NULL
EgtSetColor(RegionId, InsertColor)
' Ciclo sulle regioni
Dim EntId As Integer = EgtGetFirstInGroup(RegionId)
While EntId <> GDB_ID.NULL
If EgtGetType(EntId) = GDB_TY.SRF_FRGN Then EgtSetColor(EntId, InsertColor)
EntId = EgtGetNext(EntId)
End While
RegionId = EgtGetNextName(PartId, NAME_REGION)
End While
' passo al pezzo successico
PartId = EgtGetNextPart(PartId)
End While
' Aggiorno scritte per angoli sui lati
'WriteSideAngleForNest(nCtx)
End Sub
#End Region ' METHODS
#Region "COMMANDS"
@@ -973,6 +1003,7 @@ Public Class DxfImportWindowVM
If GetPrivateProfileInt(S_COLORTOENGRAVE, K_CTE_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
SideEntityControlVM.ColorToEngrave(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
End If
ColorRegion(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
' Eseguo zoom
EgtZoom(ZM.ALL)
' disabilito bottoni UseLayer e UseRegion, abilito bottoni Reset e Insert
@@ -1013,6 +1044,7 @@ Public Class DxfImportWindowVM
If GetPrivateProfileInt(S_COLORTOENGRAVE, K_CTE_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
SideEntityControlVM.ColorToEngrave(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
End If
ColorRegion(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
' Eseguo zoom
EgtZoom(ZM.ALL)
' disabilito bottoni UseLayer. UseRegion e UseClosedCurve, abilito bottoni Reset e Insert
@@ -1053,6 +1085,7 @@ Public Class DxfImportWindowVM
If GetPrivateProfileInt(S_COLORTOENGRAVE, K_CTE_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
SideEntityControlVM.ColorToEngrave(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
End If
ColorRegion(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
' Eseguo zoom
EgtZoom(ZM.ALL)
' disabilito bottoni UseLayer e UseRegion, abilito bottoni Reset e Insert
+4
View File
@@ -717,10 +717,12 @@ Friend Module CamAuto
Private Function SetLuaStandardCamParams(Optional bDripOk As Boolean = True) As Boolean
Dim sMaterial As String = CurrentMachine.CurrMat.sName
Dim sSawMch As String = CurrentMachine.sCurrSawing
Dim sMillMch As String = CurrentMachine.sCurrMilling
Dim sDrillMch As String = CurrentMachine.sCurrDrilling
Dim sWaterJetMch As String = CurrentMachine.sCurrWaterJetting
Dim sWaterJetQual As String = CurrentMachine.sCurrWaterJettingQuality
Dim sDripSawMch As String = If(bDripOk, CurrentMachine.sCurrDripSawing, "")
Dim sDripDrillMch As String = If(bDripOk, CurrentMachine.sCurrDripDrilling, "")
Dim dReducedDepth As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_REDUCEDDEPTH, 1, CurrentMachine.sMachIniFile)
@@ -732,10 +734,12 @@ Friend Module CamAuto
Dim bMillingOnCorners As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_MILLING_ON_CORNERS, 1, CurrentMachine.sMachIniFile) <> 0)
Dim bMillingOnSinks As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_MILLING_ON_SINKS, 0, CurrentMachine.sMachIniFile) <> 0)
Dim dMillingShort As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_MILLING_SHORTENING, 0, CurrentMachine.sMachIniFile)
EgtLuaSetGlobStringVar("CAM.MATERIAL", sMaterial)
EgtLuaSetGlobStringVar("CAM.SAWMCH", sSawMch)
EgtLuaSetGlobStringVar("CAM.MILLMCH", sMillMch)
EgtLuaSetGlobStringVar("CAM.DRILLMCH", sDrillMch)
EgtLuaSetGlobStringVar("CAM.WATERJETMCH", sWaterJetMch)
EgtLuaSetGlobStringVar("CAM.WATERJETQLTY", sWaterJetQual)
EgtLuaSetGlobStringVar("CAM.DRIPSAWMCH", sDripSawMch)
EgtLuaSetGlobStringVar("CAM.DRIPDRILLMCH", sDripDrillMch)
EgtLuaSetGlobNumVar("CAM.REDUCEDDEPTH", dReducedDepth)
+2
View File
@@ -280,6 +280,8 @@ Module ConstMach
' Nome di pezzo temporaneo che serve per copia dime
Public Const NAME_COPYTEMPLATE As String = "CopyTemplate"
' Nome layer solidi per VM
Public Const NAME_VM_SOLID As String = "Solid"
' Chiave per Id originale del pezzo per VeinMatch
Public Const KEY_ORI_ID As String = "OriId"
-1
View File
@@ -1424,7 +1424,6 @@ Friend Property sCurrMillNoTip As String
Dim sFilePath As String = sMachDir & EgtWPFLib5.WaterjetDbWindowVM.WATERJETDB_PATH
WjMaterialList = EgtWPFLib5.WaterjetDbWindowVM.LoadWjMaterials(sFilePath)
' definisco la lista delle qualità
m_Qualities.Add("")
m_Qualities.Add("Q1")
m_Qualities.Add("Q2")
m_Qualities.Add("Q3")
+12
View File
@@ -3,6 +3,16 @@ Imports EgtUILib
Imports EgtWPFLib5
Module EstCalc
Friend Function CompoColor(sIniFile As String) As Color3d
Dim InsertColor As New Color3d(89, 210, 210, 25)
Dim IndexColor As Integer = GetPrivateProfileInt(S_COMPO, K_LASTCOLOR, 1, sIniFile)
If Not GetPrivateProfileColor(S_COMPO, K_COLOR & IndexColor.ToString, InsertColor, sIniFile) Then
IndexColor = 1
GetPrivateProfileColor(S_COMPO, K_COLOR & IndexColor.ToString, InsertColor, sIniFile)
End If
WritePrivateProfileString(S_COMPO, K_LASTCOLOR, (IndexColor + 1).ToString, sIniFile)
Return InsertColor
End Function
'--------------------------------------------------------------------------------------------------
Friend Function DoubleToString(ByVal dVal As Double, ByVal nNumDec As Integer) As String
@@ -67,6 +77,8 @@ Module EstCalc
End Function
Public Function UpdateRawPart() As Boolean
' Passo al contesto principale
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' determino il grezzo (è il primo con fase 1)
m_nRawId = CamAuto.GetCurrentRaw()
If Not EgtGetRawPartBBox(m_nRawId, m_b3Raw) Then
+32 -12
View File
@@ -747,35 +747,55 @@ Public Module SplitAuto
End Function
Private Function SafeMoveRawPart(nRawId As Integer, ByRef vtMove As Vector3d, dMindist As Double) As Boolean
' Spostamento originale
Dim vtOriMove As New Vector3d(vtMove)
' Livello di movimento
Dim nMoveLevel As Integer = GetPrivateProfileInt(S_SPLIT, K_MOVE_LEV, 5, IniFile.m_sIniFile)
Dim nMove As Integer = 1
' Se esce dalla tavola, movimento già annullato ed esco con errore
If Not EgtMoveRawPart(nRawId, vtMove) Then Return False
If Not EgtMoveRawPart(nRawId, vtOriMove) Then Return False
' Se interferisce con altri grezzi, annullo movimento ed esco con errore
If Not VerifyRawWithOtherRaws(nRawId, dMindist) Then
EgtMoveRawPart(nRawId, -vtMove)
EgtMoveRawPart(nRawId, -vtOriMove)
Return False
End If
If nMoveLevel < 2 Then Return True
' Provo ad aggiungere un altro movimento
If EgtMoveRawPart(nRawId, vtMove) Then
If EgtMoveRawPart(nRawId, vtOriMove) Then
If VerifyRawWithOtherRaws(nRawId, dMindist) Then
vtMove += vtMove
vtMove += vtOriMove
nMove += 1
If nMoveLevel = nMove Then Return True
Else
EgtMoveRawPart(nRawId, -vtMove)
EgtMoveRawPart(nRawId, -vtOriMove)
End If
End If
' Provo ad aggiungere un altro movimento
If EgtMoveRawPart(nRawId, vtOriMove) Then
If VerifyRawWithOtherRaws(nRawId, dMindist) Then
vtMove += vtOriMove
nMove += 1
If nMoveLevel = nMove Then Return True
Else
EgtMoveRawPart(nRawId, -vtOriMove)
End If
End If
' Provo ad aggiungere un movimento dimezzato
If EgtMoveRawPart(nRawId, 0.5 * vtMove) Then
If EgtMoveRawPart(nRawId, 0.5 * vtOriMove) Then
If VerifyRawWithOtherRaws(nRawId, dMindist) Then
vtMove += 0.5 * vtMove
vtMove += 0.5 * vtOriMove
nMove += 1
If nMoveLevel = nMove Then Return True
Else
EgtMoveRawPart(nRawId, -0.5 * vtMove)
EgtMoveRawPart(nRawId, -0.5 * vtOriMove)
End If
End If
' Provo ad aggiunger un movimento 1/4
If EgtMoveRawPart(nRawId, 0.25 * vtMove) Then
' Provo ad aggiungere un movimento 1/4
If EgtMoveRawPart(nRawId, 0.25 * vtOriMove) Then
If VerifyRawWithOtherRaws(nRawId, dMindist) Then
vtMove += 0.25 * vtMove
vtMove += 0.25 * vtOriMove
Else
EgtMoveRawPart(nRawId, -0.25 * vtMove)
EgtMoveRawPart(nRawId, -0.25 * vtOriMove)
End If
End If
Return True
+4 -1
View File
@@ -25,7 +25,10 @@
<Button Name="ExportBtn" Height="40" Width="80"
Margin="0,5,0,0"
Content="Export"/>
</StackPanel>
<Button Name="AssemblyBtn" Height="40" Width="80"
Margin="0,5,0,0"
Content="3D"/>
</StackPanel>
</Grid>
+567 -2
View File
@@ -1,5 +1,6 @@
Imports System.IO
Imports System.Windows.Interop
Imports System.Collections.ObjectModel
Imports System.Runtime.InteropServices
Imports EgtUILib
Imports EgtWPFLib5
@@ -316,6 +317,7 @@ Public Class VeinMatchingWindow
MessageBox.Show(Me, EgtMsg(91607) & " " & sMachGrpName, EgtMsg(91122), MessageBoxButton.OK, MessageBoxImage.Exclamation)
End If
End If
End If
EgtSetCurrentContext(VeinMatchingScene.GetCtx())
' Se selezione riuscita, la eseguo anche in VME
@@ -378,6 +380,13 @@ Public Class VeinMatchingWindow
VeinMatching.Export(SaveFileDialog.FileName)
End Sub
Private Sub AssemblyBtn_Click(sender As Object, e As RoutedEventArgs) Handles AssemblyBtn.Click
EstCalc.UpdateRawPart()
' lo spessore deve essere aggiornato per ogni lastra! (devo cicolare sull'elenco delle "macchinate"
Dim ThicknessRaw As Double = EstCalc.GetRawHeight
VeinMatching.AssemblyParts(ThicknessRaw)
End Sub
Private Sub Scene_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles VeinMatchingScene.KeyDown
' Con DEL eseguo cancellazione dei pezzi selezionati
If e.KeyData = System.Windows.Forms.Keys.Delete Then
@@ -401,6 +410,8 @@ Friend Module VeinMatching
' Dimensioni immagine da esportare
Private m_nImgWidth As Integer = 1600
Private m_nImgHeight As Integer = 1200
' Lista delle alzatine
Private m_ListAlzFront As New ObservableCollection(Of Aletta)
' Flag visualizzazione testi
Private m_bShowText As Boolean = True
Friend ReadOnly Property bShowText As Boolean
@@ -672,6 +683,15 @@ Friend Module VeinMatching
' Sistemo il colore
Dim colWhite As New Color3d(255, 255, 255, 100)
EgtSetColor(nRegId, colWhite)
' Ripeto le stesse operazioni con il solido del pezzo, se esiste
Dim nSolidId As Integer = GetVeinPartSolidId(nId)
If nSolidId <> GDB_ID.NULL Then
EgtSetTextureName(nSolidId, GetVeinPhotoName(nInd))
EgtSetTextureFrame(nSolidId, refTxr, GDB_RT.GLOB)
EgtSetColor(nSolidId, colWhite)
End If
' Se richiesto, eseguo deselezione
If bDeselect Then EgtDeselectObj(nId)
End If
@@ -698,10 +718,14 @@ Friend Module VeinMatching
If nId <> GDB_ID.NULL Then
' Recupero la regione del pezzo
Dim nRegId As Integer = GetVeinPartRegionId(nId)
Dim nSolidId As Integer = GetVeinPartSolidId(nId)
' Sistemo il riferimento della texture
Dim refTxr As New Frame3d
GetVeinRefPhoto(nMainCtx, nPartId, nId, refTxr)
EgtSetTextureFrame(nRegId, refTxr, GDB_RT.GLOB)
If nSolidId <> GDB_ID.NULL Then
EgtSetTextureFrame(nSolidId, refTxr, GDB_RT.GLOB)
End If
EgtDraw()
End If
EgtSetCurrentContext(nMainCtx)
@@ -728,8 +752,15 @@ Friend Module VeinMatching
' Gli tolgo la texture
EgtRemoveTextureData(nRegId)
' Sistemo il colore
Dim colAqua As New Color3d(0, 255, 255, 25)
EgtSetColor(nRegId, colAqua)
Dim colRegion As Color3d
EgtGetColor(EgtGetParent(nRegId), colRegion)
EgtSetColor(nRegId, colRegion)
' ripeto per il solido
Dim nSolidId As Integer = GetVeinPartSolidId(nId)
If nSolidId <> GDB_ID.NULL Then
EgtRemoveTextureData(nSolidId)
EgtSetColor(nSolidId, colRegion)
End If
' Se richiesto, eseguo deselezione
If bDeselect Then EgtDeselectObj(nId)
EgtDraw()
@@ -1240,4 +1271,538 @@ Friend Module VeinMatching
Return nRegId
End Function
Private Function GetVeinPartSolidId(nVeinPartId As Integer) As Integer
' Imposto VeinMatching context
Dim nCurrCtx = SetVeinContext()
If nCurrCtx = 0 Then Return GDB_ID.NULL
' Gruppo regione
Dim nRegLayId As Integer = EgtGetFirstNameInGroup(nVeinPartId, NAME_VM_SOLID)
' Entità superficie regione piatta
Dim nRegId As Integer = EgtGetFirstInGroup(nRegLayId)
While nRegId <> GDB_ID.NULL
If EgtGetType(nRegId) = GDB_TY.SRF_MESH Then
Exit While
End If
nRegId = EgtGetNext(nRegId)
End While
' Se necessario, ripristino il contesto originale
If nCurrCtx > 0 Then EgtSetCurrentContext(nCurrCtx)
Return nRegId
End Function
' ------------------- FUNZIONI PER GESTIONE ALZATINE E FRONTALINI -------------------
Friend Function CreateListAlzAndFront() As Boolean
m_ListAlzFront.Clear()
EgtSetCurrentContext(m_nVeinCtx)
Dim nId As Integer = EgtGetFirstPart()
While nId <> GDB_ID.NULL
' verifico che il pezzo sia una alzatina
Dim sInfoName As String = String.Empty
EgtGetInfo(nId, "CMP", sInfoName)
If sInfoName = "AlzFront" Then
Dim AlzFront As New Aletta(nId)
m_ListAlzFront.Add(AlzFront)
End If
' Passo al pezzo successivo
nId = EgtGetNextPart(nId)
End While
Return True
End Function
Friend Function LinkReferencesOnAlette() As Boolean
Dim x As Integer = EgtGetCurrentContext()
' forzo il DB geometrico corrente
EgtSetCurrentContext(m_nVeinCtx)
Dim nId As Integer = EgtGetFirstPart()
While nId <> GDB_ID.NULL
' escludo dalla ricerca le alette
Dim sCMP As String = String.Empty
EgtGetInfo(nId, "CMP", sCMP)
If sCMP = "AlzFront" Then
' Passo al pezzo successivo
nId = EgtGetNextPart(nId)
Continue While
End If
' Recupero gruppo regione
Dim nOutLoopLayId As Integer = EgtGetFirstNameInGroup(nId, NAME_OUTLOOP)
' Entità lato
Dim nSideId As Integer = EgtGetFirstInGroup(nOutLoopLayId)
While nSideId <> GDB_ID.NULL
Dim sInfoGUID As String = String.Empty
EgtGetInfo(nSideId, "RefAF", sInfoGUID)
If Not String.IsNullOrEmpty(sInfoGUID) Then
Dim Item As Aletta
For Each Item In m_ListAlzFront
If Item.RefGUID = sInfoGUID Then
Item.IdSideRef = nSideId
End If
Next
' ricerco nella lista delle alette il suo
End If
nSideId = EgtGetNext(nSideId)
End While
' Passo al pezzo successivo
nId = EgtGetNextPart(nId)
End While
Return True
End Function
Friend Function AssemblyParts(ByVal ThicknessRaw As Double) As Boolean
Dim CurrContext As Integer = EgtGetCurrentContext()
' per definizione un piano cucicina deve avere lo stesso spessore delle alette
'(abbiamo dato per scontato che le alette siano realizate sullo stesso grezzo del pinao cucina...)
CreateListAlzAndFront()
LinkReferencesOnAlette()
EgtSetCurrentContext(m_nVeinCtx)
' costruisco tutti i piani cucina (recupero l'Id geometrico del VeinMatch)
Dim nId As Integer = EgtGetFirstPart()
While nId <> GDB_ID.NULL
Dim sInfoName As String = String.Empty
EgtGetInfo(nId, "CMP", sInfoName)
' recuoer
Dim sNominalThickness As String = String.Empty
EgtGetInfo(nId, "RawTN", sNominalThickness)
' verifico che il pezzo sia una piano cucina
If sInfoName.Contains("PCucina") Or sInfoName.Contains("PBagno") Then
If Not CreateKitchenTop(nId, ThicknessRaw) Then Return False
End If
' altrimenti passo al pezzo successivo
nId = EgtGetNextPart(nId)
End While
' costruisco alzatine e frontalini
Dim Item As Aletta
For Each Item In m_ListAlzFront
' verifico che il disegno 3D non sia già stato fatto
Dim nInfo3D As Integer = 0
EgtGetInfo(Item.SideId, "Info3D", nInfo3D)
If nInfo3D <> 1 Then
' EgtSetInfo(Item.SideId, "Info3D", 1)
' creo il solido
If Not CreateAlettaSolid(Item, ThicknessRaw) Then Return False
'' posiziono il solido
'If Not MoveAlettaSolid(Item, ThicknessRaw) Then Return False
End If
' posiziono il solido
If Not MoveAlettaSolid(Item, ThicknessRaw) Then Return False
' solo se arrivo fino a qui allora imposto l'info
EgtSetInfo(Item.SideId, "Info3D", 1)
Next
Draw()
Return True
End Function
Friend Function CreateKitchenTop(ByRef nId As Integer, ByRef ThicknessRaw As Double) As Boolean
' creo o svuoto layer per facce del solido
Dim nSolidGrp As Integer = EgtGetFirstNameInGroup(nId, NAME_VM_SOLID)
If nSolidGrp <> GDB_ID.NULL Then
EgtEmptyGroup(nSolidGrp)
Else
nSolidGrp = EgtCreateGroup(nId)
EgtSetName(nSolidGrp, NAME_VM_SOLID)
End If
' recupero faccia top
Dim nRegGrp As Integer = EgtGetFirstNameInGroup(nId, NAME_REGION)
Dim nTopFr As Integer = EgtGetFirstInGroup(nRegGrp)
While nTopFr <> GDB_ID.NULL
If EgtGetType(nTopFr) = GDB_TY.SRF_FRGN Then Exit While
nTopFr = EgtGetNext(nTopFr)
End While
If nTopFr = GDB_ID.NULL Then Return False
EgtSetStatus(nTopFr, 0)
' setto colore per il solido
Dim cCol As New Color3d
EgtGetColor(nTopFr, cCol)
EgtSetColor(nSolidGrp, cCol)
' creo il solido
Dim bSameLoopsNbr As Boolean
Dim nSolidId As Integer
If Not CreateKitchenBaseSolid(nTopFr, nSolidGrp, ThicknessRaw, nSolidId, bSameLoopsNbr) Then Return False
' aggiungo componenti interni
If Not AddInternalComponents(nSolidId, nTopFr, bSameLoopsNbr, ThicknessRaw) Then Return False
' setto eventuale texture
Dim sTextName As String = String.Empty
EgtGetTextureName(nTopFr, sTextName)
If sTextName <> String.Empty Then
Dim frText As New Frame3d
EgtGetTextureFrame(nTopFr, nRegGrp, frText)
EgtSetTextureName(nSolidId, sTextName)
EgtSetTextureFrame(nSolidId, frText)
End If
' elimino curve ausiliarie
Dim nIdx As Integer = EgtGetFirstInGroup(nSolidGrp)
While nIdx <> GDB_ID.NULL
Dim newId As Integer = EgtGetNext(nIdx)
If EgtGetType(nIdx) <> GDB_TY.SRF_MESH Then
EgtErase(nIdx)
End If
nIdx = newId
End While
'Dim nOutloopGrpOrig As Integer = EgtGetFirstNameInGroup(nId, NAME_OUTLOOP & ".orig")
'If nOutloopGrpOrig <> GDB_ID.NULL Then
' EgtSetStatus(nOutloopGrpOrig, 1)
' Dim nOutloopGrp As Integer = EgtGetFirstNameInGroup(nId, NAME_OUTLOOP)
' EgtSetStatus(nOutloopGrp, 0)
'End If
Return True
End Function
Friend Function CreateKitchenBaseSolid(ByRef nTopFr As Integer, ByRef nSolidGrp As Integer, ByRef ThicknessRaw As Double,
ByRef nSolidStm As Integer, ByRef bSameLoopsNbr As Boolean) As Boolean
' creo la faccia bottom
Dim nBottomFr As Integer
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nTopFr))
If Not EgtCalcFlatPartDownRegion(nPartId, ThicknessRaw) Then Return False
Dim nDwnRegGrp As Integer = EgtGetFirstNameInGroup(nPartId, "DwnReg")
If nDwnRegGrp <> GDB_ID.NULL Then
EgtSetStatus(nDwnRegGrp, 0)
nBottomFr = EgtGetFirstInGroup(nDwnRegGrp)
If nBottomFr = GDB_ID.NULL Then Return False
Else
nBottomFr = EgtCopy(nTopFr, nSolidGrp)
End If
Dim vtMove As Vector3d = -ThicknessRaw * Vector3d.Z_AX()
EgtMove(nBottomFr, vtMove)
EgtSetStatus(nBottomFr, 0)
' superficie laterale
Dim nTopCrvCount, nBottomCrvCount As Integer
Dim nTopCrv, nBottomCrv As Integer
nTopCrv = EgtExtractSurfFrChunkLoops(nTopFr, 0, nSolidGrp, nTopCrvCount)
nBottomCrv = EgtExtractSurfFrChunkLoops(nBottomFr, 0, nSolidGrp, nBottomCrvCount)
' modifico il punto iniziale della curva bottom per ottenere una buona superficie rigata
Dim ptStartTop As Point3d
EgtStartPoint(nTopCrv, ptStartTop)
EgtChangeClosedCurveStartPoint(nBottomCrv, ptStartTop - vtMove)
Dim nLateralStm As Integer = EgtCreateSurfTmRuled(nSolidGrp, nBottomCrv, nTopCrv, 0, EPS_STM)
' superfici trimesh per faccia top e bottom
Dim nTopStm, nBottomStm As Integer
bSameLoopsNbr = (nTopCrvCount = nBottomCrvCount)
If bSameLoopsNbr Then
If Not GetSrfTmFromFlatRegion(nTopFr, nSolidGrp, nTopStm) Then Return False
If Not GetSrfTmFromFlatRegion(nBottomFr, nSolidGrp, nBottomStm) Then Return False
Else
' creo le facce top e bottom dimenticando eventuali aperture
nTopStm = EgtCreateSurfTmByFlatContour(nSolidGrp, nTopCrv, EPS_STM)
nBottomStm = EgtCreateSurfTmByFlatContour(nSolidGrp, nBottomCrv, EPS_STM)
End If
EgtInvertSurface(nBottomStm)
nSolidStm = EgtCreateSurfTmBySewing(nSolidGrp, 3, {nTopStm, nBottomStm, nLateralStm}, True)
' elimino il layer generato dalla funzione "EgtCalcFlatPartDownRegion" e rinomino quello acceso
Dim nOutLoopOrig As Integer = EgtGetFirstNameInGroup(nPartId, NAME_OUTLOOP & ".orig")
If nOutLoopOrig <> GDB_ID.NULL Then
Dim nCurrOutLoop As Integer = EgtGetFirstNameInGroup(nPartId, NAME_OUTLOOP)
EgtErase(nCurrOutLoop)
EgtSetName(nOutLoopOrig, NAME_OUTLOOP)
EgtSetStatus(nOutLoopOrig, GDB_ST.ON_)
End If
Return nSolidStm <> GDB_ID.NULL
End Function
Friend Function AddInternalComponents(ByRef nSolidStm As Integer, ByRef nTopFr As Integer, ByRef bSameLoopsNbr As Boolean,
ByRef ThicknessRaw As Double) As Boolean
Dim nSolidGrp = EgtGetParent(nSolidStm)
' aperture interne
Dim nTopCrvCount As Integer
Dim nTopCrv As Integer = EgtExtractSurfFrChunkLoops(nTopFr, 0, nSolidGrp, nTopCrvCount)
If bSameLoopsNbr Then
Dim FacesStm(nTopCrvCount - 1) As Integer
FacesStm(0) = nSolidStm
' creo le superfici laterali definite dalle aperture
For i As Integer = 1 To nTopCrvCount - 1
FacesStm(i) = EgtCreateSurfTmByExtrusion(nSolidGrp, 1, {nTopCrv + i}, -ThicknessRaw * Vector3d.Z_AX(), EPS_STM)
EgtInvertSurface(FacesStm(i))
Next
nSolidStm = EgtCreateSurfTmBySewing(nSolidGrp, nTopCrvCount, FacesStm, True)
Else
' creo le aperture per sottrazione di solidi
For i As Integer = 1 To nTopCrvCount - 1
Dim nComponentSrf As Integer = EgtCreateSurfTmByRegionExtrusion(nSolidGrp, 1, {nTopCrv + i}, -(ThicknessRaw + 10) * Vector3d.Z_AX(), EPS_STM)
EgtSurfTmSubtract(nSolidStm, nComponentSrf)
EgtErase(nComponentSrf)
Next
End If
' ribassi
Dim nId As Integer = EgtGetFirstGroupInGroup(EgtGetParent(nSolidGrp))
While nId <> GDB_ID.NULL
Dim sName As String = ""
EgtGetName(nId, sName)
If sName <> "Pocket" Then
nId = EgtGetNextGroup(nId)
Continue While
End If
' cerco curva composita che definisce il ribasso
Dim nCrvCompoId As Integer = EgtGetFirstInGroup(nId)
While nCrvCompoId <> GDB_ID.NULL
If EgtGetType(nCrvCompoId) = GDB_TY.CRV_COMPO Then Exit While
nCrvCompoId = EgtGetNext(nCrvCompoId)
End While
Dim dThick As Double
EgtCurveThickness(nCrvCompoId, dThick)
Dim vtExtr As Vector3d
EgtCurveExtrusion(nCrvCompoId, vtExtr)
Dim nRecessSrf As Integer = EgtCreateSurfTmByRegionExtrusion(nId, 1, {nCrvCompoId}, (dThick + 100) * vtExtr, EPS_STM)
EgtSurfTmSubtract(nSolidStm, nRecessSrf)
EgtErase(nRecessSrf)
' Passo al pezzo successivo
nId = EgtGetNextGroup(nId)
End While
Return True
End Function
Friend Function GetSrfTmFromFlatRegion(ByRef nFlatRegion As Integer, ByRef nSolidGrp As Integer, ByRef nSrfTmId As Integer) As Boolean
If nFlatRegion = GDB_ID.NULL Then Return False
' curve che delimitano la superficie
Dim nCrvCount As Integer
Dim nCrv As Integer = EgtExtractSurfFrChunkLoops(nFlatRegion, 0, nSolidGrp, nCrvCount)
If nCrv = GDB_ID.NULL Then Return False
' creo array con gli indici delle curve
Dim CrvList(nCrvCount - 1) As Integer
For i As Integer = 0 To nCrvCount - 1
CrvList(i) = nCrv + i
Next
nSrfTmId = EgtCreateSurfTmByRegion(nSolidGrp, CrvList, EPS_STM)
' cancello le curve create
For i As Integer = 0 To nCrvCount - 1
EgtErase(CrvList(i))
Next
Return nSrfTmId <> GDB_ID.NULL
End Function
Friend Function CreateAlettaSolid(ByRef Item As Aletta, ByRef ThicknessRaw As Double) As Boolean
' angoli per i tagli
Dim dAngL, dAngR, dAng As Double
EgtGetInfo(Item.SideId + 1, INFO_SIDE_ANGLE, dAngR)
EgtGetInfo(Item.SideId + 3, INFO_SIDE_ANGLE, dAngL)
EgtGetInfo(Item.SideId, INFO_SIDE_ANGLE, dAng)
If Math.Abs(dAngL - 90) < EPS_SMALL Or Math.Abs(dAngL + 90) < EPS_SMALL Then dAngL = 0
If Math.Abs(dAngR - 90) < EPS_SMALL Or Math.Abs(dAngR + 90) < EPS_SMALL Then dAngR = 0
If Math.Abs(dAng - 90) < EPS_SMALL Or Math.Abs(dAng + 90) < EPS_SMALL Then dAng = 0
' punti che delimitano la front face (faccia adiacente a top lungo il lato di riferimento)
Dim pt1, pt2, pt3, pt4 As Point3d
EgtStartPoint(Item.SideId, pt4)
EgtEndPoint(Item.SideId, pt3)
pt2 = pt3 - ThicknessRaw * Vector3d.Z_AX()
pt1 = pt4 - ThicknessRaw * Vector3d.Z_AX()
' aggiungo tagli inclinati
pt2 = pt2 + ThicknessRaw * Math.Tan(dAngR * Math.PI / 180) * Vector3d.X_AX()
pt1 = pt1 - ThicknessRaw * Math.Tan(dAngL * Math.PI / 180) * Vector3d.X_AX()
' aggiungo eventuale taglio sul lato superiore
pt2 = pt2 - ThicknessRaw * Math.Tan(dAng * Math.PI / 180) * Vector3d.Y_AX()
pt1 = pt1 - ThicknessRaw * Math.Tan(dAng * Math.PI / 180) * Vector3d.Y_AX()
' punti che delimitano back face
Dim HeightTop As Double
EgtCurveLength(Item.SideId + 1, HeightTop)
Dim HeightBottom As Double = HeightTop + ThicknessRaw * Math.Tan(dAng * Math.PI / 180)
Dim ptB1 As Point3d = pt1 + HeightBottom * Vector3d.Y_AX()
Dim ptB2 As Point3d = pt2 + HeightBottom * Vector3d.Y_AX()
Dim ptB3 As Point3d = pt3 + HeightTop * Vector3d.Y_AX()
Dim ptB4 As Point3d = pt4 + HeightTop * Vector3d.Y_AX()
' Creo o svuoto layer per facce del solido
Dim nSolidGrp As Integer = EgtGetFirstNameInGroup(Item.PartId, NAME_VM_SOLID)
If nSolidGrp <> GDB_ID.NULL Then
EgtEmptyGroup(nSolidGrp)
Else
nSolidGrp = EgtCreateGroup(Item.PartId)
EgtSetName(nSolidGrp, NAME_VM_SOLID)
End If
Dim nRegionGrp As Integer = EgtGetFirstNameInGroup(Item.PartId, NAME_REGION)
Dim cCol As New Color3d
EgtGetColor(EgtGetFirstInGroup(nRegionGrp), cCol)
EgtSetColor(nSolidGrp, cCol)
' Top Face
Dim nTopSrfFR As Integer = EgtGetFirstInGroup(nRegionGrp)
Dim tmp As Integer
Dim nTopCrv As Integer = EgtExtractSurfFrChunkLoops(nTopSrfFR, 0, nRegionGrp, tmp)
If nTopCrv = GDB_ID.NULL Then Return False
Dim nTopSrf As Integer = EgtCreateSurfTmByRegion(nSolidGrp, {nTopCrv}, EPS_SMALL)
EgtErase(nTopCrv)
EgtSetStatus(nTopSrfFR, 0)
Dim nFrontSrf, nBackSrf, nBottomSrf, nRightSrf, nLeftSrf As Integer
' Front Face
If Not CreateSolidFace(nSolidGrp, {pt1, pt2, pt3, pt4}, nFrontSrf, False) Then Return False
' Back Face
If Not CreateSolidFace(nSolidGrp, {ptB1, ptB4, ptB3, ptB2}, nBackSrf) Then Return False
' Bottom face
If Not CreateSolidFace(nSolidGrp, {pt2, pt1, ptB1, ptB2}, nBottomSrf) Then Return False
' Right face
If Not CreateSolidFace(nSolidGrp, {ptB1, pt1, pt4, ptB4}, nRightSrf) Then Return False
' Left face
If Not CreateSolidFace(nSolidGrp, {ptB2, ptB3, pt3, pt2}, nLeftSrf) Then Return False
' creo il solido
Dim nSolidSrf As Integer = EgtCreateSurfTmBySewing(nSolidGrp, 6, {nTopSrf, nFrontSrf, nBackSrf, nBottomSrf, nRightSrf, nLeftSrf}, True)
' setto eventuale texture
Dim sTextName As String = String.Empty
EgtGetTextureName(nTopSrfFR, sTextName)
If sTextName <> String.Empty Then
Dim frText As New Frame3d
EgtGetTextureFrame(nTopSrfFR, nRegionGrp, frText)
EgtSetTextureName(nSolidSrf, sTextName)
EgtSetTextureFrame(nSolidSrf, frText)
End If
Dim nOutloopGrp As Integer = EgtGetParent(Item.SideId)
EgtSetStatus(nOutloopGrp, 0)
Return True
End Function
Friend Function CreateSolidFace(ByRef nSrfGrp As Integer, ByRef Points As Point3d(), ByRef nSrfId As Integer,
Optional ByRef bDeleteCrv As Boolean = True) As Boolean
If Points.Count() <> 4 Then Return False
Dim nCrvId As Integer = EgtCreateCurveCompo(nSrfGrp, {EgtCreateLine(nSrfGrp, Points(0), Points(1)),
EgtCreateLine(nSrfGrp, Points(1), Points(2)),
EgtCreateLine(nSrfGrp, Points(2), Points(3)),
EgtCreateLine(nSrfGrp, Points(3), Points(0))}, True)
If nCrvId = GDB_ID.NULL Then Return False
nSrfId = EgtCreateSurfTmByRegion(nSrfGrp, {nCrvId}, EPS_SMALL)
If bDeleteCrv Then
EgtErase(nCrvId)
Else
EgtSetStatus(nCrvId, GDB_ST.OFF)
End If
Return nSrfId <> GDB_ID.NULL
End Function
Friend Function MoveAlettaSolid(ByRef Item As Aletta, ByRef ThicknessRaw As Double) As Boolean
Dim nType As Integer
If Not EgtGetInfo(Item.IdSideRef, "AF", nType) Then Return False
Dim ptSRef, ptERef, ptE As Point3d
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.SideId, GDB_ID.ROOT, ptE) Then Return False
' verifco che sia già stato ruotato
Dim nInfo3D As Integer = 0
EgtGetInfo(Item.SideId, "Info3D", nInfo3D)
If nInfo3D <> 1 Then
' ruoto il solido intorno al lato di riferimento
Dim vtRot As Vector3d = ptERef - ptSRef
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)
End If
End If
' punto di riferimento per la traslazione sul solido
Dim ptSolid As Point3d
If nType = 1 Then
' cerco id della curva che definisce la front face
Dim nSolidGrp As Integer = EgtGetFirstNameInGroup(Item.PartId, NAME_VM_SOLID)
Dim nFrontCrvId As Integer = EgtGetFirstInGroup(nSolidGrp)
EgtStartPoint(nFrontCrvId, ptSolid)
ElseIf nType = 2 Then
EgtStartPoint(Item.SideId, ptSolid)
End If
Dim ItemFrame As New Frame3d
If Not EgtGetGroupGlobFrame(Item.PartId, ItemFrame) Then Return False
ptSolid.ToGlob(ItemFrame)
'punto di riferimento per la traslazione sul piano cucina
Dim ptKitchen As Point3d = ptERef
' traslazione
Dim vtMove As Vector3d = ptKitchen - ptSolid
EgtMove(Item.PartId, vtMove, GDB_RT.GLOB)
Return True
End Function
End Module
Public Class Aletta
Private m_PartId As Integer = -1
Public ReadOnly Property PartId As Integer
Get
Return m_PartId
End Get
End Property
Private m_SideId As Integer = -1
Public ReadOnly Property SideId As Integer
Get
Return m_SideId
End Get
End Property
Private m_RefGUID As String = String.Empty
Public ReadOnly Property RefGUID As String
Get
Return m_RefGUID
End Get
End Property
Private m_IdSideRef As Integer = -1
Public Property IdSideRef As Integer
Get
Return m_IdSideRef
End Get
Set(value As Integer)
m_IdSideRef = value
End Set
End Property
Sub New(nId As Integer)
m_PartId = nId
' Recupero l'info legata al lato che contiene iil riferiemnto
Dim nOutLoopLayId As Integer = EgtGetFirstNameInGroup(nId, NAME_OUTLOOP)
' Entità lato
Dim nSideId As Integer = EgtGetFirstInGroup(nOutLoopLayId)
While nSideId <> GDB_ID.NULL
Dim sInfoGUID As String = String.Empty
EgtGetInfo(nSideId, "RefAF", sInfoGUID)
If Not String.IsNullOrEmpty(sInfoGUID) Then
m_RefGUID = sInfoGUID
m_SideId = nSideId
Exit While
End If
nSideId = EgtGetNext(nSideId)
End While
End Sub
End Class
+6 -5
View File
@@ -13,16 +13,17 @@
Height="20" Width="150"/>-->
<Button Command="{Binding ToolDbCommand}" ToolTip="{Binding ToolDBToolTip}"
Style="{StaticResource ToolBar_TextButton}" Width="55" Content="{Binding ToolDBMsg}"/>
Style="{StaticResource ToolBar_TextButton}" Width="70" Content="{Binding ToolDBMsg}"/>
<Button Command="{Binding MachDbCommand}" ToolTip="{Binding MachiningDbToolTip}"
Style="{StaticResource ToolBar_TextButton}" Width="55" Content="{Binding MachiningDbMsg}"/>
Style="{StaticResource ToolBar_TextButton}" Width="70" Content="{Binding MachiningDbMsg}"/>
<Button Command="{Binding SetUpCommand}" ToolTip="{Binding SetUpToolTip}"
Style="{StaticResource ToolBar_TextButton}" Width="55" Content="{Binding SetUpMsg}"
Style="{StaticResource ToolBar_TextButton}" Width="70" Content="{Binding SetUpMsg}"
Background="{Binding SetUp_Background}"/>
<Button Command="{Binding WaterjetDbCommand}" ToolTip="{Binding WaterjetDbToolTip}"
Style="{StaticResource ToolBar_Button}" Width="70" Content="{Binding WaterjetDbMsg}" Visibility="{Binding WjDb_Visibility}"/>
<Button Command="{Binding MachOptionsCommand}" ToolTip="{Binding OptionsToolTip}">
<Image Source="/Resources/TopCommandBar/Options.png" Height="22" />
</Button>
<Button Command="{Binding WaterjetDbCommand}" ToolTip="{Binding WaterjetDbToolTip}"
Style="{StaticResource ToolBar_Button}" Content="{Binding WaterjetDbMsg}" Visibility="{Binding WjDb_Visibility}"/>
</EgtFloating:EgtFloatingPanel>
+1 -1
View File
@@ -47,7 +47,7 @@ Public Class MyMachinePanelVM
End Property
Public ReadOnly Property WaterjetDbMsg As String
Get
Return "WJ" 'EgtMsg(MSG_MACHINEPAGEUC + 7)
Return "DB WaterJet" 'EgtMsg(MSG_MACHINEPAGEUC + 7)
End Get
End Property
+2 -2
View File
@@ -195,8 +195,8 @@ Public Class MainWindowM
' Verifico abilitazione nesting automatico
m_bAutoNestOption = Not String.IsNullOrWhiteSpace( sNestKey)
' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2311, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2311, 1, m_nKeyOptions)
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2401, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2401, 1, m_nKeyOptions)
' Verifico abilitazione prodotto
Dim bProd As Boolean = GetKeyOption(KEY_OPT.OFFICE_BASE)
' Inizializzazione generale di EgtInterface
+4 -4
View File
@@ -28,9 +28,9 @@ Imports System.Windows
<Assembly: AssemblyDescription("OmagOFFICE 32 bit")>
#End If
#End If
<Assembly: AssemblyCompany("EgalTech s.r.l.")>
<Assembly: AssemblyCompany("Egalware s.r.l.")>
<Assembly: AssemblyProduct("OmagOFFICE")>
<Assembly: AssemblyCopyright("Copyright © 2017-2021 by EgalTech s.r.l.")>
<Assembly: AssemblyCopyright("Copyright © 2017-2022 by Egalware s.r.l.")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(false)>
'In order to begin building localizable applications, set
@@ -69,6 +69,6 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.3.11.2")>
<Assembly: AssemblyFileVersion("2.3.11.2")>
<Assembly: AssemblyVersion("2.4.1.3")>
<Assembly: AssemblyFileVersion("2.4.1.3")>
+47 -50
View File
@@ -663,7 +663,7 @@ Public Class SplitModeVM
SplitModeIsEnabled = Not OmagOFFICEMap.refMachiningTabVM.IsShow
' nascondo i comandi che non devono essere visualizzati in funzione delle lavorazioni attive
If m_nCountSawing = 0 And (m_nCountWaterjetting > 0 Or m_nCountOtherMachining) Then
If m_nCountSawing = 0 And (m_nCountWaterjetting > 0 Or m_nCountOtherMachining > 0) Then
VisibilityButtonFromMachining(MCH_OY.WATERJETTING)
Else
VisibilityButtonFromMachining(MCH_OY.SAWING)
@@ -1718,13 +1718,22 @@ Public Class SplitModeVM
If Not ModifStartWindow.ShowDialog() Then Return
' Modifica della lavorazione
Dim dUsal As Double = ModifStartWindowVM.GetVal()
EgtSetCurrMachining(nOperId)
Dim dAddLen As Double = 0
EgtGetMachiningParam(MCH_MP.STARTADDLEN, dAddLen)
If dAddLen - dOrigUsal < -10 * EPS_SMALL Then Return
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen + dUsal - dOrigUsal)
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dUsal)
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
Dim bRepeat As Boolean = False
Do
EgtSetCurrMachining(nOperId)
Dim dAddLen As Double = 0
EgtGetMachiningParam(MCH_MP.STARTADDLEN, dAddLen)
If dAddLen - dOrigUsal < -10 * EPS_SMALL Then Return
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen + dUsal - dOrigUsal)
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dUsal)
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
bRepeat = Not UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
If bRepeat Then
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dOrigUsal)
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal)
dUsal = dOrigUsal
End If
Loop Until Not bRepeat
' verifico interferenza
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
ColorMachining(m_MachiningList(nI))
@@ -1813,14 +1822,25 @@ Public Class SplitModeVM
ModifStartWindowVM.SetVal(dOrigUeal)
If Not ModifStartWindow.ShowDialog() Then Return
' Modifica della lavorazione
Dim dUsal As Double = ModifStartWindowVM.GetVal()
EgtSetCurrMachining(nOperId)
Dim dAddLen As Double = 0
EgtGetMachiningParam(MCH_MP.ENDADDLEN, dAddLen)
If dAddLen - dOrigUeal < -10 * EPS_SMALL Then Return
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen + dUsal - dOrigUeal)
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dUsal)
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
Dim dUeal As Double = ModifStartWindowVM.GetVal()
Dim bRepeat As Boolean = False
Do
EgtSetCurrMachining(nOperId)
Dim dAddLen As Double = 0
EgtGetMachiningParam(MCH_MP.ENDADDLEN, dAddLen)
If dAddLen - dOrigUeal < -10 * EPS_SMALL Then
Return
End If
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen + dUeal - dOrigUeal)
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dUeal)
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
bRepeat = Not UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
If bRepeat Then
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dOrigUeal)
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal)
dUeal = dOrigUeal
End If
Loop Until Not bRepeat
' verifico interferenza
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
ColorMachining(m_MachiningList(nI))
@@ -2208,13 +2228,21 @@ Public Class SplitModeVM
Set(value As Boolean)
If Not IsNothing(value) Then
m_IsSelected = value
If value Then
If value AndAlso Not OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Contains(Me) Then
OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Add(Me)
Else
OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Remove(Me)
End If
If OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Count = 0 Then Return
If OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Count = 1 Then OmagOFFICEMap.refSplitModeVM.m_bAreHomogeneous = True
' se non è stato aggiunto nessun nuovo elemento alla lista dei selezionati allora esco
If OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Count = 0 Then
EgtDraw()
NotifyPropertyChanged("IsSelected")
Return
End If
' se ho un solo elemento allora so che è coerrente con se stesso come lavorazione
If OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Count = 1 Then
OmagOFFICEMap.refSplitModeVM.m_bAreHomogeneous = True
End If
' creo lista ordinata dei selezionati
Dim ItemList As New List(Of NameIdLsBxItem)
For Each Item In OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList
@@ -2223,37 +2251,6 @@ Public Class SplitModeVM
' ------------------------ verifico che le lavorazioni siano dello stesso tipo ------------------------
OmagOFFICEMap.refSplitModeVM.VerifyHomogenousMachining(ItemList)
'Dim nSawing As Integer = 0
'Dim nWaterjetting As Integer = 0
'Dim nOtherMachining As Integer = 0
'' conto il numero di tipi di lavprazioni
'For Each Item As NameIdLsBxItem In ItemList
' If Item.Type = MCH_OY.SAWING Then
' nSawing += 1
' ElseIf Item.Type = MCH_OY.WATERJETTING Then
' nWaterjetting += 1
' Else
' nOtherMachining += 1
' End If
'Next
'' verifico se le lavorazioni sono omeogenee
'If nSawing > 0 And (nWaterjetting > 0 Or nOtherMachining > 0) Then
' m_bAreHomogeneous = False
' VisibilityButtonFromMachinig(MCH_OY.SAWING)
'ElseIf nSawing = 0 And nOtherMachining > 0 And nWaterjetting > 0 Then
' m_bAreHomogeneous = False
' VisibilityButtonFromMachinig(MCH_OY.WATERJETTING)
'Else
' VisibilityButtonFromMachinig(ItemList(0).Type)
' m_bAreHomogeneous = True
'End If
'' eventualmente stampo messaggio
'If Not m_bAreHomogeneous Then
' m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
' m_MainWindow.m_CurrentProjectPageUC.SetWarningMessage("Lavorazioni non omogenee")
'Else
' m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
'End If
' -----------------------------------------------------------------------------------------------------
ItemList.Sort(Function(x, y) Comparer(Of Integer).Default.Compare(OmagOFFICEMap.refSplitModeVM.m_ItemList.IndexOf(x),
+18 -5
View File
@@ -24,7 +24,7 @@
Command="{Binding ImportDxfCommand}">
<Image Source="/Resources/NestingTab/ImportDxf.png" Stretch="Uniform"/>
</Button>
<ToggleButton Grid.Column="4" Grid.Row="0"
<ToggleButton Grid.Column="4" Grid.Row="0"
Style="{StaticResource OptionPanel_NestingToggleButton}"
IsChecked="{Binding CsvImport_IsChecked}">
<Image Source="/Resources/NestingTab/ImportCsv.png" Stretch="Uniform"/>
@@ -148,11 +148,24 @@
Margin="2.5,0,0,0"/>
</UniformGrid>
<Button Content="{Binding RemovePartMsg}"
Style="{StaticResource OptionPanel_TextButton}"
Command="{Binding RemovePartCommand}"
Margin="0,0,0,5"/>
<Grid Margin="0,0,-2.5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Button Content="{Binding RemovePartMsg}"
Grid.ColumnSpan="{Binding DragRettangle_Cl_Span}"
Style="{StaticResource OptionPanel_TextButton}"
Command="{Binding RemovePartCommand}"
Margin="0,0,2.5,0"/>
<ToggleButton Content="{Binding DragRettangleMsg}" Grid.Column="1"
Visibility="{Binding DragRettangle_Visibility}"
Style="{StaticResource OptionPanel_ToggleButton}"
IsChecked="{Binding bDragRettangle}"
Margin="2.5,0,2.5,0"/>
</Grid>
<UniformGrid Columns="2" Margin="0,0,0,5">
<Button Content="{Binding SelectAllMsg}"
Style="{StaticResource OptionPanel_TextButton}"
+361 -3
View File
@@ -35,6 +35,18 @@ Public Class NestingTabVM
Private m_bTrfData As Boolean = False
Private m_bCsvData As Boolean = False
' Id del rettangolo, del traglio e della curva da modificare tramite Drag
Private m_nIdSelectedOutLoopRettangle As Integer = GDB_ID.NULL
Private m_nIdSelectedRegionRettangle As Integer = GDB_ID.NULL
Private m_nIdSelectedSawRettangle As Integer = GDB_ID.NULL
Private m_nIdSelectedCurvRettangle As Integer = GDB_ID.NULL
Private m_nIdSelectedTextRettangle As Integer = GDB_ID.NULL
Private m_nIdSelectedTextTopRettangle As Integer = GDB_ID.NULL
Private m_nIdSelectedFlatSurfRettangle As Integer = GDB_ID.NULL
Private m_SideListRettangle(4) As Integer
Private m_sTextContent As String = String.Empty
Private m_CsvImportWindow As CsvWindowV
Friend ReadOnly Property CsvImportWindow As CsvWindowV
Get
@@ -161,6 +173,12 @@ Public Class NestingTabVM
End Get
End Property
Public ReadOnly Property DragRettangleMsg As String
Get
Return "Drag Rettangle"
End Get
End Property
Public ReadOnly Property SelectAllMsg As String
Get
Return EgtMsg(MSG_NESTPAGEUC + 4)
@@ -211,6 +229,13 @@ Public Class NestingTabVM
#Region "CONSTRUCTOR"
Sub New()
If (GetMainPrivateProfileInt(S_NEST, K_DRAGRETTANGLE, 1) <> 0) Then
m_DragRettangle_Visibility = Visibility.Visible
Else
m_DragRettangle_Visibility = Visibility.Collapsed
End If
NotifyPropertyChanged("DragRettangle_Visibility")
NotifyPropertyChanged("DragRettangle_Cl_Span")
' Creo riferimento a questa classe in OmagOFFICEMap
OmagOFFICEMap.SetRefNestingTabVM(Me)
End Sub
@@ -506,8 +531,318 @@ Public Class NestingTabVM
Return True
End Function
#Region "DRAG RETTANGLE"
' funzione chiamata da OnMyMouseMoveScene: verifica che la selezione sia corretta (deve essere il lato di una figura rettangolare)
Private Sub OnMyMouseDownSceneSelSideRettangle(sender As Object, e As System.Windows.Forms.MouseEventArgs)
' Si può selezionare solo con il tasto sinistro e se il bottone TEST Attivo
If e.Button <> Windows.Forms.MouseButtons.Left Then
Return
End If
' Verifico se selezionato indicativo di pezzo
EgtSetObjFilterForSelWin(False, True, False, False, False)
Dim nSelMy As Integer
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSelMy)
Dim nIdMy As Integer = EgtGetFirstObjInSelWin()
While nIdMy <> GDB_ID.NULL
Dim sLayer As String = String.Empty
' layer di origine
Dim nIdParent As Integer = EgtGetParent(nIdMy)
' recupero il nome del Layer
EgtGetName(nIdParent, sLayer)
' solo se il nome del layer è quello associato ad un lato esterno allora procedo con l'evidenziazione
If sLayer = NAME_OUTLOOP Then
If EgtGetType(nIdMy) = GDB_TY.CRV_LINE Then
' -------------------------------- INIZIO VERIFICHE --------------------------------
m_nIdSelectedOutLoopRettangle = nIdParent
If Not IsRettangle(m_SideListRettangle) Then
'm_CurrProjPage.ClearMessage()
'm_CurrProjPage.SetWarningMessage("Non è un rettangolo (0)")
Return
End If
' recupero il gruppo della lavorazione associata
Dim nIdParentPart As Integer = EgtGetParent(nIdParent)
Dim nIdPV As Integer = EgtGetFirstNameInGroup(nIdParentPart, "PV")
' se non esiste un gruppo di lavorazione associato allora esco
If nIdPV = GDB_ID.NULL Then
'm_CurrProjPage.ClearMessage()
'm_CurrProjPage.SetWarningMessage("Pezzo in parcheggio (1)")
Return
End If
' se esiste ma è vuoto (pezzo scaricato da tavola)
If EgtGetFirstInGroup(nIdPV) = GDB_ID.NULL Then
'm_CurrProjPage.ClearMessage()
'm_CurrProjPage.SetWarningMessage("Pezzo in parcheggio (2)")
Return
End If
' Devo verificare che sia una lavorazione solo di lama?
Dim nIdSaw As Integer = EgtGetFirstNameInGroup(nIdPV, "Saw" & nIdMy.ToString)
' -------------------------------- FINE VERIFICHE --------------------------------
If Not EgtGetGroupObjs(nIdSaw) Then
m_nIdSelectedSawRettangle = nIdSaw
m_nIdSelectedCurvRettangle = nIdMy
m_nIdSelectedRegionRettangle = EgtGetFirstNameInGroup(nIdParentPart, NAME_REGION)
' recupero i testi cintenuti nel layer Region
If m_nIdSelectedRegionRettangle <> GDB_ID.NULL Then
Dim nCurrId As Integer = EgtGetFirstInGroup(m_nIdSelectedRegionRettangle)
While nCurrId <> GDB_ID.NULL
If EgtGetType(nCurrId) = GDB_TY.EXT_TEXT Then
Dim sVal As String = String.Empty
EgtTextGetContent(nCurrId, sVal)
If sVal = "*TOP*" Then
m_nIdSelectedTextTopRettangle = nCurrId
Else
m_nIdSelectedTextRettangle = nCurrId
m_sTextContent = GetMyRettangleText(sVal)
End If
ElseIf EgtGetType(nCurrId) = GDB_TY.SRF_FRGN Then
m_nIdSelectedFlatSurfRettangle = nCurrId
End If
nCurrId = EgtGetNext(nCurrId)
End While
End If
' seleziono ed evidenzio il lato selezionato
EgtSelectObj(nIdSaw)
EgtSetMark(nIdSaw)
EgtSelectObj(nIdMy)
EgtDraw()
Exit While
End If
End If
' se le'elemto corrente non è una linea
End If
' se le'elemto corrente non appartiene al layer OutLoop passo al prossimo elemento dell'elenco
nIdMy = EgtGetNextObjInSelWin()
End While
End Sub
' restituisce il valore del Text ripulito dalle dimensioni
Private Function GetMyRettangleText(sTextPz As String) As String
' da DrawPageUC.xaml.vb/MultipleInsert
Dim sText As String = String.Empty
If sTextPz.Contains("<br/>") Then
Dim nLastIndex As Integer = sTextPz.LastIndexOf(">")
sText = sTextPz.Remove(nLastIndex + 1)
Return sText
End If
If sTextPz.Contains(" ") Then
Dim sInfo() As String = sTextPz.Split(" "c)
If sInfo.Count > 3 Then
Return sText = sInfo(0) & " " & sInfo(1) & " "
End If
End If
Return sText
End Function
' verifico che la figura selezionata sia realmente un rettangolo
Private Function IsRettangle(ByRef IdSideList() As Integer) As Boolean
' creo una lista con i lati del rettangolo
Dim nCounter As Integer = 0
' recupero i lati dal leyer "OutLoop"
Dim IdSideRettangle As Integer = EgtGetFirstInGroup(m_nIdSelectedOutLoopRettangle)
While IdSideRettangle <> GDB_ID.NULL And nCounter < 4
Dim sVal As String = String.Empty
Dim dPrevAng As Double = 0
EgtGetInfo(IdSideRettangle, "PrevAng", sVal)
StringToDouble(sVal, dPrevAng)
Dim dNextAng As Double = 0
EgtGetInfo(IdSideRettangle, "NextAng", sVal)
StringToDouble(sVal, dNextAng)
' se gli angoli non sono retti allora esco senza caricare il lato corrente
If Math.Abs(dPrevAng - 90) > EPS_ANG_SMALL OrElse Math.Abs(dNextAng - 90) > EPS_ANG_SMALL Then
Exit While
End If
IdSideList(nCounter) = IdSideRettangle
nCounter += 1
IdSideRettangle = EgtGetNext(IdSideRettangle)
End While
' verifico che siano solo quattro lati
If IdSideRettangle = GDB_ID.NULL And nCounter = 4 Then
' solo se la figura ha 4 lati ortogonali
Return True
End If
m_nIdSelectedOutLoopRettangle = GDB_ID.NULL
' la figura presenta più/meno di 4 lati
Return False
End Function
' recupero le informazioni correnti per sapere se la figura è mdificabile
Private Function GetRettangleInfoScale(ByRef frFixed As Frame3d, ByRef MaxLen As Double, ByRef MinLen As Double) As Vector3d
' determino la direzione del lato selezionato
Dim vtDirSelectedCurv As New Vector3d
EgtStartVector(m_nIdSelectedCurvRettangle, GDB_ID.ROOT, vtDirSelectedCurv)
' recupero il lato successivo a quello selezionato
Dim Index As Integer = 0
Dim Len As Double = 0
For Ind As Integer = 0 To 3
If m_SideListRettangle(Ind) = m_nIdSelectedCurvRettangle Then
' verifico se esiste un lato Precedente altrimenti recupero l'ultimo della lista
If Ind = 0 Then
Index = 3
Else
Index = Ind - 1
End If
End If
Next
' recupero la dimensione del lato
EgtCurveLength(m_SideListRettangle(Index), MaxLen)
EgtCurveLength(m_nIdSelectedCurvRettangle, MinLen)
' verifico che il lato selezionato sia il maggiore
If MinLen > MaxLen Then Return Nothing
' determimo il versore dal lato appena calcolato
Dim vtDir As New Vector3d
EgtStartVector(m_SideListRettangle(Index), GDB_ID.ROOT, vtDir)
vtDir.Normalize()
Dim dProjectionBaseX As Double = vtDir * Vector3d.X_AX
Dim ptFixed As New Point3d
EgtStartPoint(m_SideListRettangle(Index), GDB_ID.ROOT, ptFixed)
Dim vtPerp As New Vector3d(vtDir.x, vtDir.y, vtDir.z)
vtPerp.Rotate(Vector3d.Z_AX, 90)
' determino il Frame corrente
frFixed = New Frame3d(ptFixed, vtDir, vtPerp, Vector3d.Z_AX)
Return vtDir
End Function
' funzione chiamata da OnMyMouseMoveScene: gestisce la modifica lungo una dimensione del rettangolo selezionato
Private Sub OnMyMouseMoveSawRettangle(sender As Object, e As System.Windows.Forms.MouseEventArgs)
' Se drag non abilitato o già in esecuzione, esco
If Not m_bDrag Or m_bDragging Then Return
' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel
If m_bDragToStart Then
If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And
Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then
Return
End If
m_bDragToStart = False
End If
' riferiemento che deve rimanere fisso del rettangolo
Dim frFixed As Frame3d = Nothing
' lunghezza del lato da modificare
Dim MaxLen As Double = 0
Dim MinLen As Double = 0
' recupero info sul rettangolo selezionato
Dim vtDir As Vector3d = GetRettangleInfoScale(frFixed, MaxLen, MinLen)
If vtDir.Equals(Vector3d.NULL) Then
Return
End If
' Inizio esecuzione di drag
m_bDragging = True
' Ricavo il punto corrente in coordinate mondo
Dim ptCurr As Point3d
EgtUnProjectPoint(e.Location, ptCurr)
' Ricavo il vettore di movimento
Dim vtMove As Vector3d = ptCurr - m_ptPrev
' ricavo il valore efficace di allungamento (la proiezione)
Dim dProjection As Double = vtMove * vtDir
vtMove = vtDir * dProjection
' recupero il valore di scalatura
Dim dScalefactor = dProjection / MaxLen + 1
' Modifico dimensione figura
If Math.Abs(dScalefactor) > EPS_SMALL * EPS_SMALL Then
EgtScale(m_nIdSelectedOutLoopRettangle, frFixed, dScalefactor, 1, 1, GDB_ID.ROOT)
EgtScale(m_nIdSelectedFlatSurfRettangle, frFixed, dScalefactor, 1, 1, GDB_ID.ROOT)
Dim ptCen As Point3d
EgtCenterPoint(m_nIdSelectedTextRettangle, ptCen)
EgtModifyText(m_nIdSelectedTextRettangle, m_sTextContent & LenToString(MaxLen + dProjection, 2) & " x " & LenToString(MinLen, 2))
EgtMove(m_nIdSelectedTextRettangle, vtMove * 0.5)
If m_nIdSelectedTextTopRettangle <> GDB_ID.NULL Then
EgtMove(m_nIdSelectedTextTopRettangle, vtMove * 0.5)
End If
End If
Dim nWarn As Integer = 0
ResetAllMachinings(nWarn)
EnableReferenceRegion(False)
' se la modifica genera un errore allora ripristino la figura prima della defomrazione
If Not EgtVerifyPart(EgtGetParent(m_nIdSelectedOutLoopRettangle), True) Then
EgtScale(m_nIdSelectedOutLoopRettangle, frFixed, 1 / dScalefactor, 1, 1, GDB_ID.ROOT)
EgtScale(m_nIdSelectedFlatSurfRettangle, frFixed, 1 / dScalefactor, 1, 1, GDB_ID.ROOT)
Dim ptCen As Point3d
EgtCenterPoint(m_nIdSelectedTextRettangle, ptCen)
EgtModifyText(m_nIdSelectedTextRettangle, m_sTextContent & LenToString(MaxLen, 2) & " x " & LenToString(MinLen, 2))
EgtMove(m_nIdSelectedTextRettangle, -vtMove * 0.5)
If m_nIdSelectedTextTopRettangle <> GDB_ID.NULL Then
EgtMove(m_nIdSelectedTextTopRettangle, -vtMove * 0.5)
End If
End If
EgtDraw()
' Aggiorno il punto precedente
m_ptPrev = ptCurr
' Terminata esecuzione di drag
m_bDragging = False
End Sub
' funzione chiamata da OnMyMouseUp: gestisce il reset di tutti gli indici in uso
Public Sub ResetDragRettangleParam()
' deseleziono l'elemento corrente
EgtDeselectObj(m_nIdSelectedSawRettangle)
EgtDeselectObj(m_nIdSelectedCurvRettangle)
EgtResetMark(m_nIdSelectedSawRettangle)
' resetto gli indici
m_nIdSelectedOutLoopRettangle = GDB_ID.NULL
m_nIdSelectedRegionRettangle = GDB_ID.NULL
m_nIdSelectedSawRettangle = GDB_ID.NULL
m_nIdSelectedCurvRettangle = GDB_ID.NULL
m_nIdSelectedTextRettangle = GDB_ID.NULL
m_nIdSelectedTextTopRettangle = GDB_ID.NULL
m_nIdSelectedFlatSurfRettangle = GDB_ID.NULL
m_SideListRettangle = {GDB_ID.NULL, GDB_ID.NULL, GDB_ID.NULL, GDB_ID.NULL}
m_sTextContent = String.Empty
' disattivo il drag
m_bDrag = False
' aggiorno le lavorazioni
Dim nWarn As Integer = 0
ResetAllMachinings(nWarn)
EgtDraw()
End Sub
#End Region ' Drag Rettangolo
#End Region ' METHODS
Private m_bDragRettangle As Boolean
Public Property bDragRettangle As Boolean
Get
Return m_bDragRettangle
End Get
Set(value As Boolean)
m_bDragRettangle = value
End Set
End Property
Private m_DragRettangle_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property DragRettangle_Visibility As Visibility
Get
Return m_DragRettangle_Visibility
End Get
End Property
Public ReadOnly Property DragRettangle_Cl_Span As Integer
Get
If m_DragRettangle_Visibility = Visibility.Visible Then
Return 1
End If
Return 2
End Get
End Property
#Region "COMMANDS"
#Region "DrawCommand"
@@ -1169,6 +1504,17 @@ Public Class NestingTabVM
#Region "EVENTS"
Friend Sub OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs)
' se in modalità DragRettangle (deformazione delle componenti rettangolari)
If m_bDragRettangle Then
OnMyMouseDownSceneSelSideRettangle(sender, e)
' Dati per drag (abilito il Drag)
m_locPrev = e.Location
m_bDrag = EgtUnProjectPoint(e.Location, m_ptPrev) And m_nIdSelectedCurvRettangle <> GDB_ID.NULL
m_bDragToStart = m_bDrag
m_bVerify = m_bDrag AndAlso (Keyboard.Modifiers And ModifierKeys.Shift) > 0
m_vtTotMove = Vector3d.NULL()
Return
End If
' Per default no drag
m_bDrag = False
' Verifico se selezionato indicativo di pezzo
@@ -1216,6 +1562,13 @@ Public Class NestingTabVM
End If
m_bDragToStart = False
End If
' se devo muovere un lato del rettangolo
If m_bDragRettangle Then
OnMyMouseMoveSawRettangle(sender, e)
Return
End If
' Determino cosa muovere
Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL)
' Verifico se in tavola o in parcheggio
@@ -1304,6 +1657,11 @@ Public Class NestingTabVM
End Sub
Friend Sub OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
If m_bDragRettangle Then
' deseleziono gli oggeti, resetto le variabili usate, aggiorno il disegno
ResetDragRettangleParam()
Return
End If
' Se eseguito drag
If Not m_bDragToStart Then
' Se movimento con sola verifica finale
@@ -1337,11 +1695,11 @@ Public Class NestingTabVM
End If
End If
m_bFromParking = False
' altrimenti caso con verifica durante il movimento
' altrimenti caso con verifica durante il movimento
Else
' Basta reset alla fine
End If
' Se selezione da eseguire
' Se selezione da eseguire
ElseIf m_nIdToSel <> GDB_ID.NULL Then
' Determino se pezzo in tavola o in parcheggio
Dim bPartInTable As Boolean = (EgtGetParent(m_nIdToSel) = GetRawId())
@@ -1358,7 +1716,7 @@ Public Class NestingTabVM
VeinMatching.OnSelectPart(m_nIdToSel)
' Set flag posizione selezionati
m_nPartPos = If(bPartInTable, PART_POS.IN_TABLE, PART_POS.OUT_TABLE)
' Se deselezione da eseguire
' Se deselezione da eseguire
ElseIf m_nIdToDesel <> GDB_ID.NULL Then
EgtDeselectObj(m_nIdToDesel)
' Eventuale aggiornamento VeinMatching
+1 -1
View File
@@ -129,7 +129,7 @@
Margin="13,0,0,5"
IsEnabled="{Binding OffsetYIsEnabled}" TextAlignment="Right"/>
<TextBlock Text="{Binding KerfMsg}"/>
<EgtWpfLib5:EgtTextBox Text="{Binding Kerf}"
<EgtWpfLib5:EgtTextBox Text="{Binding Kerf, UpdateSourceTrigger=PropertyChanged}"
Margin="13,0,0,5"
IsEnabled="{Binding KerfIsEnabled}" TextAlignment="Right"/>
+102 -7
View File
@@ -223,6 +223,8 @@ Public Class RawPartTabVM
End Set
End Property
#Region "Parametri Grezzo"
Private m_dLength As Double
Public Property Length As String
Get
@@ -388,7 +390,7 @@ Public Class RawPartTabVM
RecalcRawPart()
ElseIf m_InvertKerf < 0 And dOffsetX >= 0 And dOffsetX < dMaxOffsetX + m_dKerf Then
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
m_dOffsetX = dOffsetX + m_dKerf
m_dOffsetX = dOffsetX
RecalcRawPart()
ElseIf dOffsetX <= dMinOffsetX - EPS_SMALL Then
NotifyPropertyChanged("OffsetX")
@@ -453,7 +455,7 @@ Public Class RawPartTabVM
RecalcRawPart()
ElseIf m_InvertKerf < 0 And dOffsetY >= 0 And dOffsetY < dMaxOffsetY + m_dKerf Then
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
m_dOffsetY = dOffsetY + m_dKerf
m_dOffsetY = dOffsetY
RecalcRawPart()
ElseIf dOffsetY <= dMinOffsetY - EPS_SMALL Then
NotifyPropertyChanged("OffsetY")
@@ -496,6 +498,7 @@ Public Class RawPartTabVM
End Set
End Property
Private m_PrecKerf As Double = 1
Private m_InvertKerf As Double = 1
Public ReadOnly Property InvertKerf As Double
Get
@@ -516,6 +519,12 @@ Public Class RawPartTabVM
Dim dKerf As Double = 0
Dim dMaxKerf As Double = Math.Min(Math.Min(m_dOffsetX, m_dOffsetY),
Math.Min(m_dTableLength - m_dLength - m_dOffsetX, m_dTableWidth - m_dWidth - m_dOffsetY))
' recuper il segno del valore del Kerf precedente
Dim dInvertKerf As Double = 1
EgtGetInfo(EgtGetFirstRawPart(), KEY_INVERT_KERF, dInvertKerf)
m_PrecKerf = Math.Abs(m_dKerf)
m_PrecKerf = m_PrecKerf * dInvertKerf
' carcio di dati della lastra letti da intrfaccia
Dim dRawLength, dRawWidth, dRawOffsetX, dRawOffsetY As Double
If Not StringToLen(Length, dRawLength) Then Return
@@ -526,9 +535,22 @@ Public Class RawPartTabVM
If Not StringToLen(value, dKerf) Then
Return
End If
' interrompo il processo di caricamento dati se il valore della TexBox è lo stesso della calsse
If dKerf * dInvertKerf = m_dKerf Then Return
If dKerf >= 0 And dKerf < dMaxKerf + EPS_SMALL Then
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
If GetRawMode() <> RAWMODE.FROM_PHOTO Then
If m_PrecKerf < 0 Then
' definsco la dimensione del grezzo pari a quella del kerf
m_dKerf = 0
AdjustRawPartNegativeKerf()
UpdateCircles()
UpdateRawPartKerf()
m_dKerf = dKerf
m_PrecKerf = 0
End If
' Specifico che si tratta di un Kerf negativo (per interfaccia grafica)
EgtSetInfo(EstCalc.GetRawId(), KEY_INVERT_KERF, 1)
SetInvertKerf(1)
@@ -554,14 +576,37 @@ Public Class RawPartTabVM
EgtSetInfo(EstCalc.GetRawId(), KEY_INVERT_KERF, -1)
SetInvertKerf(-1)
' aggiorno dati grezzo (partendo dalle dimensioni esterne del grezzo)
m_dLength = dRawLength + 2 * dKerf
m_dWidth = dRawWidth + 2 * dKerf
m_dOffsetX = dRawOffsetX - dKerf
m_dOffsetY = dRawOffsetY - dKerf
If m_PrecKerf >= 0 Then
m_dLength = dRawLength + 2 * dKerf
m_dWidth = dRawWidth + 2 * dKerf
m_dOffsetX = dRawOffsetX - dKerf
m_dOffsetY = dRawOffsetY - dKerf
End If
m_dKerf = -dKerf
If m_PrecKerf >= 0 Then
' definsco la dimensione del grezzo pari a quella del kerf
m_dKerf = 0
AdjustRawPartNegativeKerf(False)
EgtDraw()
UpdateCircles()
EgtDraw()
UpdateRawPartKerf()
EgtDraw()
m_dKerf = -dKerf
m_PrecKerf = 0
End If
If Not AdjustRawPartNegativeKerf() Then
' se fallisce la generazione (TEMPORANEAMENTE) ripristino l'ultimo valore inserito (vedi riga sopra)!
m_dKerf = 0
NotifyPropertyChanged("Kerf")
End If
EgtDraw()
UpdateCircles()
EgtDraw()
' RecalcRawPart()
'EstCalc.UpdateRawPart()
UpdateRawPartKerf()
'UpdateRawPartKerf()
' Recupero id contorno kerf
Dim nKerfId As Integer = EgtGetFirstNameInGroup(EstCalc.GetRawId(), NAME_KERF)
' Modifico il colore
@@ -601,6 +646,8 @@ Public Class RawPartTabVM
End Set
End Property
#End Region ' Parametri Grezzo
Public ReadOnly Property MaterialList As ObservableCollection(Of Material)
Get
Return CurrentMachine.Materials
@@ -1079,6 +1126,8 @@ Public Class RawPartTabVM
ElseIf dRawKerf > Math.Min(m_dTableLength, m_dTableWidth) / 5 Then
dRawKerf = Math.Min(m_dTableLength, m_dTableWidth) / 5
End If
' assegno il valore del Kerf corrente
m_PrecKerf = dRawKerf
If dRawLen < 0 Then
dRawLen = 100
ElseIf dRawLen > m_dTableLength - 2 * dRawKerf Then
@@ -1307,6 +1356,52 @@ Public Class RawPartTabVM
Return True
End Function
' -------------------------------- INIZIO Nuove funzioni per la gestione del Kerf negativo --------------------------------
Private Function AdjustRawPartNegativeKerf(Optional NegativeOffset As Boolean = True) As Boolean
' Se non c'è il grezzo, esco
If EstCalc.GetRawId() = GDB_ID.NULL Then Return False
' Cancello eventuale vecchio contorno di kerf
Dim nKerfId As Integer = EgtGetFirstNameInGroup(EstCalc.GetRawId(), NAME_KERF)
Dim nInvert As Double = 1
If Not NegativeOffset Then
nInvert = -1
End If
Dim dOffset As Double = (-m_dKerf - m_PrecKerf) * nInvert
EgtSaveFile("c:\EgtData\OmagOFFICE\Temp\Error.nge", NGE.TEXT)
Dim nCount As Integer = 0
Dim bOK As Boolean = EgtOffsetCurve(nKerfId, dOffset, OFF_TYPE.EXTEND)
EgtSetColor(nKerfId, m_KerfCol)
' ------ Gestione corretta dei kerf ------
'Dim nNewKerfId As Integer = EgtOffsetCurveAdv(nKerfId, dOffset, OFF_TYPE.EXTEND, nCount)
'EgtSetColor(nNewKerfId, m_KerfCol)
'EgtSetName(nNewKerfId, "Kerf")
'EgtErase(nKerfId)
'-----------------------------------------
' Salvo il valore del kerf (sempre in mm)
EgtSetInfo(EstCalc.GetRawId(), KEY_KERF, m_dKerf)
Return bOK
End Function
Private Function AdjustRawPartPositionNegativeKerf() As Boolean
' Sistemo la posizione
Dim ptRef As New Point3d(m_dOffsetX, m_dOffsetY, CurrentMachine.dAdditionalTable)
If EgtMoveToCornerRawPart(EstCalc.GetRawId(), ptRef, MCH_CR.BL) Then
' Parametro ereditato da OmagCUT
' OkBtn.IsEnabled = True
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
Else
' OkBtn.IsEnabled = False
Dim sMsg As String = EgtMsg(MSG_RAWPARTPAGEUC + 47)
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(sMsg, 3, MSG_TYPE.ERROR_) ' Errore nella posizione o dimensione del grezzo
End If
' Aggiorno visualizzazione
EgtZoom(ZM.ALL)
Return True
End Function
' -------------------------------- FINE Nuove funzioni per la gestione del Kerf negativo --------------------------------
Private Sub UpdateRawPartHeight()
' Se da creare
If EstCalc.GetRawId() = GDB_ID.NULL Then
+10
View File
@@ -469,6 +469,7 @@ Public Class SideEntityControlVM
Parameter23_Visibility = Windows.Visibility.Hidden
Parameter2_Visibility = Visibility.Visible
Parameter2ab_Visibility = Visibility.Hidden
Parameter4_Visibility = Visibility.Hidden
ElseIf m_Mode = ModeOpt.FILOTOP Then
Parameter23_Visibility = Windows.Visibility.Hidden
Parameter2_Visibility = Visibility.Visible
@@ -795,6 +796,13 @@ Public Class SideEntityControlVM
NewEntity.SetbIsCheckedAlz(False)
NewEntity.SetbIsCheckedFront(False)
End If
' inserisco riferimento univoco al lato (solo se non esiste)
Dim sInfoRef As String = String.Empty
EgtGetInfo(CurrLine, "RefAF", sInfoRef)
If String.IsNullOrEmpty(sInfoRef) Then
Dim sRefGUID As String = System.Guid.NewGuid().ToString()
EgtSetInfo(CurrLine, "RefAF", sRefGUID)
End If
EgtSetInfo(NewEntity.nGeomId, "IsModify", 0)
m_SideEntityList.Add(NewEntity)
NotifyPropertyChanged("Legenda_Visibility")
@@ -1020,6 +1028,8 @@ Public Class SideEntityControlVM
End If
Next
If vJoint.Count < 1 Then Return
If vJoint(0) And vJoint(vJoint.Count - 1) Then
bJointStart = True
End If