Compare commits

...

3 Commits

Author SHA1 Message Date
NicolaP abc304e25c Verifica interferenze tra grezzi in fase di split 2022-05-02 14:28:08 +02:00
NicolaP 80f4dc6b83 Merge branch 'master' into develop 2022-05-02 11:12:34 +02:00
DarioS 8f5ef91890 OmagOFFICE 2.4e1 :
- controlli vari.
2022-05-02 10:29:43 +02:00
12 changed files with 221 additions and 127 deletions
+1 -1
View File
@@ -121,7 +121,7 @@ Module ConstIni
Public Const K_TEXTCOLOR As String = "TextColor"
Public Const K_AUTOMATICOPTIMIZE As String = "AutomaticOptimize"
Public Const K_AUTOMATICMAXTIME As String = "AutomaticMaxTime"
Public Const K_DRAGRETTANGLE As String = "DragRectangle"
Public Const K_DRAGRECTANGLE As String = "DragRectangle"
Public Const S_SPLIT As String = "Split"
Public Const K_MOVE_LEV As String = "MoveLevel"
+1 -1
View File
@@ -583,7 +583,7 @@ Module VacuumCups
Return bVacOk
End Function
Private Function GetPluggerFromCameras(sCups) As Integer
Private Function GetPluggerFromCameras(sCups() As String) As Integer
Dim nCountPlunger As Integer = 1
Dim bPlugger1 As Boolean = False
Dim bPlugger2 As Boolean = False
+2 -1
View File
@@ -984,7 +984,8 @@ Friend Module VeinMatching
' Esporto il file come immagine
EgtSetCurrentContext(m_nVeinCtx)
Dim bOk As Boolean = (EgtGetFileType(sFilePath) = FT.IMG)
bOk = bOk AndAlso EgtGetImage(EgtGetShowMode(), New Color3d(255, 255, 255), New Color3d(255, 255, 255),
bOk = bOk AndAlso EgtGetImage(DirectCast( EgtGetShowMode(), EgtInterface.SM),
New Color3d(255, 255, 255), New Color3d(255, 255, 255),
m_nImgWidth, m_nImgHeight, sFilePath)
' Ripristino il contesto originale
EgtSetCurrentContext(nMainCtx)
+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, 2402, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2402, 1, m_nKeyOptions)
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2405, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2405, 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.4.4.1")>
<Assembly: AssemblyFileVersion("2.4.4.1")>
<Assembly: AssemblyVersion("2.4.5.1")>
<Assembly: AssemblyFileVersion("2.4.5.1")>
+1 -1
View File
@@ -111,7 +111,7 @@ Public Class MyMachGroupPanelVM
Dim nTabInd As Integer = 1
Dim nTabCnt As Integer = CamAuto.GetTableCount()
If nTabCnt > 1 And nTabCnt <= 3 Then
Dim dlg As New SelectTableWindowV(Application.Current.MainWindow, New SelectTableWindowVM(nTabCnt))
Dim dlg As New SelectTableWindowV(Application.Current.MainWindow, New SelectTableWindowVM(DirectCast(nTabCnt, SelectTableWindowVM.TableNumOpt)))
dlg.ShowDialog()
nTabInd = dlg.m_SelTable
End If
+12 -5
View File
@@ -224,13 +224,17 @@ Public Class MachiningTabVM
End Property
Public Sub Prev(ByVal param As Object)
Dim bOk As Boolean = True
' Dichiaro solo visualizzazione
m_bIsShow = True
If m_MachiningMode = MachiningModeOpt.SPLIT Then
OmagOFFICEMap.refSplitModeVM.ExitSplitRaw(False)
Else
OmagOFFICEMap.refMoveRawModeVM.ExitMoveRaw()
' verifico collisione dei pezzi in fase di scarico
bOk = OmagOFFICEMap.refMoveRawModeVM.ExitMoveRaw()
End If
' se trovata interferenza tra grezzi (dopo movimentazione) esco
If Not bOk Then Return
' Torno alla fase precedente
EgtSetCurrPhase(EgtGetCurrPhase() - 1)
' Si va sempre in Split
@@ -255,19 +259,22 @@ Public Class MachiningTabVM
End Property
Public Sub NextCmd(ByVal param As Object)
Dim bOk As Boolean = True
If m_MachiningMode = MachiningModeOpt.SPLIT Then
OmagOFFICEMap.refSplitModeVM.ExitSplitRaw(False)
MachiningMode = MachiningModeOpt.MOVERAWPART
AutoVisibility = Visibility.Hidden
OmagOFFICEMap.refMoveRawModeVM.InitMoveRaw()
bOk = OmagOFFICEMap.refMoveRawModeVM.InitMoveRaw()
Else
OmagOFFICEMap.refMoveRawModeVM.ExitMoveRaw()
' se verificata una interferenza allora esco
bOk = OmagOFFICEMap.refMoveRawModeVM.ExitMoveRaw()
If Not bOk Then Return
MachiningMode = MachiningModeOpt.SPLIT
AutoVisibility = Visibility.Visible
OmagOFFICEMap.refSplitModeVM.InitSplitRaw()
End If
' Aggiorno possibilità di uscire
ManageExit()
' Se non ci sono interferenze tra i grezzi -> aggiorno possibilità di uscire
If bOk Then ManageExit()
End Sub
#End Region ' NextCommand
+92 -5
View File
@@ -17,6 +17,7 @@ Public Class MoveRawModeVM
Private m_bRemovedRaw As Boolean = False ' flag per rimozione manuale pezzi
Private m_RawMoveDataList As New List(Of RawMoveData) ' dati di movimento
Private m_bRawWithCups As Boolean = False ' flag per pezzo corrente con ventose
Private m_CurrRawOnVacuum As Integer = GDB_ID.NULL ' identificativo pezzo correntemente attaccato alle ventose
Private m_dMoveStep As Double
Public Property MoveStep As String
@@ -108,6 +109,17 @@ Public Class MoveRawModeVM
#Region "METHODS"
Friend Function InitMoveRaw() As Boolean
'' verifico che il pezzo sia depositabile
'If VerifyCollisionWithOtherRawPart(m_CurrRawOnVacuum) Then
' ' mantengo la selezione del pezzo
' EgtSetStatus(m_CurrRawOnVacuum, GDB_ST.SEL)
' OmagOFFICEMap.refStatusBarVM.SetOutputMessage("Collisione pezzi", 3, MSG_TYPE.ERROR_)
' EgtDraw()
' ' non cambio pagina
' Return False
'End If
' resetto l'inidice del pezzo da mnovimentare
m_CurrRawOnVacuum = GDB_ID.NULL
' Deseleziono tutto
EgtDeselectAll()
' Recupero i tagli allungati prima definiti
@@ -158,14 +170,14 @@ Public Class MoveRawModeVM
' Distanza iniziale
m_dCurrDist = 0
End If
' Non dovrebbe mai accadere, ma inizializzo con default
' Non dovrebbe mai accadere, ma inizializzo con default
Else
m_vtDir = Vector3d.Y_AX()
m_ptMid = Point3d.ORIG()
m_dOrigDist = 0
m_dCurrDist = 0
End If
' Altrimenti movimento con ventose
' Altrimenti movimento con ventose
Else
m_bRemovedRaw = False
m_bRawWithCups = False
@@ -182,7 +194,7 @@ Public Class MoveRawModeVM
If OmagOFFICEMap.refMachiningTabVM.ByHand Then
LRArrowVisibility = Visibility.Hidden
RotationVisibility = Visibility.Hidden
' Altrimenti per movimento con ventose
' Altrimenti per movimento con ventose
Else
LRArrowVisibility = Visibility.Visible
RotationVisibility = If(CurrentMachine.bRawSplMovRotate, Visibility.Visible, Visibility.Hidden)
@@ -195,6 +207,17 @@ Public Class MoveRawModeVM
End Function
Friend Function ExitMoveRaw() As Boolean
' verifico che il pezzo sia depositabile
If VerifyCollisionWithOtherRawPart(m_CurrRawOnVacuum) Then
' mantengo la selezione del pezzo
EgtSetStatus(m_CurrRawOnVacuum, GDB_ST.SEL)
OmagOFFICEMap.refStatusBarVM.SetOutputMessage("Collisione pezzi", 3, MSG_TYPE.ERROR_)
EgtDraw()
' non cambio pagina
Return False
End If
' resetto l'inidice del pezzo da mnovimentare
m_CurrRawOnVacuum = GDB_ID.NULL
' Deseleziono tutto
EgtDeselectAll()
' Se movimento con ventose
@@ -351,6 +374,39 @@ Public Class MoveRawModeVM
Return bOk
End Function
' Veririfica che il grezzo non entri in colliosione con altri pezzi
Private Function VerifyCollisionWithOtherRawPart(nIdOnVacumm As Integer) As Boolean
If nIdOnVacumm = GDB_ID.NULL Then Return False
' Creo gruppo temporaneo in cui generare le superfici per la veririfica di collisione
Dim m_nTempId As Integer = EgtCreateGroup(GDB_ID.ROOT)
If m_nTempId = GDB_ID.NULL Then Return False
EgtSetName(m_nTempId, "RawTemp")
Dim nIdActualRawOutLine As Integer = EgtGetFirstNameInGroup(nIdOnVacumm, "RawOutline")
Dim ActualRawFlatRegion As Integer = EgtCreateSurfFlatRegion(m_nTempId, nIdActualRawOutLine)
Dim nCurrPhase As Integer = EgtGetCurrPhase()
Dim nRawGroupId = EgtGetParent(EgtGetFirstRawPart())
Dim nIdRaw As Integer = EgtGetFirstRawPart()
' ciclo su tutti i grezzi per veririficare eventuali collisioni
While nIdRaw <> GDB_ID.NULL
' verifico la fase del grezzo
If EgtVerifyRawPartCurrPhase(nIdRaw) And nIdOnVacumm <> nIdRaw Then
' recupero il contorno del pezzo
Dim nIdRawOutLine As Integer = EgtGetFirstNameInGroup(nIdRaw, "RawOutline")
Dim nIdRawFlatRegion As Integer = EgtCreateSurfFlatRegion(m_nTempId, nIdRawOutLine)
If EgtSurfFrIntersect(nIdRawFlatRegion, ActualRawFlatRegion) Then
If EgtExistsObj(nIdRawFlatRegion) Then
EgtErase(m_nTempId)
' esiste una intersezione delle superfici
Return True
End If
End If
End If
nIdRaw = EgtGetNextRawPart(nIdRaw)
End While
EgtErase(m_nTempId)
Return False
End Function
#End Region ' METHODS
#Region "COMMANDS"
@@ -685,12 +741,34 @@ Public Class MoveRawModeVM
' Se trovato il grezzo
If nParentId = nRawGroupId Then
Dim nStat As Integer = GDB_ST.ON_
' Se il pezzo corrente è selezionato allora lo disattivo -> deposito del pezzo
EgtGetStatus(nId, nStat)
If nStat = GDB_ST.SEL Then
EgtSetStatus(nId, GDB_ST.ON_)
' Se con ventose, le nascondo
If Not OmagOFFICEMap.refMachiningTabVM.ByHand Then EgtSetStatus(GetVacuumId(), GDB_ST.OFF)
' prima di rilasciare il pezzo verifico che non vada in collisione con altri pezzi sulla tavola
If VerifyCollisionWithOtherRawPart(nId) Then
' mantengo la selezione del pezzo
EgtSetStatus(nId, GDB_ST.SEL)
OmagOFFICEMap.refStatusBarVM.SetOutputMessage("Collisione pezzi", 3, MSG_TYPE.ERROR_)
Else
' Se con ventose, le nascondo
If Not OmagOFFICEMap.refMachiningTabVM.ByHand Then EgtSetStatus(GetVacuumId(), GDB_ST.OFF)
End If
Else
' verifico che il pezzo precedente possa essere depositato correttamente
If VerifyCollisionWithOtherRawPart(m_CurrRawOnVacuum) Then
' mantengo la selezione del pezzo
EgtSetStatus(m_CurrRawOnVacuum, GDB_ST.SEL)
OmagOFFICEMap.refStatusBarVM.SetOutputMessage("Collisione pezzi", 3, MSG_TYPE.ERROR_)
EgtDraw()
' esco dal ciclo, prima devo depositare correttamente il pezzo
Exit While
End If
' salvo l'indice del pezzo correntemente attaccato alle ventose
m_CurrRawOnVacuum = nId
EgtDeselectAll()
EgtSetStatus(nId, GDB_ST.SEL)
' Se con ventose, le posiziono sul grezzo
@@ -736,6 +814,15 @@ Public Class MoveRawModeVM
End If
nId = EgtGetNextObjInSelWin()
End While
' clicco su un oggetto che non è un grezzo -> verifico che il pezzo precedente possa essere depositato correttamente
If VerifyCollisionWithOtherRawPart(m_CurrRawOnVacuum) Then
' mantengo la selezione del pezzo
EgtSetStatus(m_CurrRawOnVacuum, GDB_ST.SEL)
OmagOFFICEMap.refStatusBarVM.SetOutputMessage("Collisione pezzi", 3, MSG_TYPE.ERROR_)
EgtDraw()
End If
End Sub
#End Region ' EVENTS
+4 -4
View File
@@ -154,14 +154,14 @@
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Button Content="{Binding RemovePartMsg}"
Grid.ColumnSpan="{Binding DragRettangle_Cl_Span}"
Grid.ColumnSpan="{Binding DragRectangle_Cl_Span}"
Style="{StaticResource OptionPanel_TextButton}"
Command="{Binding RemovePartCommand}"
Margin="0,0,2.5,0"/>
<ToggleButton Content="{Binding DragRettangleMsg}" Grid.Column="1"
Visibility="{Binding DragRettangle_Visibility}"
<ToggleButton Content="{Binding DragRectangleMsg}" Grid.Column="1"
Visibility="{Binding DragRectangle_Visibility}"
Style="{StaticResource OptionPanel_ToggleButton}"
IsChecked="{Binding bDragRettangle}"
IsChecked="{Binding bDragRectangle}"
Margin="2.5,0,2.5,0"/>
</Grid>
+101 -102
View File
@@ -36,14 +36,14 @@ Public Class NestingTabVM
Private m_bCsvData As Boolean = False
' Id del rettangolo, del traglio e della curva da modificare tramite Drag
Private m_nIdSelectedOutLoopRettangle As Integer = GDB_ID.NULL
Private m_nIdSelectedRegionRettangle As Integer = GDB_ID.NULL
Private m_nIdSelectedSawRettangle As Integer = GDB_ID.NULL
Private m_nIdSelectedCurvRettangle As Integer = GDB_ID.NULL
Private m_nIdSelectedTextRettangle As Integer = GDB_ID.NULL
Private m_nIdSelectedTextTopRettangle As Integer = GDB_ID.NULL
Private m_nIdSelectedFlatSurfRettangle As Integer = GDB_ID.NULL
Private m_SideListRettangle(4) As Integer
Private m_nIdSelectedOutLoopRectangle As Integer = GDB_ID.NULL
Private m_nIdSelectedRegionRectangle As Integer = GDB_ID.NULL
Private m_nIdSelectedSawRectangle As Integer = GDB_ID.NULL
Private m_nIdSelectedCurvRectangle As Integer = GDB_ID.NULL
Private m_nIdSelectedTextRectangle As Integer = GDB_ID.NULL
Private m_nIdSelectedTextTopRectangle As Integer = GDB_ID.NULL
Private m_nIdSelectedFlatSurfRectangle As Integer = GDB_ID.NULL
Private m_SideListRectangle(4) As Integer
Private m_sTextContent As String = String.Empty
@@ -172,7 +172,7 @@ Public Class NestingTabVM
End Get
End Property
Public ReadOnly Property DragRettangleMsg As String
Public ReadOnly Property DragRectangleMsg As String
Get
Return "Drag Rectangle"
End Get
@@ -228,13 +228,13 @@ Public Class NestingTabVM
#Region "CONSTRUCTOR"
Sub New()
If (GetMainPrivateProfileInt(S_NEST, K_DRAGRETTANGLE, 1) <> 0) Then
m_DragRettangle_Visibility = Visibility.Visible
If GetMainPrivateProfileInt(S_NEST, K_DRAGRECTANGLE, 1) <> 0 Then
m_DragRectangle_Visibility = Visibility.Visible
Else
m_DragRettangle_Visibility = Visibility.Collapsed
m_DragRectangle_Visibility = Visibility.Collapsed
End If
NotifyPropertyChanged("DragRettangle_Visibility")
NotifyPropertyChanged("DragRettangle_Cl_Span")
NotifyPropertyChanged("DragRectangle_Visibility")
NotifyPropertyChanged("DragRectangle_Cl_Span")
' Creo riferimento a questa classe in OmagOFFICEMap
OmagOFFICEMap.SetRefNestingTabVM(Me)
End Sub
@@ -551,14 +551,12 @@ Public Class NestingTabVM
Return True
End Function
#Region "DRAG RETTANGLE"
#Region "DRAG RECTANGLE"
' funzione chiamata da OnMyMouseMoveScene: verifica che la selezione sia corretta (deve essere il lato di una figura rettangolare)
Private Sub OnMyMouseDownSceneSelSideRettangle(sender As Object, e As System.Windows.Forms.MouseEventArgs)
' Si può selezionare solo con il tasto sinistro e se il bottone TEST Attivo
If e.Button <> Windows.Forms.MouseButtons.Left Then
Return
End If
Private Sub OnMyMouseDownSceneSelSideRectangle(sender As Object, e As System.Windows.Forms.MouseEventArgs)
' Si può selezionare solo con il tasto sinistro
If e.Button <> Windows.Forms.MouseButtons.Left Then Return
' Verifico se selezionato indicativo di pezzo
EgtSetObjFilterForSelWin(False, True, False, False, False)
Dim nSelMy As Integer
@@ -574,8 +572,8 @@ Public Class NestingTabVM
If sLayer = NAME_OUTLOOP Then
If EgtGetType(nIdMy) = GDB_TY.CRV_LINE Then
' -------------------------------- INIZIO VERIFICHE --------------------------------
m_nIdSelectedOutLoopRettangle = nIdParent
If Not IsRettangle(m_SideListRettangle) Then
m_nIdSelectedOutLoopRectangle = nIdParent
If Not IsRectangle(m_SideListRectangle) Then
'm_CurrProjPage.ClearMessage()
'm_CurrProjPage.SetWarningMessage("Non è un rettangolo (0)")
Return
@@ -599,26 +597,26 @@ Public Class NestingTabVM
Dim nIdSaw As Integer = EgtGetFirstNameInGroup(nIdPV, "Saw" & nIdMy.ToString)
' -------------------------------- FINE VERIFICHE --------------------------------
If Not EgtGetGroupObjs(nIdSaw) Then
m_nIdSelectedSawRettangle = nIdSaw
m_nIdSelectedCurvRettangle = nIdMy
If EgtGetGroupObjs(nIdSaw) <> 0 Then
m_nIdSelectedSawRectangle = nIdSaw
m_nIdSelectedCurvRectangle = nIdMy
m_nIdSelectedRegionRettangle = EgtGetFirstNameInGroup(nIdParentPart, NAME_REGION)
' recupero i testi cintenuti nel layer Region
If m_nIdSelectedRegionRettangle <> GDB_ID.NULL Then
Dim nCurrId As Integer = EgtGetFirstInGroup(m_nIdSelectedRegionRettangle)
m_nIdSelectedRegionRectangle = EgtGetFirstNameInGroup(nIdParentPart, NAME_REGION)
' recupero i testi contenuti nel layer Region
If m_nIdSelectedRegionRectangle <> GDB_ID.NULL Then
Dim nCurrId As Integer = EgtGetFirstInGroup(m_nIdSelectedRegionRectangle)
While nCurrId <> GDB_ID.NULL
If EgtGetType(nCurrId) = GDB_TY.EXT_TEXT Then
Dim sVal As String = String.Empty
EgtTextGetContent(nCurrId, sVal)
If sVal = "*TOP*" Then
m_nIdSelectedTextTopRettangle = nCurrId
m_nIdSelectedTextTopRectangle = nCurrId
Else
m_nIdSelectedTextRettangle = nCurrId
m_sTextContent = GetMyRettangleText(sVal)
m_nIdSelectedTextRectangle = nCurrId
m_sTextContent = GetMyRectangleText(sVal)
End If
ElseIf EgtGetType(nCurrId) = GDB_TY.SRF_FRGN Then
m_nIdSelectedFlatSurfRettangle = nCurrId
m_nIdSelectedFlatSurfRectangle = nCurrId
End If
nCurrId = EgtGetNext(nCurrId)
End While
@@ -631,15 +629,15 @@ Public Class NestingTabVM
Exit While
End If
End If
' se le'elemto corrente non è una linea
' se l'elemento corrente non è una linea
End If
' se le'elemto corrente non appartiene al layer OutLoop passo al prossimo elemento dell'elenco
' se l'elemento corrente non appartiene al layer OutLoop passo al prossimo elemento dell'elenco
nIdMy = EgtGetNextObjInSelWin()
End While
End Sub
' restituisce il valore del Text ripulito dalle dimensioni
Private Function GetMyRettangleText(sTextPz As String) As String
Private Function GetMyRectangleText(sTextPz As String) As String
' da DrawPageUC.xaml.vb/MultipleInsert
Dim sText As String = String.Empty
If sTextPz.Contains("<br/>") Then
@@ -650,56 +648,57 @@ Public Class NestingTabVM
If sTextPz.Contains(" ") Then
Dim sInfo() As String = sTextPz.Split(" "c)
If sInfo.Count > 3 Then
Return sText = sInfo(0) & " " & sInfo(1) & " "
sText = sInfo(0) & " " & sInfo(1) & " "
Return sText
End If
End If
Return sText
End Function
' verifico che la figura selezionata sia realmente un rettangolo
Private Function IsRettangle(ByRef IdSideList() As Integer) As Boolean
Private Function IsRectangle(ByRef IdSideList() As Integer) As Boolean
' creo una lista con i lati del rettangolo
Dim nCounter As Integer = 0
' recupero i lati dal leyer "OutLoop"
Dim IdSideRettangle As Integer = EgtGetFirstInGroup(m_nIdSelectedOutLoopRettangle)
While IdSideRettangle <> GDB_ID.NULL And nCounter < 4
Dim IdSideRectangle As Integer = EgtGetFirstInGroup(m_nIdSelectedOutLoopRectangle)
While IdSideRectangle <> GDB_ID.NULL And nCounter < 4
Dim sVal As String = String.Empty
Dim dPrevAng As Double = 0
EgtGetInfo(IdSideRettangle, "PrevAng", sVal)
EgtGetInfo(IdSideRectangle, "PrevAng", sVal)
StringToDouble(sVal, dPrevAng)
Dim dNextAng As Double = 0
EgtGetInfo(IdSideRettangle, "NextAng", sVal)
EgtGetInfo(IdSideRectangle, "NextAng", sVal)
StringToDouble(sVal, dNextAng)
' se gli angoli non sono retti allora esco senza caricare il lato corrente
If Math.Abs(dPrevAng - 90) > EPS_ANG_SMALL OrElse Math.Abs(dNextAng - 90) > EPS_ANG_SMALL Then
Exit While
End If
IdSideList(nCounter) = IdSideRettangle
IdSideList(nCounter) = IdSideRectangle
nCounter += 1
IdSideRettangle = EgtGetNext(IdSideRettangle)
IdSideRectangle = EgtGetNext(IdSideRectangle)
End While
' verifico che siano solo quattro lati
If IdSideRettangle = GDB_ID.NULL And nCounter = 4 Then
If IdSideRectangle = GDB_ID.NULL And nCounter = 4 Then
' solo se la figura ha 4 lati ortogonali
Return True
End If
m_nIdSelectedOutLoopRettangle = GDB_ID.NULL
m_nIdSelectedOutLoopRectangle = GDB_ID.NULL
' la figura presenta più/meno di 4 lati
Return False
End Function
' recupero le informazioni correnti per sapere se la figura è mdificabile
Private Function GetRettangleInfoScale(ByRef frFixed As Frame3d, ByRef MaxLen As Double, ByRef MinLen As Double) As Vector3d
Private Function GetRectangleInfoScale(ByRef frFixed As Frame3d, ByRef MaxLen As Double, ByRef MinLen As Double) As Vector3d
' determino la direzione del lato selezionato
Dim vtDirSelectedCurv As New Vector3d
EgtStartVector(m_nIdSelectedCurvRettangle, GDB_ID.ROOT, vtDirSelectedCurv)
EgtStartVector(m_nIdSelectedCurvRectangle, GDB_ID.ROOT, vtDirSelectedCurv)
' recupero il lato successivo a quello selezionato
Dim Index As Integer = 0
Dim Len As Double = 0
For Ind As Integer = 0 To 3
If m_SideListRettangle(Ind) = m_nIdSelectedCurvRettangle Then
If m_SideListRectangle(Ind) = m_nIdSelectedCurvRectangle Then
' verifico se esiste un lato Precedente altrimenti recupero l'ultimo della lista
If Ind = 0 Then
Index = 3
@@ -709,8 +708,8 @@ Public Class NestingTabVM
End If
Next
' recupero la dimensione del lato
EgtCurveLength(m_SideListRettangle(Index), MaxLen)
EgtCurveLength(m_nIdSelectedCurvRettangle, MinLen)
EgtCurveLength(m_SideListRectangle(Index), MaxLen)
EgtCurveLength(m_nIdSelectedCurvRectangle, MinLen)
' verifico che il lato selezionato sia il maggiore
If MinLen > MaxLen Then Return Nothing
@@ -718,11 +717,11 @@ Public Class NestingTabVM
' determimo il versore dal lato appena calcolato
Dim vtDir As New Vector3d
EgtStartVector(m_SideListRettangle(Index), GDB_ID.ROOT, vtDir)
EgtStartVector(m_SideListRectangle(Index), GDB_ID.ROOT, vtDir)
vtDir.Normalize()
Dim dProjectionBaseX As Double = vtDir * Vector3d.X_AX
Dim ptFixed As New Point3d
EgtStartPoint(m_SideListRettangle(Index), GDB_ID.ROOT, ptFixed)
EgtStartPoint(m_SideListRectangle(Index), GDB_ID.ROOT, ptFixed)
Dim vtPerp As New Vector3d(vtDir.x, vtDir.y, vtDir.z)
vtPerp.Rotate(Vector3d.Z_AX, 90)
@@ -735,7 +734,7 @@ Public Class NestingTabVM
End Function
' funzione chiamata da OnMyMouseMoveScene: gestisce la modifica lungo una dimensione del rettangolo selezionato
Private Sub OnMyMouseMoveSawRettangle(sender As Object, e As System.Windows.Forms.MouseEventArgs)
Private Sub OnMyMouseMoveSawRectangle(sender As Object, e As System.Windows.Forms.MouseEventArgs)
' Se drag non abilitato o già in esecuzione, esco
If Not m_bDrag Or m_bDragging Then Return
' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel
@@ -753,7 +752,7 @@ Public Class NestingTabVM
Dim MaxLen As Double = 0
Dim MinLen As Double = 0
' recupero info sul rettangolo selezionato
Dim vtDir As Vector3d = GetRettangleInfoScale(frFixed, MaxLen, MinLen)
Dim vtDir As Vector3d = GetRectangleInfoScale(frFixed, MaxLen, MinLen)
If vtDir.Equals(Vector3d.NULL) Then
Return
End If
@@ -774,34 +773,34 @@ Public Class NestingTabVM
' Modifico dimensione figura
If Math.Abs(dScalefactor) > EPS_SMALL * EPS_SMALL Then
EgtScale(m_nIdSelectedOutLoopRettangle, frFixed, dScalefactor, 1, 1, GDB_ID.ROOT)
EgtScale(m_nIdSelectedFlatSurfRettangle, frFixed, dScalefactor, 1, 1, GDB_ID.ROOT)
EgtScale(m_nIdSelectedOutLoopRectangle, frFixed, dScalefactor, 1, 1, GDB_RT.GLOB)
EgtScale(m_nIdSelectedFlatSurfRectangle, frFixed, dScalefactor, 1, 1, GDB_RT.GLOB)
Dim ptCen As Point3d
EgtCenterPoint(m_nIdSelectedTextRettangle, ptCen)
EgtModifyText(m_nIdSelectedTextRettangle, m_sTextContent & LenToString(MaxLen + dProjection, 2) & " x " & LenToString(MinLen, 2))
EgtMove(m_nIdSelectedTextRettangle, vtMove * 0.5, GDB_ID.ROOT)
If m_nIdSelectedTextTopRettangle <> GDB_ID.NULL Then
EgtMove(m_nIdSelectedTextTopRettangle, vtMove * 0.5, GDB_ID.ROOT)
EgtCenterPoint(m_nIdSelectedTextRectangle, ptCen)
EgtModifyText(m_nIdSelectedTextRectangle, m_sTextContent & LenToString(MaxLen + dProjection, 2) & " x " & LenToString(MinLen, 2))
EgtMove(m_nIdSelectedTextRectangle, vtMove * 0.5, GDB_RT.GLOB)
If m_nIdSelectedTextTopRectangle <> GDB_ID.NULL Then
EgtMove(m_nIdSelectedTextTopRectangle, vtMove * 0.5, GDB_RT.GLOB)
End If
End If
' verifico che il il lato maggiore rimanga semore il lato maggiore
Dim bRettangleCorrect As Boolean = False
If (MaxLen + dProjection - MinLen) > EPS_SMALL Then bRettangleCorrect = True
Dim bRectangleCorrect As Boolean = False
If (MaxLen + dProjection - MinLen) > EPS_SMALL Then bRectangleCorrect = True
Dim nWarn As Integer = 0
ResetAllMachinings(nWarn)
EnableReferenceRegion(False)
' se la modifica genera un errore allora ripristino la figura prima della defomrazione
If Not EgtVerifyPart(EgtGetParent(m_nIdSelectedOutLoopRettangle), True) Or Not bRettangleCorrect Then
EgtScale(m_nIdSelectedOutLoopRettangle, frFixed, 1 / dScalefactor, 1, 1, GDB_ID.ROOT)
EgtScale(m_nIdSelectedFlatSurfRettangle, frFixed, 1 / dScalefactor, 1, 1, GDB_ID.ROOT)
If Not EgtVerifyPart(EgtGetParent(m_nIdSelectedOutLoopRectangle), True) Or Not bRectangleCorrect Then
EgtScale(m_nIdSelectedOutLoopRectangle, frFixed, 1 / dScalefactor, 1, 1, GDB_RT.GLOB)
EgtScale(m_nIdSelectedFlatSurfRectangle, frFixed, 1 / dScalefactor, 1, 1, GDB_RT.GLOB)
Dim ptCen As Point3d
EgtCenterPoint(m_nIdSelectedTextRettangle, ptCen)
EgtModifyText(m_nIdSelectedTextRettangle, m_sTextContent & LenToString(MaxLen, 2) & " x " & LenToString(MinLen, 2))
EgtMove(m_nIdSelectedTextRettangle, -vtMove * 0.5, GDB_ID.ROOT)
If m_nIdSelectedTextTopRettangle <> GDB_ID.NULL Then
EgtMove(m_nIdSelectedTextTopRettangle, -vtMove * 0.5, GDB_ID.ROOT)
EgtCenterPoint(m_nIdSelectedTextRectangle, ptCen)
EgtModifyText(m_nIdSelectedTextRectangle, m_sTextContent & LenToString(MaxLen, 2) & " x " & LenToString(MinLen, 2))
EgtMove(m_nIdSelectedTextRectangle, -vtMove * 0.5, GDB_RT.GLOB)
If m_nIdSelectedTextTopRectangle <> GDB_ID.NULL Then
EgtMove(m_nIdSelectedTextTopRectangle, -vtMove * 0.5, GDB_RT.GLOB)
End If
End If
@@ -813,20 +812,20 @@ Public Class NestingTabVM
End Sub
' funzione chiamata da OnMyMouseUp: gestisce il reset di tutti gli indici in uso
Public Sub ResetDragRettangleParam()
Public Sub ResetDragRectangleParam()
' deseleziono l'elemento corrente
EgtDeselectObj(m_nIdSelectedSawRettangle)
EgtDeselectObj(m_nIdSelectedCurvRettangle)
EgtResetMark(m_nIdSelectedSawRettangle)
EgtDeselectObj(m_nIdSelectedSawRectangle)
EgtDeselectObj(m_nIdSelectedCurvRectangle)
EgtResetMark(m_nIdSelectedSawRectangle)
' resetto gli indici
m_nIdSelectedOutLoopRettangle = GDB_ID.NULL
m_nIdSelectedRegionRettangle = GDB_ID.NULL
m_nIdSelectedSawRettangle = GDB_ID.NULL
m_nIdSelectedCurvRettangle = GDB_ID.NULL
m_nIdSelectedTextRettangle = GDB_ID.NULL
m_nIdSelectedTextTopRettangle = GDB_ID.NULL
m_nIdSelectedFlatSurfRettangle = GDB_ID.NULL
m_SideListRettangle = {GDB_ID.NULL, GDB_ID.NULL, GDB_ID.NULL, GDB_ID.NULL}
m_nIdSelectedOutLoopRectangle = GDB_ID.NULL
m_nIdSelectedRegionRectangle = GDB_ID.NULL
m_nIdSelectedSawRectangle = GDB_ID.NULL
m_nIdSelectedCurvRectangle = GDB_ID.NULL
m_nIdSelectedTextRectangle = GDB_ID.NULL
m_nIdSelectedTextTopRectangle = GDB_ID.NULL
m_nIdSelectedFlatSurfRectangle = GDB_ID.NULL
m_SideListRectangle = {GDB_ID.NULL, GDB_ID.NULL, GDB_ID.NULL, GDB_ID.NULL}
m_sTextContent = String.Empty
' disattivo il drag
m_bDrag = False
@@ -840,26 +839,26 @@ Public Class NestingTabVM
#End Region ' METHODS
Private m_bDragRettangle As Boolean
Public Property bDragRettangle As Boolean
Private m_bDragRectangle As Boolean
Public Property bDragRectangle As Boolean
Get
Return m_bDragRettangle
Return m_bDragRectangle
End Get
Set(value As Boolean)
m_bDragRettangle = value
m_bDragRectangle = value
End Set
End Property
Private m_DragRettangle_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property DragRettangle_Visibility As Visibility
Private m_DragRectangle_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property DragRectangle_Visibility As Visibility
Get
Return m_DragRettangle_Visibility
Return m_DragRectangle_Visibility
End Get
End Property
Public ReadOnly Property DragRettangle_Cl_Span As Integer
Public ReadOnly Property DragRectangle_Cl_Span As Integer
Get
If m_DragRettangle_Visibility = Visibility.Visible Then
If m_DragRectangle_Visibility = Visibility.Visible Then
Return 1
End If
Return 2
@@ -1537,12 +1536,12 @@ Public Class NestingTabVM
#Region "EVENTS"
Friend Sub OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs)
' se in modalità DragRettangle (deformazione delle componenti rettangolari)
If m_bDragRettangle Then
OnMyMouseDownSceneSelSideRettangle(sender, e)
' se in modalità DragRectangle (deformazione delle componenti rettangolari)
If m_bDragRectangle Then
OnMyMouseDownSceneSelSideRectangle(sender, e)
' Dati per drag (abilito il Drag)
m_locPrev = e.Location
m_bDrag = EgtUnProjectPoint(e.Location, m_ptPrev) And m_nIdSelectedCurvRettangle <> GDB_ID.NULL
m_bDrag = EgtUnProjectPoint(e.Location, m_ptPrev) And m_nIdSelectedCurvRectangle <> GDB_ID.NULL
m_bDragToStart = m_bDrag
m_bVerify = m_bDrag AndAlso (Keyboard.Modifiers And ModifierKeys.Shift) > 0
m_vtTotMove = Vector3d.NULL()
@@ -1570,7 +1569,7 @@ Public Class NestingTabVM
If NameLayer = INFO_COUNTERLY Then
Dim sText As String = String.Empty
If EgtTextGetContent(nId, sText) Then
Dim sItems() As String = sText.Split("#")
Dim sItems() As String = sText.Split("#"c)
If sItems.Count > 1 Then
m_nCurrNubrOfParts = 0
If StringToInt(sItems(1), m_nCurrNubrOfParts) Then
@@ -1619,8 +1618,8 @@ Public Class NestingTabVM
End If
' se devo muovere un lato del rettangolo
If m_bDragRettangle Then
OnMyMouseMoveSawRettangle(sender, e)
If m_bDragRectangle Then
OnMyMouseMoveSawRectangle(sender, e)
Return
End If
@@ -1725,9 +1724,9 @@ Public Class NestingTabVM
End Sub
Friend Sub OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
If m_bDragRettangle Then
If m_bDragRectangle Then
' deseleziono gli oggeti, resetto le variabili usate, aggiorno il disegno
ResetDragRettangleParam()
ResetDragRectangleParam()
Return
End If
' Se eseguito drag
+1 -1
View File
@@ -71,7 +71,7 @@ Public Class OptionWindowVM
OmagOFFICEMap.refRawPartTabVM.Refresh(PrevMeasureUnit)
OmagOFFICEMap.refNestingTabVM.Refresh(PrevMeasureUnit)
OmagOFFICEMap.refMoveRawModeVM.Refresh(PrevMeasureUnit)
OmagOFFICEMap.refSimulTabVM.MySimul.Refresh(PrevMeasureUnit)
If Not IsNothing(OmagOFFICEMap.refSimulTabVM.MySimul) Then OmagOFFICEMap.refSimulTabVM.MySimul.Refresh(PrevMeasureUnit)
End If
End Set
End Property
+2 -2
View File
@@ -128,9 +128,9 @@ Public Class TopCommandBarVM
''' <summary>
''' Execute the New. This method is invoked by the NewCommand.
''' </summary>
Friend Sub NewCmd(Optional bUseDefaults As Boolean = False)
Friend Sub NewCmd()
OmagOFFICEMap.refSceneHostVM.NewProject()
OmagOFFICEMap.refMachGroupPanelVM.InitMachGroupList(bUseDefaults)
OmagOFFICEMap.refMachGroupPanelVM.InitMachGroupList(False)
End Sub
#End Region ' NewCommand