Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 614756e1bb |
@@ -121,7 +121,6 @@ Module ConstIni
|
|||||||
Public Const K_TEXTCOLOR As String = "TextColor"
|
Public Const K_TEXTCOLOR As String = "TextColor"
|
||||||
Public Const K_AUTOMATICOPTIMIZE As String = "AutomaticOptimize"
|
Public Const K_AUTOMATICOPTIMIZE As String = "AutomaticOptimize"
|
||||||
Public Const K_AUTOMATICMAXTIME As String = "AutomaticMaxTime"
|
Public Const K_AUTOMATICMAXTIME As String = "AutomaticMaxTime"
|
||||||
Public Const K_DRAGRETTANGLE As String = "DragRettangle"
|
|
||||||
|
|
||||||
Public Const S_SPLIT As String = "Split"
|
Public Const S_SPLIT As String = "Split"
|
||||||
Public Const K_MOVE_LEV As String = "MoveLevel"
|
Public Const K_MOVE_LEV As String = "MoveLevel"
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ Module ConstMach
|
|||||||
Public Const KEY_VACLAY_SEL As String = "Sel"
|
Public Const KEY_VACLAY_SEL As String = "Sel"
|
||||||
' Info in gruppo layout per angolo di rotazione preferito
|
' Info in gruppo layout per angolo di rotazione preferito
|
||||||
Public Const KEY_VACLAY_PREFROT As String = "PreferredRot"
|
Public Const KEY_VACLAY_PREFROT As String = "PreferredRot"
|
||||||
|
Public Const KEY_VACLAY_PREFVROTXMINUS As String = "PrefVertRotXMinus"
|
||||||
|
Public Const KEY_VACLAY_PREFVROTXPLUS As String = "PrefVertRotXPlus"
|
||||||
' Info in gruppo layout per direzione di riferimento ventose per tagli da sotto
|
' Info in gruppo layout per direzione di riferimento ventose per tagli da sotto
|
||||||
Public Const KEY_VACLAY_DRIPREFDIR As String = "DripRefDir"
|
Public Const KEY_VACLAY_DRIPREFDIR As String = "DripRefDir"
|
||||||
' Info in asse rotante ventosa per step discreti
|
' Info in asse rotante ventosa per step discreti
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ Module VacuumCups
|
|||||||
Private m_nVacId As Integer = GDB_ID.NULL
|
Private m_nVacId As Integer = GDB_ID.NULL
|
||||||
Private m_nRefId As Integer = GDB_ID.NULL
|
Private m_nRefId As Integer = GDB_ID.NULL
|
||||||
Private m_dPreferredRot As Double = 0
|
Private m_dPreferredRot As Double = 0
|
||||||
|
Private m_dPrefVertRotXMinus As Double = 0
|
||||||
|
Private m_dPrefVertRotXPlus As Double = 0
|
||||||
Private m_dDripRefAng As Double = 0
|
Private m_dDripRefAng As Double = 0
|
||||||
|
|
||||||
' Nome del gruppo temporaneo per le ventose
|
' Nome del gruppo temporaneo per le ventose
|
||||||
@@ -73,7 +75,10 @@ Module VacuumCups
|
|||||||
m_nVacId = EgtCopyGlob(nLayId, m_nTempId)
|
m_nVacId = EgtCopyGlob(nLayId, m_nTempId)
|
||||||
If m_nVacId = GDB_ID.NULL Then Return False
|
If m_nVacId = GDB_ID.NULL Then Return False
|
||||||
' Angolo di rotazione preferito
|
' Angolo di rotazione preferito
|
||||||
EgtGetInfo( m_nVacId, KEY_VACLAY_PREFROT, m_dPreferredRot)
|
EgtGetInfo(m_nVacId, KEY_VACLAY_PREFROT, m_dPreferredRot)
|
||||||
|
' Angoli di rotazione preferiti per ventosa in verticale (lungo Y) a sinistra e a destra del centro tavola
|
||||||
|
EgtGetInfo(m_nVacId, KEY_VACLAY_PREFVROTXMINUS, m_dPrefVertRotXMinus)
|
||||||
|
EgtGetInfo(m_nVacId, KEY_VACLAY_PREFVROTXPLUS, m_dPrefVertRotXPlus)
|
||||||
' Direzione di riferimento per tagli Drip
|
' Direzione di riferimento per tagli Drip
|
||||||
EgtGetInfo( m_nVacId, KEY_VACLAY_DRIPREFDIR, m_dDripRefAng)
|
EgtGetInfo( m_nVacId, KEY_VACLAY_DRIPREFDIR, m_dDripRefAng)
|
||||||
' Nascondo il gruppo ma rendo visibili le curve di contorno delle ventose
|
' Nascondo il gruppo ma rendo visibili le curve di contorno delle ventose
|
||||||
@@ -363,6 +368,9 @@ Module VacuumCups
|
|||||||
If b3Vac.IsEmpty() Then Return INFINITO
|
If b3Vac.IsEmpty() Then Return INFINITO
|
||||||
' Se box maggiore di quello del pezzo, scarto soluzione
|
' Se box maggiore di quello del pezzo, scarto soluzione
|
||||||
If b3Vac.Radius() > b3Raw.Radius() Then Return INFINITO
|
If b3Vac.Radius() > b3Raw.Radius() Then Return INFINITO
|
||||||
|
' Recupero l'area della tavola
|
||||||
|
Dim b3Tab As New BBox3d
|
||||||
|
EgtGetTableArea(1, b3Tab)
|
||||||
' Determino il movimento
|
' Determino il movimento
|
||||||
vtMove = ptRawCen - b3Vac.Center()
|
vtMove = ptRawCen - b3Vac.Center()
|
||||||
b3Vac.Move(vtMove)
|
b3Vac.Move(vtMove)
|
||||||
@@ -374,11 +382,19 @@ Module VacuumCups
|
|||||||
frMinRect.VersX().ToSpherical(dLen, dAngVertDeg, dAngOrizzDeg)
|
frMinRect.VersX().ToSpherical(dLen, dAngVertDeg, dAngOrizzDeg)
|
||||||
dRotAngDeg = dAngOrizzDeg
|
dRotAngDeg = dAngOrizzDeg
|
||||||
If b3Vac.DimY() > b3Vac.DimX() + EPS_SMALL Then dRotAngDeg -= 90
|
If b3Vac.DimY() > b3Vac.DimX() + EPS_SMALL Then dRotAngDeg -= 90
|
||||||
|
Dim dPreferredRot As Double = m_dPreferredRot
|
||||||
|
If Math.Abs(dRotAngDeg - 90) < 45 Or Math.Abs(dRotAngDeg - 270) < 45 Then
|
||||||
|
If frMinRect.Orig().x < b3Tab.Center().x Then
|
||||||
|
dPreferredRot = m_dPrefVertRotXMinus
|
||||||
|
Else
|
||||||
|
dPreferredRot = m_dPrefVertRotXPlus
|
||||||
|
End If
|
||||||
|
End If
|
||||||
Dim dAngDelta As Double = If( Math.Abs( b3Vac.DimY() - b3Vac.DimX()) < 10 * EPS_SMALL, 90, 180)
|
Dim dAngDelta As Double = If( Math.Abs( b3Vac.DimY() - b3Vac.DimX()) < 10 * EPS_SMALL, 90, 180)
|
||||||
While dRotAngDeg - m_dPreferredRot >= dAngDelta / 2
|
While dRotAngDeg - dPreferredRot >= dAngDelta / 2
|
||||||
dRotAngDeg -= dAngDelta
|
dRotAngDeg -= dAngDelta
|
||||||
End While
|
End While
|
||||||
While dRotAngDeg - m_dPreferredRot <= -dAngDelta / 2
|
While dRotAngDeg - dPreferredRot <= -dAngDelta / 2
|
||||||
dRotAngDeg += dAngDelta
|
dRotAngDeg += dAngDelta
|
||||||
End While
|
End While
|
||||||
Else
|
Else
|
||||||
@@ -431,8 +447,6 @@ Module VacuumCups
|
|||||||
ptRef.Move(vtMove)
|
ptRef.Move(vtMove)
|
||||||
ptRef.Rotate(ptRotCen, Vector3d.Z_AX(), dRotAngDeg)
|
ptRef.Rotate(ptRotCen, Vector3d.Z_AX(), dRotAngDeg)
|
||||||
' Ne calcolo la distanza dal centro della tavola
|
' Ne calcolo la distanza dal centro della tavola
|
||||||
Dim b3Tab As New BBox3d
|
|
||||||
EgtGetTableArea(1, b3Tab)
|
|
||||||
Dim dDist As Double = Point3d.DistXY(ptRef, b3Tab.Center())
|
Dim dDist As Double = Point3d.DistXY(ptRef, b3Tab.Center())
|
||||||
Return dDist
|
Return dDist
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
Command="{Binding ImportDxfCommand}">
|
Command="{Binding ImportDxfCommand}">
|
||||||
<Image Source="/Resources/NestingTab/ImportDxf.png" Stretch="Uniform"/>
|
<Image Source="/Resources/NestingTab/ImportDxf.png" Stretch="Uniform"/>
|
||||||
</Button>
|
</Button>
|
||||||
<ToggleButton Grid.Column="4" Grid.Row="0"
|
<ToggleButton Grid.Column="4" Grid.Row="0"
|
||||||
Style="{StaticResource OptionPanel_NestingToggleButton}"
|
Style="{StaticResource OptionPanel_NestingToggleButton}"
|
||||||
IsChecked="{Binding CsvImport_IsChecked}">
|
IsChecked="{Binding CsvImport_IsChecked}">
|
||||||
<Image Source="/Resources/NestingTab/ImportCsv.png" Stretch="Uniform"/>
|
<Image Source="/Resources/NestingTab/ImportCsv.png" Stretch="Uniform"/>
|
||||||
@@ -148,24 +148,11 @@
|
|||||||
Margin="2.5,0,0,0"/>
|
Margin="2.5,0,0,0"/>
|
||||||
</UniformGrid>
|
</UniformGrid>
|
||||||
|
|
||||||
<Grid Margin="0,0,-2.5,5">
|
<Button Content="{Binding RemovePartMsg}"
|
||||||
<Grid.ColumnDefinitions>
|
Style="{StaticResource OptionPanel_TextButton}"
|
||||||
<ColumnDefinition Width="1*"/>
|
Command="{Binding RemovePartCommand}"
|
||||||
<ColumnDefinition Width="1*"/>
|
Margin="0,0,0,5"/>
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Button Content="{Binding RemovePartMsg}"
|
|
||||||
Grid.ColumnSpan="{Binding DragRettangle_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}"
|
|
||||||
Style="{StaticResource OptionPanel_ToggleButton}"
|
|
||||||
IsChecked="{Binding bDragRettangle}"
|
|
||||||
Margin="2.5,0,2.5,0"/>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
|
|
||||||
<UniformGrid Columns="2" Margin="0,0,0,5">
|
<UniformGrid Columns="2" Margin="0,0,0,5">
|
||||||
<Button Content="{Binding SelectAllMsg}"
|
<Button Content="{Binding SelectAllMsg}"
|
||||||
Style="{StaticResource OptionPanel_TextButton}"
|
Style="{StaticResource OptionPanel_TextButton}"
|
||||||
|
|||||||
@@ -35,18 +35,6 @@ Public Class NestingTabVM
|
|||||||
Private m_bTrfData As Boolean = False
|
Private m_bTrfData As Boolean = False
|
||||||
Private m_bCsvData As Boolean = False
|
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_sTextContent As String = String.Empty
|
|
||||||
|
|
||||||
|
|
||||||
Private m_CsvImportWindow As CsvWindowV
|
Private m_CsvImportWindow As CsvWindowV
|
||||||
Friend ReadOnly Property CsvImportWindow As CsvWindowV
|
Friend ReadOnly Property CsvImportWindow As CsvWindowV
|
||||||
Get
|
Get
|
||||||
@@ -173,12 +161,6 @@ Public Class NestingTabVM
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public ReadOnly Property DragRettangleMsg As String
|
|
||||||
Get
|
|
||||||
Return "Drag Rettangle"
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Public ReadOnly Property SelectAllMsg As String
|
Public ReadOnly Property SelectAllMsg As String
|
||||||
Get
|
Get
|
||||||
Return EgtMsg(MSG_NESTPAGEUC + 4)
|
Return EgtMsg(MSG_NESTPAGEUC + 4)
|
||||||
@@ -229,13 +211,6 @@ Public Class NestingTabVM
|
|||||||
#Region "CONSTRUCTOR"
|
#Region "CONSTRUCTOR"
|
||||||
|
|
||||||
Sub New()
|
Sub New()
|
||||||
If (GetMainPrivateProfileInt(S_NEST, K_DRAGRETTANGLE, 1) <> 0) Then
|
|
||||||
m_DragRettangle_Visibility = Visibility.Visible
|
|
||||||
Else
|
|
||||||
m_DragRettangle_Visibility = Visibility.Collapsed
|
|
||||||
End If
|
|
||||||
NotifyPropertyChanged("DragRettangle_Visibility")
|
|
||||||
NotifyPropertyChanged("DragRettangle_Cl_Span")
|
|
||||||
' Creo riferimento a questa classe in OmagOFFICEMap
|
' Creo riferimento a questa classe in OmagOFFICEMap
|
||||||
OmagOFFICEMap.SetRefNestingTabVM(Me)
|
OmagOFFICEMap.SetRefNestingTabVM(Me)
|
||||||
End Sub
|
End Sub
|
||||||
@@ -531,318 +506,8 @@ Public Class NestingTabVM
|
|||||||
Return True
|
Return True
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
#Region "DRAG RETTANGLE"
|
|
||||||
|
|
||||||
' 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
|
|
||||||
' Verifico se selezionato indicativo di pezzo
|
|
||||||
EgtSetObjFilterForSelWin(False, True, False, False, False)
|
|
||||||
Dim nSelMy As Integer
|
|
||||||
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSelMy)
|
|
||||||
Dim nIdMy As Integer = EgtGetFirstObjInSelWin()
|
|
||||||
While nIdMy <> GDB_ID.NULL
|
|
||||||
Dim sLayer As String = String.Empty
|
|
||||||
' layer di origine
|
|
||||||
Dim nIdParent As Integer = EgtGetParent(nIdMy)
|
|
||||||
' recupero il nome del Layer
|
|
||||||
EgtGetName(nIdParent, sLayer)
|
|
||||||
' solo se il nome del layer è quello associato ad un lato esterno allora procedo con l'evidenziazione
|
|
||||||
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_CurrProjPage.ClearMessage()
|
|
||||||
'm_CurrProjPage.SetWarningMessage("Non è un rettangolo (0)")
|
|
||||||
Return
|
|
||||||
End If
|
|
||||||
' recupero il gruppo della lavorazione associata
|
|
||||||
Dim nIdParentPart As Integer = EgtGetParent(nIdParent)
|
|
||||||
Dim nIdPV As Integer = EgtGetFirstNameInGroup(nIdParentPart, "PV")
|
|
||||||
' se non esiste un gruppo di lavorazione associato allora esco
|
|
||||||
If nIdPV = GDB_ID.NULL Then
|
|
||||||
'm_CurrProjPage.ClearMessage()
|
|
||||||
'm_CurrProjPage.SetWarningMessage("Pezzo in parcheggio (1)")
|
|
||||||
Return
|
|
||||||
End If
|
|
||||||
' se esiste ma è vuoto (pezzo scaricato da tavola)
|
|
||||||
If EgtGetFirstInGroup(nIdPV) = GDB_ID.NULL Then
|
|
||||||
'm_CurrProjPage.ClearMessage()
|
|
||||||
'm_CurrProjPage.SetWarningMessage("Pezzo in parcheggio (2)")
|
|
||||||
Return
|
|
||||||
End If
|
|
||||||
' Devo verificare che sia una lavorazione solo di lama?
|
|
||||||
Dim nIdSaw As Integer = EgtGetFirstNameInGroup(nIdPV, "Saw" & nIdMy.ToString)
|
|
||||||
' -------------------------------- FINE VERIFICHE --------------------------------
|
|
||||||
|
|
||||||
If Not EgtGetGroupObjs(nIdSaw) Then
|
|
||||||
m_nIdSelectedSawRettangle = nIdSaw
|
|
||||||
m_nIdSelectedCurvRettangle = 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)
|
|
||||||
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
|
|
||||||
Else
|
|
||||||
m_nIdSelectedTextRettangle = nCurrId
|
|
||||||
m_sTextContent = GetMyRettangleText(sVal)
|
|
||||||
End If
|
|
||||||
ElseIf EgtGetType(nCurrId) = GDB_TY.SRF_FRGN Then
|
|
||||||
m_nIdSelectedFlatSurfRettangle = nCurrId
|
|
||||||
End If
|
|
||||||
nCurrId = EgtGetNext(nCurrId)
|
|
||||||
End While
|
|
||||||
End If
|
|
||||||
' seleziono ed evidenzio il lato selezionato
|
|
||||||
EgtSelectObj(nIdSaw)
|
|
||||||
EgtSetMark(nIdSaw)
|
|
||||||
EgtSelectObj(nIdMy)
|
|
||||||
EgtDraw()
|
|
||||||
Exit While
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
' se le'elemto corrente non è una linea
|
|
||||||
End If
|
|
||||||
' se le'elemto 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
|
|
||||||
' da DrawPageUC.xaml.vb/MultipleInsert
|
|
||||||
Dim sText As String = String.Empty
|
|
||||||
If sTextPz.Contains("<br/>") Then
|
|
||||||
Dim nLastIndex As Integer = sTextPz.LastIndexOf(">")
|
|
||||||
sText = sTextPz.Remove(nLastIndex + 1)
|
|
||||||
Return sText
|
|
||||||
End If
|
|
||||||
If sTextPz.Contains(" ") Then
|
|
||||||
Dim sInfo() As String = sTextPz.Split(" "c)
|
|
||||||
If sInfo.Count > 3 Then
|
|
||||||
Return sText = sInfo(0) & " " & sInfo(1) & " "
|
|
||||||
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
|
|
||||||
' 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 sVal As String = String.Empty
|
|
||||||
Dim dPrevAng As Double = 0
|
|
||||||
EgtGetInfo(IdSideRettangle, "PrevAng", sVal)
|
|
||||||
StringToDouble(sVal, dPrevAng)
|
|
||||||
Dim dNextAng As Double = 0
|
|
||||||
EgtGetInfo(IdSideRettangle, "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
|
|
||||||
nCounter += 1
|
|
||||||
IdSideRettangle = EgtGetNext(IdSideRettangle)
|
|
||||||
End While
|
|
||||||
' verifico che siano solo quattro lati
|
|
||||||
If IdSideRettangle = GDB_ID.NULL And nCounter = 4 Then
|
|
||||||
' solo se la figura ha 4 lati ortogonali
|
|
||||||
Return True
|
|
||||||
End If
|
|
||||||
|
|
||||||
m_nIdSelectedOutLoopRettangle = 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
|
|
||||||
' determino la direzione del lato selezionato
|
|
||||||
Dim vtDirSelectedCurv As New Vector3d
|
|
||||||
EgtStartVector(m_nIdSelectedCurvRettangle, 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
|
|
||||||
' verifico se esiste un lato Precedente altrimenti recupero l'ultimo della lista
|
|
||||||
If Ind = 0 Then
|
|
||||||
Index = 3
|
|
||||||
Else
|
|
||||||
Index = Ind - 1
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
' recupero la dimensione del lato
|
|
||||||
EgtCurveLength(m_SideListRettangle(Index), MaxLen)
|
|
||||||
EgtCurveLength(m_nIdSelectedCurvRettangle, MinLen)
|
|
||||||
|
|
||||||
' verifico che il lato selezionato sia il maggiore
|
|
||||||
If MinLen > MaxLen Then Return Nothing
|
|
||||||
|
|
||||||
' determimo il versore dal lato appena calcolato
|
|
||||||
Dim vtDir As New Vector3d
|
|
||||||
|
|
||||||
EgtStartVector(m_SideListRettangle(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)
|
|
||||||
|
|
||||||
Dim vtPerp As New Vector3d(vtDir.x, vtDir.y, vtDir.z)
|
|
||||||
vtPerp.Rotate(Vector3d.Z_AX, 90)
|
|
||||||
|
|
||||||
' determino il Frame corrente
|
|
||||||
frFixed = New Frame3d(ptFixed, vtDir, vtPerp, Vector3d.Z_AX)
|
|
||||||
|
|
||||||
Return vtDir
|
|
||||||
|
|
||||||
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)
|
|
||||||
' 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
|
|
||||||
If m_bDragToStart Then
|
|
||||||
If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And
|
|
||||||
Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then
|
|
||||||
Return
|
|
||||||
End If
|
|
||||||
m_bDragToStart = False
|
|
||||||
End If
|
|
||||||
|
|
||||||
' riferiemento che deve rimanere fisso del rettangolo
|
|
||||||
Dim frFixed As Frame3d = Nothing
|
|
||||||
' lunghezza del lato da modificare
|
|
||||||
Dim MaxLen As Double = 0
|
|
||||||
Dim MinLen As Double = 0
|
|
||||||
' recupero info sul rettangolo selezionato
|
|
||||||
Dim vtDir As Vector3d = GetRettangleInfoScale(frFixed, MaxLen, MinLen)
|
|
||||||
If vtDir.Equals(Vector3d.NULL) Then
|
|
||||||
Return
|
|
||||||
End If
|
|
||||||
|
|
||||||
' Inizio esecuzione di drag
|
|
||||||
m_bDragging = True
|
|
||||||
|
|
||||||
' Ricavo il punto corrente in coordinate mondo
|
|
||||||
Dim ptCurr As Point3d
|
|
||||||
EgtUnProjectPoint(e.Location, ptCurr)
|
|
||||||
' Ricavo il vettore di movimento
|
|
||||||
Dim vtMove As Vector3d = ptCurr - m_ptPrev
|
|
||||||
' ricavo il valore efficace di allungamento (la proiezione)
|
|
||||||
Dim dProjection As Double = vtMove * vtDir
|
|
||||||
vtMove = vtDir * dProjection
|
|
||||||
' recupero il valore di scalatura
|
|
||||||
Dim dScalefactor = dProjection / MaxLen + 1
|
|
||||||
|
|
||||||
' 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)
|
|
||||||
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)
|
|
||||||
If m_nIdSelectedTextTopRettangle <> GDB_ID.NULL Then
|
|
||||||
EgtMove(m_nIdSelectedTextTopRettangle, vtMove * 0.5)
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
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) Then
|
|
||||||
EgtScale(m_nIdSelectedOutLoopRettangle, frFixed, 1 / dScalefactor, 1, 1, GDB_ID.ROOT)
|
|
||||||
EgtScale(m_nIdSelectedFlatSurfRettangle, frFixed, 1 / dScalefactor, 1, 1, GDB_ID.ROOT)
|
|
||||||
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)
|
|
||||||
If m_nIdSelectedTextTopRettangle <> GDB_ID.NULL Then
|
|
||||||
EgtMove(m_nIdSelectedTextTopRettangle, -vtMove * 0.5)
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
EgtDraw()
|
|
||||||
' Aggiorno il punto precedente
|
|
||||||
m_ptPrev = ptCurr
|
|
||||||
' Terminata esecuzione di drag
|
|
||||||
m_bDragging = False
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
' funzione chiamata da OnMyMouseUp: gestisce il reset di tutti gli indici in uso
|
|
||||||
Public Sub ResetDragRettangleParam()
|
|
||||||
' deseleziono l'elemento corrente
|
|
||||||
EgtDeselectObj(m_nIdSelectedSawRettangle)
|
|
||||||
EgtDeselectObj(m_nIdSelectedCurvRettangle)
|
|
||||||
EgtResetMark(m_nIdSelectedSawRettangle)
|
|
||||||
' 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_sTextContent = String.Empty
|
|
||||||
' disattivo il drag
|
|
||||||
m_bDrag = False
|
|
||||||
' aggiorno le lavorazioni
|
|
||||||
Dim nWarn As Integer = 0
|
|
||||||
ResetAllMachinings(nWarn)
|
|
||||||
EgtDraw()
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
#End Region ' Drag Rettangolo
|
|
||||||
|
|
||||||
#End Region ' METHODS
|
#End Region ' METHODS
|
||||||
|
|
||||||
Private m_bDragRettangle As Boolean
|
|
||||||
Public Property bDragRettangle As Boolean
|
|
||||||
Get
|
|
||||||
Return m_bDragRettangle
|
|
||||||
End Get
|
|
||||||
Set(value As Boolean)
|
|
||||||
m_bDragRettangle = value
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private m_DragRettangle_Visibility As Visibility = Visibility.Collapsed
|
|
||||||
Public ReadOnly Property DragRettangle_Visibility As Visibility
|
|
||||||
Get
|
|
||||||
Return m_DragRettangle_Visibility
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Public ReadOnly Property DragRettangle_Cl_Span As Integer
|
|
||||||
Get
|
|
||||||
If m_DragRettangle_Visibility = Visibility.Visible Then
|
|
||||||
Return 1
|
|
||||||
End If
|
|
||||||
Return 2
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
|
|
||||||
#Region "COMMANDS"
|
#Region "COMMANDS"
|
||||||
|
|
||||||
#Region "DrawCommand"
|
#Region "DrawCommand"
|
||||||
@@ -1504,17 +1169,6 @@ Public Class NestingTabVM
|
|||||||
#Region "EVENTS"
|
#Region "EVENTS"
|
||||||
|
|
||||||
Friend Sub OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs)
|
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)
|
|
||||||
' Dati per drag (abilito il Drag)
|
|
||||||
m_locPrev = e.Location
|
|
||||||
m_bDrag = EgtUnProjectPoint(e.Location, m_ptPrev) And m_nIdSelectedCurvRettangle <> GDB_ID.NULL
|
|
||||||
m_bDragToStart = m_bDrag
|
|
||||||
m_bVerify = m_bDrag AndAlso (Keyboard.Modifiers And ModifierKeys.Shift) > 0
|
|
||||||
m_vtTotMove = Vector3d.NULL()
|
|
||||||
Return
|
|
||||||
End If
|
|
||||||
' Per default no drag
|
' Per default no drag
|
||||||
m_bDrag = False
|
m_bDrag = False
|
||||||
' Verifico se selezionato indicativo di pezzo
|
' Verifico se selezionato indicativo di pezzo
|
||||||
@@ -1562,13 +1216,6 @@ Public Class NestingTabVM
|
|||||||
End If
|
End If
|
||||||
m_bDragToStart = False
|
m_bDragToStart = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' se devo muovere un lato del rettangolo
|
|
||||||
If m_bDragRettangle Then
|
|
||||||
OnMyMouseMoveSawRettangle(sender, e)
|
|
||||||
Return
|
|
||||||
End If
|
|
||||||
|
|
||||||
' Determino cosa muovere
|
' Determino cosa muovere
|
||||||
Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL)
|
Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL)
|
||||||
' Verifico se in tavola o in parcheggio
|
' Verifico se in tavola o in parcheggio
|
||||||
@@ -1657,11 +1304,6 @@ Public Class NestingTabVM
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Friend Sub OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
Friend Sub OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
||||||
If m_bDragRettangle Then
|
|
||||||
' deseleziono gli oggeti, resetto le variabili usate, aggiorno il disegno
|
|
||||||
ResetDragRettangleParam()
|
|
||||||
Return
|
|
||||||
End If
|
|
||||||
' Se eseguito drag
|
' Se eseguito drag
|
||||||
If Not m_bDragToStart Then
|
If Not m_bDragToStart Then
|
||||||
' Se movimento con sola verifica finale
|
' Se movimento con sola verifica finale
|
||||||
@@ -1695,11 +1337,11 @@ Public Class NestingTabVM
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
m_bFromParking = False
|
m_bFromParking = False
|
||||||
' altrimenti caso con verifica durante il movimento
|
' altrimenti caso con verifica durante il movimento
|
||||||
Else
|
Else
|
||||||
' Basta reset alla fine
|
' Basta reset alla fine
|
||||||
End If
|
End If
|
||||||
' Se selezione da eseguire
|
' Se selezione da eseguire
|
||||||
ElseIf m_nIdToSel <> GDB_ID.NULL Then
|
ElseIf m_nIdToSel <> GDB_ID.NULL Then
|
||||||
' Determino se pezzo in tavola o in parcheggio
|
' Determino se pezzo in tavola o in parcheggio
|
||||||
Dim bPartInTable As Boolean = (EgtGetParent(m_nIdToSel) = GetRawId())
|
Dim bPartInTable As Boolean = (EgtGetParent(m_nIdToSel) = GetRawId())
|
||||||
@@ -1716,7 +1358,7 @@ Public Class NestingTabVM
|
|||||||
VeinMatching.OnSelectPart(m_nIdToSel)
|
VeinMatching.OnSelectPart(m_nIdToSel)
|
||||||
' Set flag posizione selezionati
|
' Set flag posizione selezionati
|
||||||
m_nPartPos = If(bPartInTable, PART_POS.IN_TABLE, PART_POS.OUT_TABLE)
|
m_nPartPos = If(bPartInTable, PART_POS.IN_TABLE, PART_POS.OUT_TABLE)
|
||||||
' Se deselezione da eseguire
|
' Se deselezione da eseguire
|
||||||
ElseIf m_nIdToDesel <> GDB_ID.NULL Then
|
ElseIf m_nIdToDesel <> GDB_ID.NULL Then
|
||||||
EgtDeselectObj(m_nIdToDesel)
|
EgtDeselectObj(m_nIdToDesel)
|
||||||
' Eventuale aggiornamento VeinMatching
|
' Eventuale aggiornamento VeinMatching
|
||||||
|
|||||||
Reference in New Issue
Block a user