From 69313d5f6d3203554c50e53d7b83850a962c4bee Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 8 Feb 2018 10:43:23 +0000 Subject: [PATCH] OmagOFFICE 1.9b2 : - aggiunto import TRF (da Cut) - aggiunta gestione doppia pendenza su bordo (da Cut) - tolta visualizzazione iniziale inappropriata. --- CompoWindow/CompoSceneHostV.xaml.vb | 3 + Constants/ConstGen.vb | 9 +- DxfImportWindow/DxfImportSceneHostV.xaml.vb | 3 + DxfImportWindow/DxfImportWindowVM.vb | 99 ++++++++++++++++-- EgtStoneLib/ConstMach.vb | 3 + EgtStoneLib/EstCalc.vb | 6 +- EgtStoneLib/VeinMatchingWindow.xaml.vb | 9 ++ MainWindow/MainWindowM.vb | 5 + My Project/AssemblyInfo.vb | 4 +- MyMachGroupPanel/MyMachGroupPanelVM.vb | 2 +- OptionPanel/MachiningTab/SplitModeVM.vb | 10 +- OptionPanel/SimulTab/SimulTabV.xaml | 107 ++++++++++---------- OptionPanel/SimulTab/SimulTabVM.vb | 28 +++-- SideEntityControl/SideEntityControlVM.vb | 97 ++++++++++-------- 14 files changed, 264 insertions(+), 121 deletions(-) diff --git a/CompoWindow/CompoSceneHostV.xaml.vb b/CompoWindow/CompoSceneHostV.xaml.vb index 46fd301..a30dc43 100644 --- a/CompoWindow/CompoSceneHostV.xaml.vb +++ b/CompoWindow/CompoSceneHostV.xaml.vb @@ -73,6 +73,9 @@ Public Class CompoSceneHostV ' tipo visualizzazione per Zmap Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1) EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False) + ' dimensione lineare max in pixel delle textures + Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TEXMAXLINPIX, 4096) + EgtSetTextureMaxLinPixels(nTxrMaxLinPix) ' dati di griglia Dim dSnapStep As Double = If(EgtUiUnitsAreMM(), GetMainPrivateProfileDouble(S_GRID, K_SNAPSTEP, 10), diff --git a/Constants/ConstGen.vb b/Constants/ConstGen.vb index 91808a8..44a3584 100644 --- a/Constants/ConstGen.vb +++ b/Constants/ConstGen.vb @@ -25,7 +25,7 @@ Module ConstGen ' Abilitazioni licenza Friend Enum KEY_OPT As UInteger - CUT_BASE = 1 + CUT_BASE = 1 ' Prodotto OmagCUT MAN_MANIP = 2 AUTO_MANIP = 4 MAN_PHOTO = 8 @@ -33,9 +33,12 @@ Module ConstGen AUTO_NESTING = 32 ENABLE_MILL = 64 PROCUCTION_LINE = 128 - OFFICE_BASE = 256 + OFFICE_BASE = 256 ' Prodotto OmagOFFICE VM_MULTI = 512 UNDER_CUT = 1024 + CSV_SIMPLE = 2048 + PHOTO_BASE = 4096 ' Prodotto OmagPHOTO + TRF_IMPORT = 8192 End Enum ' File di log generale @@ -53,6 +56,8 @@ Module ConstGen Public Const CSVAUTO_DIR As String = "CsvAuto" ' Sottodirettorio per Img automatico Public Const IMGAUTO_DIR As String = "ImgAuto" + ' Sottodirettorio per Trf automatico + Public Const TRFAUTO_DIR As String = "TrfAuto" ' Sottodirettorio di default per il salvataggio con nome Public Const SAVE_DFL_NAMEDIR As String = "MyProjects" ' Sottodirettorio di default per le macchine diff --git a/DxfImportWindow/DxfImportSceneHostV.xaml.vb b/DxfImportWindow/DxfImportSceneHostV.xaml.vb index a038108..d2fd819 100644 --- a/DxfImportWindow/DxfImportSceneHostV.xaml.vb +++ b/DxfImportWindow/DxfImportSceneHostV.xaml.vb @@ -83,6 +83,9 @@ Public Class DxfImportSceneHostV ' tipo visualizzazione per Zmap Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1) EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False) + ' dimensione lineare max in pixel delle textures + Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TEXMAXLINPIX, 4096) + EgtSetTextureMaxLinPixels(nTxrMaxLinPix) ' dati di griglia Dim dSnapStep As Double = If(EgtUiUnitsAreMM(), GetMainPrivateProfileDouble(S_GRID, K_SNAPSTEP, 10), diff --git a/DxfImportWindow/DxfImportWindowVM.vb b/DxfImportWindow/DxfImportWindowVM.vb index e5911f8..2525a3d 100644 --- a/DxfImportWindow/DxfImportWindowVM.vb +++ b/DxfImportWindow/DxfImportWindowVM.vb @@ -7,9 +7,13 @@ Public Class DxfImportWindowVM #Region "FIELDS & PROPERTIES" + ' Costante per formato TRF + Private Const FT_TRF As Integer = 51 + ' Dati file corrente Private m_sFilePath As String = String.Empty Private m_nFileType As Integer = FT.NULL + Private m_bEnableTrf As Boolean = False Private m_Open_IsEnabled As Boolean = True Public Property Open_IsEnabled As Boolean @@ -291,6 +295,8 @@ Public Class DxfImportWindowVM Sub New() ' Avvio l'inizializzazione della mappa passandogli il riferimento al DxfImportWindowVM DxfImportWindowMap.BeginInit(Me) + ' imposto importazione TRF + m_bEnableTrf = (OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.TRF_IMPORT)) End Sub #End Region ' CONSTRUCTOR @@ -302,6 +308,7 @@ Public Class DxfImportWindowVM EgtNewFile() ' Riconoscimento tipo m_nFileType = EgtGetFileType(m_sFilePath) + If m_nFileType = FT.NULL And m_bEnableTrf And Path.GetExtension(m_sFilePath).ToUpper() = ".TRF" Then m_nFileType = FT_TRF Select Case m_nFileType Case FT.DXF ' recupero unità di misura del file @@ -313,22 +320,58 @@ Public Class DxfImportWindowVM If Not EgtOpenFile(m_sFilePath) Then Return False ' Filtro Nge EstProject.FilterNge() + Case FT_TRF + ' Carico Trf + If Not ImportTrf(m_sFilePath) Then Return False + Case Else + Return False End Select + ' se formato DXF o NGE + If m_nFileType = FT.DXF Or m_nFileType = FT.NGE Then ' Aggiorno stato visualizzazione bottoni - UseRegionIsEnabled = True - UseLayerIsEnabled = True - UseClosedCurveIsEnabled = True - ResetIsEnabled = False - OkIsEnabled = False - SideEntity_IsEnabled = False + UseRegionIsEnabled = True + UseLayerIsEnabled = True + UseClosedCurveIsEnabled = True + ResetIsEnabled = False + Measure_IsEnabled = (m_nFileType = FT.DXF) + OkIsEnabled = False + SideEntity_IsEnabled = False + ElseIf m_nFileType = FT_TRF Then + UseRegionIsEnabled = False + UseLayerIsEnabled = False + UseClosedCurveIsEnabled = False + ResetIsEnabled = False + Measure_IsEnabled = False + OkIsEnabled = True + SideEntity_IsEnabled = False + End If ' Eseguo zoom EgtZoom(ZM.ALL) Return True End Function + Private Function ImportTrf(sPath As String) As Boolean + ' Definizione variabili + EgtLuaCreateGlobTable("TRF") + EgtLuaSetGlobStringVar("TRF.FILE", sPath) + ' Path script da eseguire + Dim sLuaPath = OmagOFFICEMap.refMainWindowVM.MainWindowM.sTrfAutoDir & "\TrfRead.lua" + ' Esecuzione + Dim nErr As Integer = 999 + If EgtLuaExecFile(sLuaPath) AndAlso + EgtLuaExecLine("TRF.Read()") Then + ' Verifica stato di errore + EgtLuaGetGlobIntVar("TRF.ERR", nErr) + End If + If nErr <> 0 Then EgtOutLog("Error in TrfRead : " & nErr.ToString()) + EgtLuaResetGlobVar("TRF") + Return (nErr = 0) + End Function + Friend Sub LoadFlatParts() + ' Scrivo testi per nesting + WriteSideAngleForNest(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx()) ' Imposto riferimento sul centro geometrico di ogni pezzo - EgtSetCurrentContext(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx()) VeinMatching.SetRefOnAllParts() ' Eventuale pulizia VeinMatching VeinMatching.Clear() @@ -385,6 +428,41 @@ Public Class DxfImportWindowVM EgtZoom(ZM.ALL) End Sub + Friend Sub WriteSideAngleForNest(nCtx As Integer) + ' Imposto contesto corrente + EgtSetCurrentContext(nCtx) + Dim CurrPart As Integer + CurrPart = EgtGetFirstInGroup(GDB_ID.ROOT) + While CurrPart <> GDB_ID.NULL + ' Ricavo nome layer con geometria esterna pezzo + Dim OutLoop As Integer = EgtGetFirstNameInGroup(CurrPart, NAME_OUTLOOP) + ' Calcolo dimensione ingombro OutLoop + Dim ptMin, ptMax As Point3d + EgtGetBBoxGlob(OutLoop, GDB_BB.STANDARD, ptMin, ptMax) + Dim dBBoxRad As Double = 0.5 * Point3d.DistXY(ptMin, ptMax) + ' Creo layer per testi nesting + Dim TextLayer As Integer = EgtCreateGroup(CurrPart) + EgtSetName(TextLayer, SIDE_ANGLE_LAYER) + EgtSetColor(TextLayer, New Color3d(0, 0, 128)) + ' Ciclo sulle linee di contorno, se hanno info con inclinazione aggiungo testo con angolo + Dim CurrLine As Integer = EgtGetFirstInGroup(OutLoop) + While CurrLine <> GDB_ID.NULL + Dim dSideAngle As Double = 0 + Dim bSA As Boolean = EgtGetInfo(CurrLine, INFO_SIDE_ANGLE, dSideAngle) + Dim dSideAngle2 As Double = 0 + Dim bSA2 As Boolean = EgtGetInfo(CurrLine, INFO_SIDE_ANGLE2, dSideAngle2) + If Math.Abs(dSideAngle) > EPS_ANG_SMALL Or bSA2 Then + ' Creo testo con angolo di inclinazione + Dim sText As String = DoubleToString(dSideAngle, 1) & "°" + If bSA2 Then sText &= "; " & DoubleToString(dSideAngle2, 1) & "°" + SideEntityControlVM.AddTextToLine(sText, TextLayer, CurrLine, 15, dBBoxRad, False, True) + End If + CurrLine = EgtGetNext(CurrLine) + End While + CurrPart = EgtGetNext(CurrPart) + End While + End Sub + Friend Function VerifyIfSelectPart() As Boolean ' Solo se in modalità angoli o gocciolatoio su lati esterni Return (SideAngle_IsChecked Or Drip_IsChecked) @@ -416,8 +494,10 @@ Public Class DxfImportWindowVM ' Scelgo file da importare Dim DxfDlg As New Microsoft.Win32.OpenFileDialog DxfDlg.Title = "Open" - DxfDlg.Filter = "Dxf file(*.dxf)|*.dxf" & - "|New geometry EgalTech(*.nge)|*.nge" + Dim sFilter As String = "Dxf file(*.dxf)|*.dxf|" + If m_bEnableTrf Then sFilter &= "Trf file(*.trf)|*.trf|" + sFilter &= "New geometry EgalTech(*.nge)|*.nge" + DxfDlg.Filter = sFilter DxfDlg.FilterIndex = 1 GetMainPrivateProfileString(S_FLATPARTS, K_FLPCURRDIR, "", DxfDlg.InitialDirectory) If Not DxfDlg.ShowDialog() Then Return @@ -428,7 +508,6 @@ Public Class DxfImportWindowVM ' Carico il file LoadCurrFile() Type_IsEnabled = True - Measure_IsEnabled = True End Sub #End Region ' OpenDxfCommand diff --git a/EgtStoneLib/ConstMach.vb b/EgtStoneLib/ConstMach.vb index 5feda6b..03e1775 100644 --- a/EgtStoneLib/ConstMach.vb +++ b/EgtStoneLib/ConstMach.vb @@ -119,6 +119,9 @@ Module ConstMach Public Const INFO_STRICT As String = "Strict" ' Info in entità da tagliare per angolo di lato Public Const INFO_SIDE_ANGLE As String = "SideAng" + Public Const INFO_OFFSET As String = "Offset" + Public Const INFO_SIDE_ANGLE2 As String = "SideAng2" + Public Const INFO_OFFSET2 As String = "Offset2" ' Info in entità da tagliare per gocciolatoio Public Const INFO_HAVE_DRIP As String = "HaveDrip" ' Info in entità da tagliare per direzione che varia a seconda del tipo (una via o zigzag) diff --git a/EgtStoneLib/EstCalc.vb b/EgtStoneLib/EstCalc.vb index 3c652c2..152d458 100644 --- a/EgtStoneLib/EstCalc.vb +++ b/EgtStoneLib/EstCalc.vb @@ -393,7 +393,8 @@ Module EstCalc Public Function InsertOnePart(nId As Integer, bAligned As Boolean, bReducedCut As Boolean) As Boolean ' Se esiste grezzo e pezzo in parcheggio, lo metto nella tavola If m_nRawId <> GDB_ID.NULL AndAlso EgtIsPart(nId) Then - ' Sistemazioni per eventuali lati esterni inclinati + ' Sistemazioni per eventuali lati esterni inclinati e/o offsettati + EgtCalcFlatPartUpRegion(nId, True) EgtCalcFlatPartDownRegion(nId, m_b3Raw.DimZ()) ' Dimensioni del pezzo Dim ptPartMin, ptPartMax As Point3d @@ -441,7 +442,8 @@ Module EstCalc (m_nRawId <> GDB_ID.NULL AndAlso EgtGetParent(nId) = m_nRawId) Then ' Rimuovo le lavorazioni EraseMachinings(nId) - ' Elimino eventuali modifiche per lati esterni inclinati + ' Elimino eventuali modifiche per lati esterni inclinati e/o offsettati + EgtCalcFlatPartUpRegion(nId, False) EgtCalcFlatPartDownRegion(nId, 0) ' Parcheggio EgtRemovePartFromRawPart(nId) diff --git a/EgtStoneLib/VeinMatchingWindow.xaml.vb b/EgtStoneLib/VeinMatchingWindow.xaml.vb index 5b7fa05..7234813 100644 --- a/EgtStoneLib/VeinMatchingWindow.xaml.vb +++ b/EgtStoneLib/VeinMatchingWindow.xaml.vb @@ -87,6 +87,15 @@ Public Class VeinMatchingWindow If Not VeinMatchingScene.Init() Then Me.Close() End If + ' modo di visualizzazione + Dim nShowMode As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING) + EgtSetShowMode(DirectCast(nShowMode, SM)) + ' visualizzazione avanzata dei triangoli costituenti le superfici + Dim bShowTriaAdv As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0) + EgtSetShowTriaAdv(bShowTriaAdv) + ' tipo visualizzazione per Zmap + Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1) + EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False) ' dimensione lineare max in pixel delle textures Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TEXMAXLINPIX, 4096) EgtSetTextureMaxLinPixels(nTxrMaxLinPix) diff --git a/MainWindow/MainWindowM.vb b/MainWindow/MainWindowM.vb index 8fda521..fb81bc1 100644 --- a/MainWindow/MainWindowM.vb +++ b/MainWindow/MainWindowM.vb @@ -91,6 +91,11 @@ Public Class MainWindowM Return m_sDataRoot & "\" & IMGAUTO_DIR End Get End Property + Friend ReadOnly Property sTrfAutoDir As String + Get + Return m_sDataRoot & "\" & TRFAUTO_DIR + End Get + End Property #End Region ' FIELDS diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 05fd9aa..4b102ee 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -69,5 +69,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/MyMachGroupPanel/MyMachGroupPanelVM.vb b/MyMachGroupPanel/MyMachGroupPanelVM.vb index dce8ead..7b9d2f0 100644 --- a/MyMachGroupPanel/MyMachGroupPanelVM.vb +++ b/MyMachGroupPanel/MyMachGroupPanelVM.vb @@ -105,7 +105,7 @@ Public Class MyMachGroupPanelVM Public Overrides Function OnPreSetCurrMachGroup() As Boolean EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Deseleziono tutto in Nesting e nel VeinMatching - OmagOFFICE.refNestingTabVM.DeselectAll(True) + OmagOFFICE.refNestingTabVM.DeselectAllParts(True) Return True End Function diff --git a/OptionPanel/MachiningTab/SplitModeVM.vb b/OptionPanel/MachiningTab/SplitModeVM.vb index ce3cca9..0664f90 100644 --- a/OptionPanel/MachiningTab/SplitModeVM.vb +++ b/OptionPanel/MachiningTab/SplitModeVM.vb @@ -388,10 +388,8 @@ Public Class SplitModeVM Dim sText As String = String.Empty If Math.Abs(Mach.m_dSideAng) < EPS_ANG_SMALL Then sText = EgtMsg(90791) & " " & i.ToString() - ElseIf Mach.m_dSideAng > 0 Then - sText = EgtMsg(90791) & " " & DoubleToString(Mach.m_dSideAng, 1) & "° " & i.ToString() Else - sText = EgtMsg(90791) & " " & DoubleToString(Mach.m_dSideAng, 1) & "° " & i.ToString() + sText = EgtMsg(90791) & " " & i.ToString() & " " & DoubleToString(Mach.m_dSideAng, 1) & "°" End If m_ItemList.Add(New NameIdLsBxItem(sText, i - 1, Mach.m_bEnabled)) ElseIf Mach.m_nType = MCH_OY.DRILLING Then ' Foratura @@ -460,11 +458,15 @@ Public Class SplitModeVM Private Sub NumberMachining(nI As Integer) EgtDisableModified() + ' Determino se seconda lavorazione + Dim sName As String = String.Empty + EgtGetName(m_MachiningList(nI).m_nId, sName) + Dim b2ndLav As Boolean = sName.Contains("_") ' Ingombro complessivo della lavorazione Dim ptMin, ptMax As Point3d If Not BoxFromMachining(nI, ptMin, ptMax) Then Return ' Metto il numero nel centro - Dim ptCen As Point3d = ptMin + 0.5 * (ptMax - ptMin) + Dim ptCen As Point3d = ptMin + If(Not b2ndLav, 0.5 * (ptMax - ptMin), 0.75 * (ptMax - ptMin)) ptCen.z = ptMax.z + 1 Dim dRadXY = Point3d.DistXY(ptMin, ptMax) Dim dHtxt As Double = 75 diff --git a/OptionPanel/SimulTab/SimulTabV.xaml b/OptionPanel/SimulTab/SimulTabV.xaml index a5bc67d..bd37f38 100644 --- a/OptionPanel/SimulTab/SimulTabV.xaml +++ b/OptionPanel/SimulTab/SimulTabV.xaml @@ -22,6 +22,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -48,57 +102,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OptionPanel/SimulTab/SimulTabVM.vb b/OptionPanel/SimulTab/SimulTabVM.vb index 46316f4..d8cf456 100644 --- a/OptionPanel/SimulTab/SimulTabVM.vb +++ b/OptionPanel/SimulTab/SimulTabVM.vb @@ -115,6 +115,17 @@ Public Class SimulTabVM End Get End Property + Private m_StatusMsg As String + Public Property StatusMsg As String + Get + Return m_StatusMsg + End Get + Set(value As String) + m_StatusMsg = value + NotifyPropertyChanged("StatusMsg") + End Set + End Property + Private m_SliderValue As Double Public Property SliderValue As Double Get @@ -248,9 +259,11 @@ Public Class SimulTabVM EgtSimHome() LoadCurrTools() ShowCncData() + StatusMsg = EgtMsg(MSG_SIMULATIONPAGEUC + 14) ' Home End Sub Friend Sub ResetSimulation() + StatusMsg = "" ' Termino la simulazione SimulationStatus = SIM_ST.ST_STOP EgtSimStop() @@ -276,7 +289,7 @@ Public Class SimulTabVM If m_nStatus = SIM_ST.ST_STEP And nMove = MCH_SIM.END_STEP Then ' Imposto stato Pausa SimulationStatus = SIM_ST.ST_PAUSE - OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_SIMULATIONPAGEUC + 11)) ' Pausa + StatusMsg = EgtMsg(MSG_SIMULATIONPAGEUC + 11) ' Pausa ' Aggiornamenti per bottone Play/Pause m_bShowPlay = True NotifyPropertyChanged("PlayPauseImage") @@ -289,7 +302,7 @@ Public Class SimulTabVM NotifyPropertyChanged("PlayPauseImage") Select Case nMove Case MCH_SIM.END_ - OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_SIMULATIONPAGEUC + 1), 5) 'Simulazione completata + StatusMsg = EgtMsg(MSG_SIMULATIONPAGEUC + 1) 'Simulazione completata Case MCH_SIM.OUTSTROKE Dim sInfo As String = String.Empty EgtGetOutstrokeInfo(sInfo) @@ -540,7 +553,7 @@ Public Class SimulTabVM ''' Creata the new tool. This method is invoked by the NewCommand. ''' Public Sub StepCmd(ByVal param As Object) - OmagOFFICEMap.refStatusBarVM.ClearOutputMessage() + StatusMsg = "" ' Se stato stop, devo avviare simulazione If m_nStatus = SIM_ST.ST_STOP Then SimulationStatus = SIM_ST.ST_STEP @@ -580,7 +593,7 @@ Public Class SimulTabVM ''' Creata the new tool. This method is invoked by the NewCommand. ''' Public Sub PlayPause(ByVal param As Object) - OmagOFFICEMap.refStatusBarVM.ClearOutputMessage() + StatusMsg = "" If m_bShowPlay Then ' Aggiorno bottone m_bShowPlay = False @@ -603,7 +616,7 @@ Public Class SimulTabVM ' Se play o step, imposto stato pausa If m_nStatus = SIM_ST.ST_PLAY Or m_nStatus = SIM_ST.ST_STEP Then SimulationStatus = SIM_ST.ST_PAUSE - OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_SIMULATIONPAGEUC + 11)) ' Pausa + StatusMsg = EgtMsg(MSG_SIMULATIONPAGEUC + 11) ' Pausa End If End If End Sub @@ -629,7 +642,7 @@ Public Class SimulTabVM ''' Creata the new tool. This method is invoked by the NewCommand. ''' Public Sub StopCmd(ByVal param As Object) - OmagOFFICEMap.refStatusBarVM.ClearOutputMessage() + StatusMsg = "" ' Se stato già stop, porto in home If m_nStatus = SIM_ST.ST_STOP Then ' Mi riporto all'inizio @@ -637,8 +650,9 @@ Public Class SimulTabVM EgtDraw() ' Aggiorno dati CNC ShowCncData() + StatusMsg = EgtMsg(MSG_SIMULATIONPAGEUC + 14) ' Home Else - OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_SIMULATIONPAGEUC + 12)) ' Simulazione interrotta + StatusMsg = EgtMsg(MSG_SIMULATIONPAGEUC + 12) ' Simulazione interrotta End If ' Aggiorno bottone m_bShowPlay = True diff --git a/SideEntityControl/SideEntityControlVM.vb b/SideEntityControl/SideEntityControlVM.vb index b10007f..5df4119 100644 --- a/SideEntityControl/SideEntityControlVM.vb +++ b/SideEntityControl/SideEntityControlVM.vb @@ -538,67 +538,84 @@ Public Class SideEntityControlVM End Sub ' Funzione che dato un segmento e una distanza, scrive il testo centrato alla sua destra - Friend Shared Function AddTextToLine(sText As String, TextLayer As Integer, CurrLine As Integer, dDistance As Double, dBBoxRad As Double, bTextExt As Boolean) As Integer + Friend Shared Function AddTextToLine(sText As String, TextLayer As Integer, CurrLine As Integer, dDistance As Double, + dBBoxRad As Double, bTextExt As Boolean, Optional bRot As Boolean = False) As Integer ' Calcolo altezza testo Dim dH As Double = 0.075 * dBBoxRad ' Creo testo Dim nText As Integer = EgtCreateTextAdv(TextLayer, New Point3d(0, 0, 0), 0, sText, "", 500, False, dH, 1, 0, INS_POS.MC) - ' Calcolo punto in cui posizionare il testo - ' calcolo BBox del testo + ' Calcolo posizionamento + ' BBox del testo e suo centro Dim ptMinBBox As Point3d Dim ptMaxBBox As Point3d EgtGetBBox(nText, GDB_BB.STANDARD, ptMinBBox, ptMaxBBox) - ' calcolo centro del BBox Dim ptMidBBox As Point3d ptMidBBox = Point3d.Media(ptMinBBox, ptMaxBBox) - ' calcolo vettore della CurrLine + ' estremi della CurrLine Dim ptLineStart As Point3d EgtStartPoint(CurrLine, nText, ptLineStart) Dim ptLineEnd As Point3d EgtEndPoint(CurrLine, nText, ptLineEnd) + ' versore della CurrLine Dim vtCurrLine As Vector3d = ptLineEnd - ptLineStart - ' lo normalizzo per ottenerne il versore vtCurrLine.Normalize() - ' calcolo vettore dal centro del BBox all'estremo più vicino se testo esterno alla figura - Dim vtptExtptMC As Vector3d + ' versore perpendicolare alla CurrLine che punta verso il testo + Dim vtOrtoLine As New Vector3d(vtCurrLine) If bTextExt Then - If vtCurrLine.x > 0 Then - If vtCurrLine.y > 0 Then - vtptExtptMC = ptMidBBox - New Point3d(ptMinBBox.x, ptMaxBBox.y, 0) - Else - vtptExtptMC = ptMidBBox - ptMaxBBox - End If - Else - If vtCurrLine.y > 0 Then - vtptExtptMC = ptMidBBox - ptMinBBox - Else - vtptExtptMC = ptMidBBox - New Point3d(ptMaxBBox.x, ptMinBBox.y, 0) - End If - End If + vtOrtoLine.Rotate(Vector3d.Z_AX(), -90) Else - If vtCurrLine.x > 0 Then - If vtCurrLine.y > 0 Then - vtptExtptMC = ptMidBBox - New Point3d(ptMaxBBox.x, ptMinBBox.y, 0) - Else - vtptExtptMC = ptMidBBox - ptMinBBox - End If - Else - If vtCurrLine.y > 0 Then - vtptExtptMC = ptMidBBox - ptMaxBBox - Else - vtptExtptMC = ptMidBBox - New Point3d(ptMinBBox.x, ptMaxBBox.y, 0) - End If - End If - + vtOrtoLine.Rotate(Vector3d.Z_AX(), 90) End If - ' ruoto il vettore della CurrLine per ottenerne il perpendicolare - If bTextExt Then - vtCurrLine.Rotate(Vector3d.Z_AX, -90) + ' eventuale rotazione del testo + Dim dRotAng As Double = 0 + If bRot Then + dRotAng = Math.Atan2(vtCurrLine.y, vtCurrLine.x) * 180 / Math.PI + Dim dSpecRotAng = dRotAng + If dSpecRotAng > 91 Then + dSpecRotAng -= 180 + ElseIf dSpecRotAng < -89 Then + dSpecRotAng += 180 + End If + EgtRotate(nText, Point3d.ORIG(), Vector3d.Z_AX(), dSpecRotAng) + End If + ' vettore dal centro del BBox all'estremo più vicino + Dim vtptExtptMC As Vector3d + If bRot Then + vtptExtptMC = New Vector3d(0, ptMidBBox.y - ptMinBBox.y, 0) + vtptExtptMC.Rotate(Vector3d.Z_AX(), dRotAng) Else - vtCurrLine.Rotate(Vector3d.Z_AX, 90) + If bTextExt Then + If vtCurrLine.x > 0 Then + If vtCurrLine.y > 0 Then + vtptExtptMC = ptMidBBox - New Point3d(ptMinBBox.x, ptMaxBBox.y, 0) + Else + vtptExtptMC = ptMidBBox - ptMaxBBox + End If + Else + If vtCurrLine.y > 0 Then + vtptExtptMC = ptMidBBox - ptMinBBox + Else + vtptExtptMC = ptMidBBox - New Point3d(ptMaxBBox.x, ptMinBBox.y, 0) + End If + End If + Else + If vtCurrLine.x > 0 Then + If vtCurrLine.y > 0 Then + vtptExtptMC = ptMidBBox - New Point3d(ptMaxBBox.x, ptMinBBox.y, 0) + Else + vtptExtptMC = ptMidBBox - ptMinBBox + End If + Else + If vtCurrLine.y > 0 Then + vtptExtptMC = ptMidBBox - ptMaxBBox + Else + vtptExtptMC = ptMidBBox - New Point3d(ptMinBBox.x, ptMaxBBox.y, 0) + End If + End If + End If End If ' Calcolo il centro del testo - Dim ptTextMC As Point3d = Point3d.Media(ptLineStart, ptLineEnd) + vtCurrLine * (dDistance + (vtCurrLine * vtptExtptMC)) + Dim ptTextMC As Point3d = Point3d.Media(ptLineStart, ptLineEnd) + vtOrtoLine * (dDistance + (vtOrtoLine * vtptExtptMC)) EgtMove(nText, (ptTextMC - Point3d.ORIG)) Return nText End Function