diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index 9a857b3..d02fdff 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -88,6 +88,7 @@ Module ConstIni Public Const S_SIDES As String = "Sides" Public Const K_MAXSIDEANGLE As String = "MaxSideAngle" + Public Const K_PARSIDE_AS_TRF As String = "ParSideAsTrf" Public Const K_SIDEANGLE As String = "SideAngle" Public Const K_DRIPOFFSET As String = "DripOffset" Public Const K_DRIPOFFSET2 As String = "DripOffset2" diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 651eedd..95ae2be 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/OptionPanel/MachiningTab/SplitModeVM.vb b/OptionPanel/MachiningTab/SplitModeVM.vb index 1d40724..53d0a8c 100644 --- a/OptionPanel/MachiningTab/SplitModeVM.vb +++ b/OptionPanel/MachiningTab/SplitModeVM.vb @@ -231,10 +231,6 @@ Public Class SplitModeVM m_CurrInd = -1 ' Reset flag di modifica m_bModified = False - ' Visualizzazione bottoni - If OmagOFFICEMap.refMachiningTabVM.ByHand Then - AllExtRedVisibility = Visibility.Collapsed - End If ' Abilitazione bottoni EnableButtons() Return True diff --git a/SideEntityControl/SideEntityControlVM.vb b/SideEntityControl/SideEntityControlVM.vb index 5791b6e..5562de5 100644 --- a/SideEntityControl/SideEntityControlVM.vb +++ b/SideEntityControl/SideEntityControlVM.vb @@ -716,9 +716,11 @@ Public Class SideEntityControlVM ' Scrivo nuovo angolo nelle info If dSideAngle <> 0 Then EgtSetInfo(CurrEntity.nGeomId, INFO_SIDE_ANGLE, dSideAngle) + EgtSetInfo(CurrEntity.nGeomId, INFO_ORIG_SIDE_ANGLE, dSideAngle) ' Cancello inclinazione nell'apposito campo info Else EgtRemoveInfo(CurrEntity.nGeomId, INFO_SIDE_ANGLE) + EgtRemoveInfo(CurrEntity.nGeomId, INFO_ORIG_SIDE_ANGLE) End If ' Aggiorno lista entità con nuova inclinazione CurrEntity.dSideAngle = dSideAngle @@ -836,6 +838,10 @@ Public Class SideEntityControlVM EgtSetCurrentContext(nCtx) Dim PartId As Integer = EgtGetFirstPart() While PartId <> GDB_ID.NULL + ' Se richiesti lati paralleli con misura sul top come in TRF, verifico e aggiusto + If GetMainPrivateProfileInt( S_SIDES, K_PARSIDE_AS_TRF, 0) <> 0 Then + AdjustAsTrfParSides( PartId) + End If ' Elimino eventuale precedente layer per testi EgtErase(EgtGetFirstNameInGroup(PartId, SIDE_ANGLE_LAYER)) ' Creo layer per testi nesting @@ -854,6 +860,49 @@ Public Class SideEntityControlVM End While End Sub + Shared Function AdjustAsTrfParSides( PartId As Integer) As Boolean + ' Recupero il loop esterno + Dim LoopId As Integer = EgtGetFirstNameInGroup(PartId, NAME_OUTLOOP) + If LoopId = GDB_ID.NULL Then Return False + ' Scansiono i lati + Dim LineId As Integer = EgtGetFirstInGroup(LoopId) + While LineId <> GDB_ID.NULL + ' Se non è linea con singolo angolo, vado oltre + If Not EgtExistsInfo(LineId, INFO_SIDE_ANGLE) OrElse + EgtExistsInfo(LineId, INFO_SIDE_ANGLE2) OrElse + EgtExistsInfo(LineId, INFO_HEEL) Then + LineId = EgtGetNext(LineId) + Continue While + End If + ' Recupero angolo di fianco e direzione + Dim dSideAng As Double = 0 : EgtGetInfo( LineId, INFO_SIDE_ANGLE, dSideAng) + Dim vtDir As new Vector3d : EgtStartVector( LineId, GDB_ID.ROOT, vtDir) + ' Confronto con le linee successive + Dim OthLId As Integer = EgtGetNext(LineId) + While OthLId <> GDB_ID.NULL + ' Se non è linea con singolo angolo, vado oltre + If Not EgtExistsInfo(OthLId, INFO_SIDE_ANGLE) OrElse + EgtExistsInfo(OthLId, INFO_SIDE_ANGLE2) OrElse + EgtExistsInfo(OthLId, INFO_HEEL) Then + OthLId = EgtGetNext(OthLId) + Continue While + End If + ' Recupero angolo di fianco e direzione + Dim dOthSAng As Double = 0 : EgtGetInfo( OthLId, INFO_SIDE_ANGLE, dOthSAng) + Dim vtOthDir As new Vector3d : EgtStartVector( OthLId, GDB_ID.ROOT, vtOthDir) + ' Se gli angoli sono opposti e le due linee sono controverse + If Math.Abs( dSideAng + dOthSAng) < 10 * EPS_ANG_SMALL AndAlso (vtDir + vtOthDir).IsSmall() Then + EgtSetInfo( LineId, INFO_SIDE_FIXED, 1) + EgtSetInfo( OthLId, INFO_SIDE_FIXED, 1) + Exit While + End If + OthLId = EgtGetNext(OthLId) + End While + LineId = EgtGetNext(LineId) + End While + Return True + End Function + Shared Function WriteSideAngleOnLoop(LoopId As Integer, TextLayId As Integer) As Boolean ' Verifiche If LoopId = GDB_ID.NULL Or TextLayId = GDB_ID.NULL Then Return False @@ -887,8 +936,6 @@ Public Class SideEntityControlVM sText = DoubleToString(dSideAngle2, 1) & "°" & "; " & sText End If SideEntityControlVM.AddTextToLine(sText, TextLayId, LineId, 15, dBBoxRad, False, True) - ' Imposto angolo originale - EgtSetInfo(LineId, INFO_ORIG_SIDE_ANGLE, dSideAngle) End If LineId = EgtGetNext(LineId) End While