Compare commits

..

6 Commits

Author SHA1 Message Date
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 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
13 changed files with 725 additions and 25 deletions
@@ -587,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
@@ -621,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"
+2
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"
+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
+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"
+10
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
+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>
+544 -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
@@ -378,6 +379,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 +409,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 +682,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 +717,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 +751,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 +1270,516 @@ 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 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
' 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
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)
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
' 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
' 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
+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
+2 -2
View File
@@ -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.2")>
<Assembly: AssemblyFileVersion("2.4.1.2")>
+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
+7
View File
@@ -795,6 +795,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")