diff --git a/Constants/ConstGen.vb b/Constants/ConstGen.vb index 423eb91..d0929f8 100644 --- a/Constants/ConstGen.vb +++ b/Constants/ConstGen.vb @@ -26,24 +26,27 @@ Module ConstGen ' Abilitazioni licenza Friend Enum KEY_OPT As UInteger - CUT_BASE = 1 ' Prodotto OmagCUT - MAN_MANIP = 2 - AUTO_MANIP = 4 - MAN_PHOTO = 8 - AUTO_PHOTO = 16 - AUTO_NESTING = 32 - ENABLE_MILL = 64 - PROCUCTION_LINE = 128 - OFFICE_BASE = 256 ' Prodotto OmagOFFICE - VM_MULTI = 512 - UNDER_CUT = 1024 - CSV_SIMPLE = 2048 - PHOTO_BASE = 4096 ' Prodotto OmagPHOTO - TRF_IMPORT = 8192 - MOVE_PARTS = 16384 - IMPORT_SLABDXF = 32768 - CURVED_FRAME = 65536 - ENABLE_WJ = 131072 + CUT_BASE = 2 ^ 0 ' 1 - Prodotto OmagCUT + MAN_MANIP = 2 ^ 1 ' 2 + AUTO_MANIP = 2 ^ 2 ' 4 + MAN_PHOTO = 2 ^ 3 ' 8 + AUTO_PHOTO = 2 ^ 4 ' 16 + CSV_AUTO = 2 ^ 5 ' 32 + ENABLE_MILL = 2 ^ 6 ' 64 + PRODUCTION_LINE = 2 ^ 7 ' 128 + OFFICE_BASE = 2 ^ 8 ' 256 - Prodotto OmagOFFICE + VM_MULTI = 2 ^ 9 ' 512 + UNDER_CUT = 2 ^ 10 ' 1024 + CSV_SIMPLE = 2 ^ 11 ' 2048 + PHOTO_BASE = 2 ^ 12 ' 4096 - Prodotto OmagPHOTO + TRF_IMPORT = 2 ^ 13 ' 8192 + MOVE_PARTS = 2 ^ 14 ' 16384 + IMPORT_SLABDXF = 2 ^ 15 ' 32768 + CURVED_FRAME = 2 ^ 16 ' 65536 + ENABLE_WJ = 2 ^ 17 ' 131072 + ENABLE_POLISHING = 2 ^ 18 ' 262144 + OFFICE_TYPE = 2 ^ 19 ' 524288 - Solo per OmagCUT + REGISTRATION = 2 ^ 20 ' 1048576 - Solo per OmagCUT End Enum ' File di log generale diff --git a/EgtStoneLib/CamAuto.vb b/EgtStoneLib/CamAuto.vb index 883d837..6e6809e 100644 --- a/EgtStoneLib/CamAuto.vb +++ b/EgtStoneLib/CamAuto.vb @@ -661,6 +661,7 @@ Friend Module CamAuto Dim dReducedDepth As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_REDUCEDDEPTH, 1, CurrentMachine.sMachIniFile) Dim dHolesOffset As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_HOLES_OFFSET, 0, CurrentMachine.sMachIniFile) Dim dHolesOverlap As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_HOLES_OVERLAP, 0, CurrentMachine.sMachIniFile) + Dim dCutSafety As Double = Math.Max(GetPrivateProfileDouble(S_MACH_NEST, K_MACH_SAFE_LEN_CUT, 1, CurrentMachine.sMachIniFile), 10 * EPS_SMALL) Dim dCornerSafety As Double = Math.Max(GetPrivateProfileDouble(S_MACH_NEST, K_MACH_SAFE_LEN_INTCORNER, 1, CurrentMachine.sMachIniFile), 10 * EPS_SMALL) Dim bOneHoleIntCorner As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_ONEHOLE_INTCORNER, 0, CurrentMachine.sMachIniFile) <> 0) Dim bMillingOnCorners As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_MILLING_ON_CORNERS, 1, CurrentMachine.sMachIniFile) <> 0) @@ -676,6 +677,7 @@ Friend Module CamAuto EgtLuaSetGlobNumVar("CAM.HOLESOFFSET", dHolesOffset) EgtLuaSetGlobNumVar("CAM.HOLESOVERLAP", dHolesOverlap) EgtLuaSetGlobBoolVar("CAM.ONEHOLEINTCORNER", bOneHoleIntCorner) + EgtLuaSetGlobNumVar("CAM.CUTSAFETY", dCutSafety) EgtLuaSetGlobNumVar("CAM.CORNERSAFETY", dCornerSafety) EgtLuaSetGlobBoolVar("CAM.MILLINGONCORNERS", bMillingOnCorners) EgtLuaSetGlobBoolVar("CAM.MILLINGONSINKS", bMillingOnSinks) @@ -813,7 +815,9 @@ Friend Module CamAuto If nPart1Id = GDB_ID.NULL Then Return True ' Verifico se cornice curva Dim nDir As Integer = 0 - Dim bCurved As Boolean = (EgtGetInfo(nPart1Id, INFO_FRAME_DIR, nDir) AndAlso nDir >= 2) + EgtGetInfo(nPart1Id, INFO_FRAME_DIR, nDir) + Dim bSwap As Boolean = ( nDir = 0) + Dim bCurved As Boolean = ( nDir >= 2) ' Recupero la lavorazione corrente di sgrossatura con lama Dim sCurrSawRou As String = CurrentMachine.sCurrSawRoughing If String.IsNullOrEmpty(sCurrSawRou) Then Return True @@ -840,8 +844,8 @@ Friend Module CamAuto ' Imposto la geometria EgtSetMachiningGeometry(vId) ' Imposto trim iniziale e finale - EgtSetMachiningParam(MCH_MP.STARTADDLEN, -dTrimStart) - EgtSetMachiningParam(MCH_MP.ENDADDLEN, -dTrimEnd) + EgtSetMachiningParam(MCH_MP.STARTADDLEN, If( bSwap, -dTrimEnd, -dTrimStart)) + EgtSetMachiningParam(MCH_MP.ENDADDLEN, If( bSwap, -dTrimStart, -dTrimEnd)) ' Se cornice curva, imposto SCC If bCurved Then EgtSetMachiningParam(MCH_MP.SOLCHOICETYPE, MCH_SCC.ADIR_NEAR) ' Applico la lavorazione @@ -860,7 +864,9 @@ Friend Module CamAuto If nPart1Id = GDB_ID.NULL Then Return True ' Verifico se cornice curva Dim nDir As Integer = 0 - Dim bCurved As Boolean = (EgtGetInfo(nPart1Id, INFO_FRAME_DIR, nDir) AndAlso nDir >= 2) + EgtGetInfo( nPart1Id, INFO_FRAME_DIR, nDir) + Dim bSwap As Boolean = ( nDir = 0) + Dim bCurved As Boolean = ( nDir >= 2) ' Recupero la lavorazione corrente di finitura con lama Dim sCurrSawFin As String = CurrentMachine.sCurrSawFinishing If String.IsNullOrEmpty(sCurrSawFin) Then Return True @@ -897,8 +903,8 @@ Friend Module CamAuto ' Imposto la geometria EgtSetMachiningGeometry(vId) ' Imposto trim iniziale e finale - EgtSetMachiningParam(MCH_MP.STARTADDLEN, -dTrimStart) - EgtSetMachiningParam(MCH_MP.ENDADDLEN, -dTrimEnd) + EgtSetMachiningParam(MCH_MP.STARTADDLEN, If( bSwap, -dTrimEnd, -dTrimStart)) + EgtSetMachiningParam(MCH_MP.ENDADDLEN, If( bSwap, -dTrimStart, -dTrimEnd)) ' Se cornice curva, imposto SCC If bCurved Then EgtSetMachiningParam(MCH_MP.SOLCHOICETYPE, MCH_SCC.ADIR_NEAR) ' Applico la lavorazione @@ -917,7 +923,9 @@ Friend Module CamAuto If nPart1Id = GDB_ID.NULL Then Return True ' Verifico se cornice curva Dim nDir As Integer = 0 - Dim bCurved As Boolean = (EgtGetInfo(nPart1Id, INFO_FRAME_DIR, nDir) AndAlso nDir >= 2) + EgtGetInfo(nPart1Id, INFO_FRAME_DIR, nDir) + Dim bSwap As Boolean = ( nDir = 0) + Dim bCurved As Boolean = ( nDir >= 2) ' Recupero la lavorazione corrente di spatolatura con lama Dim sCurrSawSideFin As String = CurrentMachine.sCurrSawSideFinishing If String.IsNullOrEmpty(sCurrSawSideFin) Then Return True @@ -938,8 +946,8 @@ Friend Module CamAuto ' Imposto la geometria EgtSetMachiningGeometry(vId) ' Imposto trim iniziale e finale - EgtSetMachiningParam(MCH_MP.STARTADDLEN, -dTrimStart) - EgtSetMachiningParam(MCH_MP.ENDADDLEN, -dTrimEnd) + EgtSetMachiningParam(MCH_MP.STARTADDLEN, If( bSwap, -dTrimEnd, -dTrimStart)) + EgtSetMachiningParam(MCH_MP.ENDADDLEN, If( bSwap, -dTrimStart, -dTrimEnd)) ' Se cornice curva, imposto SCC If bCurved Then EgtSetMachiningParam(MCH_MP.SOLCHOICETYPE, MCH_SCC.ADIR_NEAR) ' Applico la lavorazione diff --git a/EgtStoneLib/ConstMach.vb b/EgtStoneLib/ConstMach.vb index 8d2337e..7d14258 100644 --- a/EgtStoneLib/ConstMach.vb +++ b/EgtStoneLib/ConstMach.vb @@ -29,6 +29,12 @@ Module ConstMach Public Const KEY_VAC_TYPE As String = "VacType" ' Nome gruppo layout in testa con ventose Public Const VACUUM_HEAD_LAYOUT As String = "LAYOUT" + ' Base di info in gruppo layout per selezioni di ventose da verificare + Public Const KEY_VACLAY_SEL As String = "Sel" + ' Info in gruppo layout per angolo di rotazione preferito + Public Const KEY_VACLAY_PREFROT As String = "PreferredRot" + ' Info in gruppo layout per direzione di riferimento ventose per tagli da sotto + Public Const KEY_VACLAY_DRIPREFDIR As String = "DripRefDir" ' Info in asse rotante ventosa per step discreti Public Const KEY_ROTVAC_STEPS As String = "STEPS" ' Nome oggetto frame prima uscita di una testa @@ -150,6 +156,15 @@ Module ConstMach Public Const INFO_DIR As String = "Dir" ' Info in entità da tagliare per abilitare possibilità di inversione Public Const INFO_ENABLE_INVERT As String = "EnInv" + ' Info in entità da tagliare per angolo con entità precedente e successiva + Public Const INFO_PREVANG As String = "PrevAng" + Public Const INFO_NEXTANG As String = "NextAng" + ' Info in entità da tagliare per lunghezza libera prima dell'inizio + Public Const INFO_START_FREELEN As String = "SFL" + ' Info in entità da tagliare per lunghezza libera dopo la fine + Public Const INFO_END_FREELEN As String = "EFL" + ' Angolo esterno minimo per calcolare la direzione libera sull'arco + Public Const FL_ARC_ANG_MIN As Double = 30 ' Info in preview lavorazione con identificativo layer preview spostato nel pezzo Public Const INFO_PV_ONPART_ID As String = "PvId" ' Info in lavorazione con identificativo lavorazioni inglobate @@ -240,6 +255,9 @@ Module ConstMach ' Costante per flag di BBox Public Const BBFLAG As Integer = GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM + ' Lunghezza libera infinita + Public Const FREELEN_INF = 9999 + ' Colori per lavorazioni Public Function COL_MCH_CUT() As Color3d Return New Color3d(0, 255, 0) diff --git a/EgtStoneLib/ConstMachIni.vb b/EgtStoneLib/ConstMachIni.vb index 3cb3bd4..9f21c7b 100644 --- a/EgtStoneLib/ConstMachIni.vb +++ b/EgtStoneLib/ConstMachIni.vb @@ -51,6 +51,7 @@ Public Const K_POWER As String = "Power" Public Const K_SPINDLE As String = "Spindle" Public Const K_LASER As String = "Laser" + Public Const K_LASERTRAC As String = "LaserTrac" Public Const K_COOLANT As String = "Coolant" Public Const K_INTERNALCOOLANT As String = "InternalCoolant" Public Const K_EXTERNCOOLANT As String = "ExternCoolant" @@ -68,14 +69,24 @@ Public Const K_POWEROVR As String = "PowerOvr" Public Const K_VACUUMUP As String = "VacuumUp" Public Const K_VACUUMDOWN As String = "VacuumDown" + Public Const K_VACUUM2UP As String = "Vacuum2Up" + Public Const K_VACUUM2DOWN As String = "Vacuum2Down" Public Const K_VACUUM0 As String = "Vacuum0" Public Const K_VACUUM90 As String = "Vacuum90" - Public Const K_VACUU3STATE As String = "Vacuum3State" - Public Const K_VACUU4STATE As String = "Vacuum4State" - Public Const K_VACUU135STATE As String = "Vacuum135State" - Public Const K_VACUU246STATE As String = "Vacuum246State" + Public Const K_VACUUM1STATE As String = "Vacuum1State" + Public Const K_VACUUM2STATE As String = "Vacuum2State" + Public Const K_VACUUM3STATE As String = "Vacuum3State" + Public Const K_VACUUM4STATE As String = "Vacuum4State" + Public Const K_VACUUM5STATE As String = "Vacuum5State" + Public Const K_VACUUM6STATE As String = "Vacuum6State" + Public Const K_VACUUM135STATE As String = "Vacuum135State" + Public Const K_VACUUM246STATE As String = "Vacuum246State" Public Const K_OPENALLSTATE As String = "OpenAllState" Public Const K_CLOSEALLSTATE As String = "CloseAllState" + Public Const K_OPEN123STATE As String = "Open123State" + Public Const K_OPEN456STATE As String = "Open456State" + Public Const K_CLOSE123STATE As String = "Close123State" + Public Const K_CLOSE456STATE As String = "Close456State" Public Const K_BLOWSTATE As String = "BlowState" Public Const K_VACUUMSTATE As String = "VacuumState" Public Const K_VACUUMON As String = "VacuumOn" @@ -93,6 +104,7 @@ Public Const K_SPECIALUNLOAD As String = "SpecialUnload" Public Const K_SAVEPRODUCED As String = "SaveProduced" Public Const K_VARPROGTWINS As String = "VarProgTwins" + Public Const K_ASKNEWONRESEND As String = "AskNewOnResend" Public Const K_PRODLIENABLESAWPROBE As String = "EnableSawProbe" Public Const K_PRODLIPROBINGSTATEVAR As String = "ProbingStateVar" Public Const K_PRODLIPROBINGTCPOSVAR As String = "ProbingTcPosVar" @@ -101,6 +113,10 @@ Public Const K_PRODLIPROBINGTCPOS2VAR As String = "ProbingTcPos2Var" Public Const K_PRODLISAWDIAMETER2VAR As String = "SawDiameter2Var" + Public Const S_STATISTICS As String = "Stats" + Public Const K_DATADIR As String = "DataDir" + Public Const K_SHOWAREAS As String = "ShowAreas" + Public Const S_TABLE As String = "Table" Public Const K_ADDITIONALTABLE As String = "AdditionalTable" Public Const K_TAB2_ADDITIONALTABLE As String = "Tab2AdditionalTable" @@ -117,7 +133,8 @@ Public Const K_DRILLBIT As String = "Drillbit" Public Const K_SAWBLADE As String = "Sawblade" Public Const K_MILL As String = "Mill" - Public Const K_MILLNOTIP As String = "MillNoTip" + Public Const K_CUPWHEEL As String = "CupWheel" + Public Const K_POLISHINGWHEEL As String = "PolishingWheel" Public Const K_WATERJET As String = "WaterJet" Public Const K_SHOWTOOLCHANGER As String = "ShowToolChanger" Public Const K_SHOWHEADEXIT As String = "ShowHeadExit" @@ -138,9 +155,11 @@ Public Const K_DRILLING As String = "Drilling" Public Const K_MILLING As String = "Milling" Public Const K_POCKETING As String = "Pocketing" + Public Const K_POLISHING As String = "Polishing" Public Const K_SAWROUGHING As String = "SawRoughing" Public Const K_SAWFINISHING As String = "SawFinishing" Public Const K_WATERJETTING As String = "WaterJetting" + Public Const K_SAWINGSPECIALLEADIN As String = "SawingSpecialLeadIn" Public Const S_MACH_NEST As String = "Nest" Public Const K_MACH_HOLES_OFFSET As String = "HolesOffset" @@ -156,6 +175,9 @@ Public Const K_MACH_MILLING_ON_CORNERS As String = "MillingOnCorners" Public Const K_MACH_MILLING_ON_SINKS As String = "MillingOnSinks" Public Const K_MACH_MILLING_SHORTENING As String = "MillingShortening" + Public Const K_MACH_ENGRAVING_WITHMILL As String = "EngravingWithMill" + Public Const K_MACH_ENGRAVING_DEPTH As String = "EngravingDepth" + Public Const K_MACH_ENGRAVING_WIDTH As String = "EngravingWidth" Public Const K_MACH_NEST_ALIGNED As String = "Aligned" Public Const K_MACH_NEST_AUTOMATIC As String = "Automatic" Public Const K_MACH_WASHING As String = "Washing" @@ -188,6 +210,7 @@ Public Const S_MACH_DIRECTCUTS As String = "DirectCuts" Public Const K_FINALHOME As String = "FinalHome" + Public Const K_ADDSAWTHTO5AXMOVE As String = "AddSawThTo5AxMove" Public Const S_MACHBUTTONS As String = "MachButtons" Public Const S_CONTROLMACHBUTTONS As String = "ControlMachButtons" diff --git a/EgtStoneLib/CurrentMachine.vb b/EgtStoneLib/CurrentMachine.vb index f043d51..81555c5 100644 --- a/EgtStoneLib/CurrentMachine.vb +++ b/EgtStoneLib/CurrentMachine.vb @@ -79,7 +79,8 @@ Public Module CurrentMachine Private m_bSaw As Boolean = False Private m_bDrill As Boolean = False Private m_bMill As Boolean = False - Private m_bMillNoTip As Boolean = False + Private m_bCupWheel As Boolean = False + Private m_bPolishingWheel As Boolean = False Private m_bWaterJet As Boolean = False ' Flag per visualizzazione TcPos, Testa/uscita e Note utente @@ -92,9 +93,11 @@ Public Module CurrentMachine Private m_bDrilling As Boolean = False Private m_bMilling As Boolean = False Private m_bPocketing As Boolean = False + Private m_bPolishing As Boolean = False Private m_bSawRoughing As Boolean = False Private m_bSawFinishing As Boolean = False Private m_bWaterJetting As Boolean = False + Private m_bSawingSpecialLeadIn As Boolean = False ' Variabili che contengono il nome degli utensili disponibili per tipo Private m_sCurrSaw As String = String.Empty @@ -503,9 +506,15 @@ Public Module CurrentMachine End Get End Property - Friend ReadOnly Property bMillNoTip As Boolean + Friend ReadOnly Property bCupWheel As Boolean Get - Return m_bMillNoTip + Return m_bCupWheel + End Get + End Property + + Friend ReadOnly Property bPolishingWheel As Boolean + Get + Return m_bPolishingWheel End Get End Property @@ -521,7 +530,7 @@ Public Module CurrentMachine End Get End Property - Public ReadOnly Property bShowHeadExit As Boolean + Friend ReadOnly Property bShowHeadExit As Boolean Get Return m_bShowHeadExit End Get @@ -533,43 +542,61 @@ Public Module CurrentMachine End Get End Property - Public ReadOnly Property bSawing As Boolean + Friend ReadOnly Property bSawing As Boolean Get Return m_bSawing End Get End Property - Public ReadOnly Property bDrilling As Boolean + Friend ReadOnly Property bDrilling As Boolean Get Return m_bDrilling End Get End Property - Public ReadOnly Property bMilling As Boolean + Friend ReadOnly Property bMilling As Boolean Get Return m_bMilling End Get End Property - Public ReadOnly Property bSawRoughing As Boolean + Friend ReadOnly Property bPocketing As Boolean + Get + Return m_bPocketing + End Get + End Property + + Friend ReadOnly Property bPolishing As Boolean + Get + Return m_bPolishing + End Get + End Property + + Friend ReadOnly Property bSawRoughing As Boolean Get Return m_bSawRoughing End Get End Property - Public ReadOnly Property bSawFinishing As Boolean + Friend ReadOnly Property bSawFinishing As Boolean Get Return m_bSawFinishing End Get End Property - Public ReadOnly Property bWaterJetting As Boolean + Friend ReadOnly Property bWaterJetting As Boolean Get Return m_bWaterJetting End Get End Property - Public Property sCurrSaw As String + Friend ReadOnly Property bSawingSpecialLeadIn As Boolean + Get + Return m_bSawingSpecialLeadIn + End Get + End Property + + Friend Property sCurrSaw As String Get Return m_sCurrSaw End Get @@ -580,7 +607,7 @@ Public Module CurrentMachine End Set End Property - Public Property sCurrDrill As String + Friend Property sCurrDrill As String Get Return m_sCurrDrill End Get @@ -591,7 +618,7 @@ Public Module CurrentMachine End Set End Property - Public Property sCurrMill As String + Friend Property sCurrMill As String Get Return m_sCurrMill End Get @@ -602,7 +629,7 @@ Public Module CurrentMachine End Set End Property - Public Property sCurrDripSaw As String + Friend Property sCurrDripSaw As String Get Return m_sCurrDripSaw End Get @@ -613,7 +640,7 @@ Public Module CurrentMachine End Set End Property - Public Property sCurrDripDrill As String + Friend Property sCurrDripDrill As String Get Return m_sCurrDripDrill End Get @@ -624,7 +651,7 @@ Public Module CurrentMachine End Set End Property - Public Property sCurrWaterJet As String + Friend Property sCurrWaterJet As String Get Return m_sCurrWaterJet End Get @@ -635,7 +662,7 @@ Public Module CurrentMachine End Set End Property - Public Property sCurrSawing As String + Friend Property sCurrSawing As String Get Return m_sCurrSawing End Get @@ -646,7 +673,7 @@ Public Module CurrentMachine End Set End Property - Public Property sCurrDrilling As String + Friend Property sCurrDrilling As String Get Return m_sCurrDrilling End Get @@ -657,7 +684,7 @@ Public Module CurrentMachine End Set End Property - Public Property sCurrMilling As String + Friend Property sCurrMilling As String Get Return m_sCurrMilling End Get @@ -679,7 +706,7 @@ Public Module CurrentMachine End Set End Property - Public Property sCurrSawRoughing As String + Friend Property sCurrSawRoughing As String Get Return m_sCurrSawRoughing End Get @@ -690,7 +717,7 @@ Public Module CurrentMachine End Set End Property - Public Property sCurrSawFinishing As String + Friend Property sCurrSawFinishing As String Get Return m_sCurrSawFinishing End Get @@ -701,7 +728,7 @@ Public Module CurrentMachine End Set End Property - Public Property sCurrSawSideFinishing As String + Friend Property sCurrSawSideFinishing As String Get Return m_sCurrSawSideFinishing End Get @@ -723,7 +750,7 @@ Public Module CurrentMachine End Set End Property - Public Property sCurrDripSawing As String + Friend Property sCurrDripSawing As String Get Return m_sCurrDripSawing End Get @@ -762,7 +789,7 @@ Public Module CurrentMachine End Get End Property - Public Property dAdditionalTable As Double + Friend Property dAdditionalTable As Double Get Select Case GetCurrentTable() Case 3 @@ -827,7 +854,7 @@ Public Module CurrentMachine End Get End Property - Public Property bDirectCutsFinalHome As Boolean + Friend Property bDirectCutsFinalHome As Boolean Get Return m_bDirectCutsFinalHome End Get @@ -866,19 +893,19 @@ Public Module CurrentMachine End Set End Property - Public ReadOnly Property ToolChangerNbr As Integer + Friend ReadOnly Property ToolChangerNbr As Integer Get Return m_ToolChangerNbr End Get End Property - Public ReadOnly Property ToolChanger As List(Of ToolChangerPos) + Friend ReadOnly Property ToolChanger As List(Of ToolChangerPos) Get Return m_ToolChanger End Get End Property - Public ReadOnly Property ToolChangerName(Index As Integer) As String + Friend ReadOnly Property ToolChangerName(Index As Integer) As String Get If Index >= 0 And Index < m_ToolChanger.Count Then Return m_ToolChanger(Index).sName @@ -888,7 +915,7 @@ Public Module CurrentMachine End Get End Property - Public WriteOnly Property ToolPos(Index As Integer) As String + Friend WriteOnly Property ToolPos(Index As Integer) As String Set(value As String) If value <> m_ToolChanger(Index).sTool Then m_ToolChanger(Index).sTool = value @@ -897,19 +924,19 @@ Public Module CurrentMachine End Set End Property - Public ReadOnly Property ManualToolChangerNbr As Integer + Friend ReadOnly Property ManualToolChangerNbr As Integer Get Return m_ManualToolChangerNbr End Get End Property - Public ReadOnly Property ManualToolChanger As List(Of ToolChangerPos) + Friend ReadOnly Property ManualToolChanger As List(Of ToolChangerPos) Get Return m_ManualToolChanger End Get End Property - Public ReadOnly Property ManualToolChangerName(Index As Integer) As String + Friend ReadOnly Property ManualToolChangerName(Index As Integer) As String Get If Index >= 0 And Index < m_ManualToolChanger.Count Then Return m_ManualToolChanger(Index).sName @@ -919,7 +946,7 @@ Public Module CurrentMachine End Get End Property - Public WriteOnly Property ManualToolPos(Index As Integer) As String + Friend WriteOnly Property ManualToolPos(Index As Integer) As String Set(value As String) If value <> m_ManualToolChanger(Index).sTool Then m_ManualToolChanger(Index).sTool = value @@ -928,13 +955,13 @@ Public Module CurrentMachine End Set End Property - Public ReadOnly Property Materials As ObservableCollection(Of Material) + Friend ReadOnly Property Materials As ObservableCollection(Of Material) Get Return m_Materials End Get End Property - Public Sub AddMaterial(value As Material) + Friend Sub AddMaterial(value As Material) For Each Material In Materials If Material.nId = value.nId Then Exit Sub @@ -945,7 +972,7 @@ Public Module CurrentMachine m_Materials.Add(value) End Sub - Public Sub RemoveMaterial(value As Material) + Friend Sub RemoveMaterial(value As Material) ' Se è il materiale corrente lo tolgo If Not IsNothing(CurrMat) AndAlso CurrMat.nId = value.nId Then CurrMat = Nothing @@ -989,7 +1016,7 @@ Public Module CurrentMachine End Sub ' Funzione che dato l'Id di un materiale lo rimuove dalla lavorazione corrente - Public Sub SearchAndRemoveMat(valueId As Integer) + Friend Sub SearchAndRemoveMat(valueId As Integer) Dim SysNotes As String = String.Empty EgtMdbGetCurrMachiningParam(MCH_MP.SYSNOTES, SysNotes) If SysNotes <> String.Empty Then @@ -1009,7 +1036,7 @@ Public Module CurrentMachine EgtMdbSaveCurrMachining() End Sub - Public Property CurrMat As Material + Friend Property CurrMat As Material Get Return m_CurrMat End Get @@ -1023,7 +1050,7 @@ Public Module CurrentMachine End Set End Property - Public Function SetCurrMatByName(sMatName As String) As Boolean + Friend Function SetCurrMatByName(sMatName As String) As Boolean ' Reset del materiale corrente CurrMat = Nothing ' Verifico il nome @@ -1038,7 +1065,7 @@ Public Module CurrentMachine Return False End Function - Public ReadOnly Property bHasRawProbe As Boolean + Friend ReadOnly Property bHasRawProbe As Boolean Get Return m_HasRawProbe End Get @@ -1047,7 +1074,7 @@ Public Module CurrentMachine #End Region Sub InitCurrentMachine(sMachinesRootDir As String, sMachineName As String, - bKeyProdLine As Boolean, bKeyMill As Boolean, bKeyWJ As Boolean, Optional bOffice As Boolean = False) + bKeyProdLine As Boolean, bKeyMill As Boolean, bKeyPolish As Boolean, bKeyWJ As Boolean, Optional bOffice As Boolean = False) ' Modalità OFFICE m_bOffice = bOffice ' Nome macchina corrente @@ -1119,8 +1146,10 @@ Public Module CurrentMachine m_bDrill = (GetPrivateProfileInt(S_TOOLS, K_DRILLBIT, 0, sMachIniFile) > 0) ' fresa m_bMill = (GetPrivateProfileInt(S_TOOLS, K_MILL, 0, sMachIniFile) > 0) And bKeyMill - ' mola - m_bMillNoTip = (GetPrivateProfileInt(S_TOOLS, K_MILLNOTIP, 0, sMachIniFile) > 0) And bKeyMill + ' mola da scasso + m_bCupWheel = (GetPrivateProfileInt(S_TOOLS, K_CUPWHEEL, 0, sMachIniFile) > 0) And bKeyMill + ' lucidante + m_bPolishingWheel = (GetPrivateProfileInt(S_TOOLS, K_POLISHINGWHEEL, 0, sMachIniFile) > 0) And bKeyPolish ' waterjet m_bWaterJet = (GetPrivateProfileInt(S_TOOLS, K_WATERJET, 0, sMachIniFile) > 0) And bKeyWJ ' Leggo abilitazione visualizzazione TcPos e Head/exit @@ -1141,14 +1170,18 @@ Public Module CurrentMachine m_bDrilling = (GetPrivateProfileInt(S_MACHININGS, K_DRILLING, 0, sMachIniFile) > 0) ' fresa m_bMilling = (GetPrivateProfileInt(S_MACHININGS, K_MILLING, 0, sMachIniFile) > 0) And bKeyMill - ' mola + ' svuotatura m_bPocketing = (GetPrivateProfileInt(S_MACHININGS, K_POCKETING, 0, sMachIniFile) > 0) And bKeyMill + ' lucidatura + m_bPolishing = (GetPrivateProfileInt(S_MACHININGS, K_POLISHING, 0, sMachIniFile) > 0) And bKeyMill ' sgrossatura con lama m_bSawRoughing = (GetPrivateProfileInt(S_MACHININGS, K_SAWROUGHING, 0, sMachIniFile) > 0) ' finitura con lama m_bSawFinishing = (GetPrivateProfileInt(S_MACHININGS, K_SAWFINISHING, 0, sMachIniFile) > 0) ' waterjetting m_bWaterJetting = (GetPrivateProfileInt(S_MACHININGS, K_WATERJETTING, 0, sMachIniFile) > 0) And bKeyWJ + ' possibilità di definire attacco speciale per materiali ceramici + m_bSawingSpecialLeadIn = (GetPrivateProfileInt(S_MACHININGS, K_SAWINGSPECIALLEADIN, 0, sMachIniFile) > 0) ' Leggo utensili correnti ' lama @@ -1267,7 +1300,7 @@ Public Module CurrentMachine m_HasRawProbe = (GetPrivateProfileInt(S_MACH_PROBING, K_ENABLERAWPROBE, 1, sMachIniFile) <> 0) End Sub - Public Function IsVacuumMovePossible() As Boolean + Friend Function IsVacuumMovePossible() As Boolean ' Recupero lama della lavorazione di lama corrente EgtMdbSetCurrMachining(sCurrSawing) Dim sTuuid As String = String.Empty @@ -1282,7 +1315,7 @@ Public Module CurrentMachine Return (dToolDiam <= dMaxSawDiamForVac) End Function - Public Function IsRawProbingPossible() As Boolean + Friend Function IsRawProbingPossible() As Boolean ' Recupero lama della lavorazione di lama corrente EgtMdbSetCurrMachining(sCurrSawing) Dim sTuuid As String = String.Empty @@ -1297,7 +1330,7 @@ Public Module CurrentMachine Return (dToolDiam <= dMaxSawDiamForProbe) End Function - Public Function GetPrivateProfileMaterial( + Friend Function GetPrivateProfileMaterial( ByVal lpAppName As String, ByVal lpKeyName As String, ByRef Material As Material, @@ -1316,7 +1349,7 @@ Public Module CurrentMachine End Function - Public Function WritePrivateProfileMaterial( + Friend Function WritePrivateProfileMaterial( ByVal lpAppName As String, ByVal lpKeyName As String, ByVal Material As Material, @@ -1334,7 +1367,7 @@ Public Module CurrentMachine End Module -Public Class ToolChangerPos +Class ToolChangerPos Private m_nPosition As Integer Private m_sName As String = String.Empty diff --git a/EgtStoneLib/GeomCalc.vb b/EgtStoneLib/GeomCalc.vb index 93f34e7..c7a8685 100644 --- a/EgtStoneLib/GeomCalc.vb +++ b/EgtStoneLib/GeomCalc.vb @@ -54,4 +54,15 @@ Module GeomCalc Return True End Function + Friend Function GetPartArea( nPartId As Integer) As Double + Dim nRegId As Integer = EgtGetFirstNameInGroup( nPartId, NAME_REGION) + Dim nSurfId As Integer = EgtGetFirstInGroup( nRegId) + While nSurfId <> GDB_ID.NULL and EgtGetType( nSurfId) <> GDB_TY.SRF_FRGN + nSurfId = EgtGetNext( nSurfId) + End While + Dim dArea As Double = 0 + EgtSurfFrGrossArea( nSurfId, dArea) + Return dArea + End Function + End Module diff --git a/EgtStoneLib/SplitAuto.vb b/EgtStoneLib/SplitAuto.vb index 7bc00cb..b25b959 100644 --- a/EgtStoneLib/SplitAuto.vb +++ b/EgtStoneLib/SplitAuto.vb @@ -21,6 +21,11 @@ Public Module SplitAuto Public m_bEnabled As Boolean Public m_bPause As Boolean Public m_bInvert As Boolean + Public m_bIsLine As Boolean + Public m_dPrevAng As Double + Public m_dNextAng As Double + Public m_dStartFreeLen As Double + Public m_dEndFreeLen As Double End Class '----------------------------------------------------------------------------------------------- @@ -66,6 +71,8 @@ Public Module SplitAuto End If ' la imposto come lavorazione corrente EgtSetCurrMachining(nOperId) + ' inversione + EgtGetMachiningParam(MCH_MP.INVERT, Mach.m_bInvert) ' recupero l'angolo di fianco EgtGetMachiningParam(MCH_MP.SIDEANGLE, Mach.m_dSideAng) ' recupero allungamento iniziale e finale (negativi vicino ad angoli interni) @@ -73,17 +80,28 @@ Public Module SplitAuto EgtGetMachiningParam(MCH_MP.STARTADDLEN, dStartAddLen) Dim dEndAddLen As Double = -10 EgtGetMachiningParam(MCH_MP.ENDADDLEN, dEndAddLen) + ' recupero tipo entità, ancolo con entità precedente e successiva, lunghezze libere iniziale e finale + Mach.m_bIsLine = True + Mach.m_dPrevAng = 0 + Mach.m_dNextAng = 0 + Mach.m_dStartFreeLen = FREELEN_INF + 1 + Mach.m_dEndFreeLen = FREELEN_INF + 1 + Dim nEntId, nSub As Integer + If EgtGetMachiningGeometry( 0, nEntId, nSub) Then + If EgtGetType( nEntId) = GDB_TY.CRV_ARC OrElse EgtGetType( nEntId) = GDB_TY.CRV_COMPO Then Mach.m_bIsLine = False + EgtGetInfo( nEntId, If( Not Mach.m_bInvert, INFO_PREVANG, INFO_NEXTANG), Mach.m_dPrevAng) + EgtGetInfo( nEntId, If( Not Mach.m_bInvert, INFO_NEXTANG, INFO_PREVANG), Mach.m_dNextAng) + EgtGetInfo( nEntId, If( Not Mach.m_bInvert, INFO_START_FREELEN, INFO_END_FREELEN), Mach.m_dStartFreeLen) + EgtGetInfo( nEntId, If( Not Mach.m_bInvert, INFO_END_FREELEN, INFO_START_FREELEN), Mach.m_dEndFreeLen) + End If ' verifico se trasformabile in un taglio di separazione (almeno da un lato) - 'If Math.Abs(Mach.m_dSideAng) < EPS_ANG_SMALL And - If True And - (dStartAddLen > -EPS_SMALL Or dEndAddLen > -EPS_SMALL) And + If (dStartAddLen > -EPS_SMALL Or dEndAddLen > -EPS_SMALL) And Mach.m_sLay = NAME_OUTLOOP And Mach.m_nInterf = FMI_TYPE.NONE Then Dim nRes As Integer = EgtVerifyCutAsSplitting(nOperId) - Mach.m_bCanStartAll = (dStartAddLen > -EPS_SMALL And (nRes And CAR_RES.LI_OK) <> 0) - Mach.m_bCanEndAll = (dEndAddLen > -EPS_SMALL And (nRes And CAR_RES.LO_OK) <> 0) - Else - Mach.m_bCanStartAll = False - Mach.m_bCanEndAll = False + Mach.m_bCanStartAll = (dStartAddLen > -EPS_SMALL And (nRes And CAR_RES.LI_OK) <> 0) And + Mach.m_dStartFreeLen > FREELEN_INF And Mach.m_bIsLine + Mach.m_bCanEndAll = (dEndAddLen > -EPS_SMALL And (nRes And CAR_RES.LO_OK) <> 0) And + Mach.m_dEndFreeLen > FREELEN_INF And Mach.m_bIsLine End If ' se trasformabile in taglio di separazione, verifico se lo è If Mach.m_bCanStartAll Or Mach.m_bCanEndAll Then @@ -120,8 +138,6 @@ Public Module SplitAuto Mach.m_bEnabled = Not EgtExistsInfo(nOperId, INFO_MCH_USER_OFF) ' pausa Mach.m_bPause = GetPause(nOperId) - ' inversione - EgtGetMachiningParam(MCH_MP.INVERT, Mach.m_bInvert) ' inserisco in lista MachSplitList.Add(Mach) ' altrimenti la disattivo @@ -556,7 +572,7 @@ Public Module SplitAuto If EgtGetGroupObjs(nPv2Id) = 0 Then EgtGetInfo(nPv2Id, INFO_PV_ONPART_ID, nPv2Id) Dim nRLiCut2Id As Integer = EgtGetFirstNameInGroup(EgtGetFirstGroupInGroup(nPv2Id), NAME_PV_RLICUT) ' Verifico se questa regione interferisce con quella del taglio di riferimento - If EgtSurfFrChunkSimpleClassify(nRCutId, 0, nRLiCut2Id, 0) <> REGC.OUT Then Return True + If EgtSurfFrChunkSimpleClassify(nRCutId, 0, nRLiCut2Id, 0, 20 * EPS_SMALL) <> REGC.OUT Then Return True End If ' Se il secondo ha l'uscita che interferisce If (nInterf2 And FMI_TYPE.LO) <> 0 Then @@ -565,7 +581,7 @@ Public Module SplitAuto If EgtGetGroupObjs(nPv2Id) = 0 Then EgtGetInfo(nPv2Id, INFO_PV_ONPART_ID, nPv2Id) Dim nRLoCut2Id As Integer = EgtGetFirstNameInGroup(EgtGetFirstGroupInGroup(nPv2Id), NAME_PV_RLOCUT) ' Verifico se questa regione interferisce con quella del taglio di riferimento - If EgtSurfFrChunkSimpleClassify(nRCutId, 0, nRLoCut2Id, 0) <> REGC.OUT Then Return True + If EgtSurfFrChunkSimpleClassify(nRCutId, 0, nRLoCut2Id, 0, 20 * EPS_SMALL) <> REGC.OUT Then Return True End If Return False End Function diff --git a/EgtStoneLib/VacuumCups.vb b/EgtStoneLib/VacuumCups.vb index 87ba68e..2b507ba 100644 --- a/EgtStoneLib/VacuumCups.vb +++ b/EgtStoneLib/VacuumCups.vb @@ -7,6 +7,8 @@ Module VacuumCups Private m_nTempId As Integer = GDB_ID.NULL Private m_nVacId As Integer = GDB_ID.NULL Private m_nRefId As Integer = GDB_ID.NULL + Private m_dPreferredRot As Double = 0 + Private m_dDripRefAng As Double = 0 ' Nome del gruppo temporaneo per le ventose Private Const VACTMP_GRP As String = "VacTmp" @@ -70,6 +72,10 @@ Module VacuumCups ' Eseguo copia in globale m_nVacId = EgtCopyGlob(nLayId, m_nTempId) If m_nVacId = GDB_ID.NULL Then Return False + ' Angolo di rotazione preferito + EgtGetInfo( m_nVacId, KEY_VACLAY_PREFROT, m_dPreferredRot) + ' Direzione di riferimento per tagli Drip + EgtGetInfo( m_nVacId, KEY_VACLAY_DRIPREFDIR, m_dDripRefAng) ' Nascondo il gruppo ma rendo visibili le curve di contorno delle ventose EgtSetStatus(m_nVacId, GDB_ST.OFF) Dim nId As Integer = EgtGetFirstInGroup(m_nVacId) @@ -182,6 +188,28 @@ Module VacuumCups ResetVacuumCups() ' Verifico sia veramente un pezzo If EgtGetRawPartFromPart(nPartId) = GDB_ID.NULL Then Return False + ' Cerco la direzione del primo taglio attivo da sotto + Dim nDripLayId As Integer = EgtGetFirstNameInGroup( nPartId, NAME_DRIPCUT) + Dim nDripLineId As Integer = EgtGetFirstInGroup( nDripLayId) + While nDripLayId <> GDB_ID.NULL + Dim nMchId As Integer = EgtGetOperationId( "DripSaw" & nDripLineId.ToString()) + Dim nMode As Integer + If EgtGetMode( nMchId, nMode) AndAlso nMode = GDB_MD.STD Then Exit While + nDripLineId = EgtGetNext( nDripLineId) + End While + Dim vtDir As New Vector3d + if EgtStartVector( nDripLineId, GDB_ID.ROOT, vtDir) Then + Dim dLen, dAngV, dAngH As Double + vtDir.ToSpherical( dLen, dAngV, dAngH) + Dim dOffsAng = dAngH - m_dDripRefAng + While dOffsAng - m_dPreferredRot >= 90 + dOffsAng -= 180 + End While + While dOffsAng - m_dPreferredRot <= -90 + dOffsAng += 180 + End While + m_dPreferredRot = dOffsAng + End If ' Recupero la regione del pezzo Dim nGrpRegId As Integer = EgtGetFirstNameInGroup(nPartId, NAME_REGION) Dim nRegId As Integer = EgtGetFirstInGroup(nGrpRegId) @@ -282,7 +310,7 @@ Module VacuumCups Private Function GetVacuumCupSelection(nInd As Integer, ByRef sCups() As String, ByRef sCups2() As String) As Boolean ' Recupero elenco ventose nella soluzione - Dim sSel As String = "Sel" & nInd.ToString() + Dim sSel As String = KEY_VACLAY_SEL & nInd.ToString() Dim sVal As String = String.Empty If Not EgtGetInfo(m_nVacId, sSel, sVal) Then Return False If sVal.IndexOf("/") >= 0 Then @@ -346,17 +374,18 @@ Module VacuumCups frMinRect.VersX().ToSpherical(dLen, dAngVertDeg, dAngOrizzDeg) dRotAngDeg = dAngOrizzDeg If b3Vac.DimY() > b3Vac.DimX() + EPS_SMALL Then dRotAngDeg -= 90 - While dRotAngDeg >= 90 - dRotAngDeg -= 180 + Dim dAngDelta As Double = If( Math.Abs( b3Vac.DimY() - b3Vac.DimX()) < 10 * EPS_SMALL, 90, 180) + While dRotAngDeg - m_dPreferredRot >= dAngDelta / 2 + dRotAngDeg -= dAngDelta End While - While dRotAngDeg < -90 - dRotAngDeg += 180 + While dRotAngDeg - m_dPreferredRot <= -dAngDelta / 2 + dRotAngDeg += dAngDelta End While Else dRotAngDeg = 0 If (b3Vac.DimX() >= b3Vac.DimY() And b3Raw.DimX() < b3Raw.DimY()) Or (b3Vac.DimX() < b3Vac.DimY() And b3Raw.DimX() >= b3Raw.DimY()) Then - dRotAngDeg = -90 + dRotAngDeg = m_dPreferredRot End If End If ' Identificativi delle ventose @@ -371,8 +400,10 @@ Module VacuumCups ' Ordino secondo distanza angolare crescente da direzione di allineamento (modulo 180 deg) Dim dRotRefDeg As Double = dRotAngDeg vAngRot.Sort(Function(P, Q) - Dim dDiffP = Math.Abs(( P - dRotRefDeg) Mod 180) - Dim dDiffQ = Math.Abs(( Q - dRotRefDeg) Mod 180) + Dim dDiffP = Math.Abs( P - dRotRefDeg) + If Math.Abs( dDiffP - 180) < 10 * EPS_ANG_SMALL Then dDiffP = 1 + Dim dDiffQ = Math.Abs( Q - dRotRefDeg) + If Math.Abs( dDiffQ - 180) < 10 * EPS_ANG_SMALL Then dDiffQ = 1 Return ( dDiffP - dDiffQ) End Function) ' Annullo la rotazione di allineamento @@ -382,7 +413,6 @@ Module VacuumCups ' Assegno più valori di ricerca e conservo angolo di allineamento vAngRot.AddRange({0, +5, -5, +12.5, -12.5, +25, -25, +45, -45}) End If - ' Eseguo verifica delle ventose rispetto al grezzo Dim bVacOk As Boolean = False For i As Integer = 0 To vAngRot.Count() - 1 @@ -598,4 +628,12 @@ Module VacuumCups Return bRemoveByHand End Function + Friend Function SaveMovePartsOnAuxTable(nDispId As Integer, bMovePartsOnAuxTab As Boolean) As Boolean + ' Verifico DispId + If EgtGetOperationType(nDispId) <> MCH_OY.DISP Then Return False + ' Imposto flag + EgtSetInfo(nDispId, "Pat", bMovePartsOnAuxTab) + Return True + End Function + End Module diff --git a/MachinePanel/MachinePanelV.xaml b/MachinePanel/MachinePanelV.xaml index 603a540..efc2b7c 100644 --- a/MachinePanel/MachinePanelV.xaml +++ b/MachinePanel/MachinePanelV.xaml @@ -4,7 +4,8 @@ xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5" IsTopDockable="True" IsBottomDockable="False" IsLeftDockable="False" IsRightDockable="False" IsFloating="False" - Background="{StaticResource Omag_Gray}" BorderBrush="{StaticResource Omag_Gray}"> + Background="{StaticResource Omag_Gray}" BorderBrush="{StaticResource Omag_Gray}" + IsEnabled="{Binding MachPanel_IsEnabled}">