EgtCAM5 :
- Modificata behaviour che apre e chiude gli expander automaticamente. - Modificato calcolo dell'altezza massima dei parametri operazione di lavorazione. - Migliorie varie.
This commit is contained in:
+74
-35
@@ -319,6 +319,7 @@ Namespace EgtCAM5
|
||||
Public Sub Done(ByVal param As Object)
|
||||
' Verifico la validità del punto in Input
|
||||
If Not String.IsNullOrEmpty(m_InputValue) Then
|
||||
' se movimento di traslazione
|
||||
If m_MoveIsChecked Then
|
||||
Dim InputPoint As New Point3d(0, 0, 0)
|
||||
Dim Values() As String = m_InputValue.Split(","c)
|
||||
@@ -334,42 +335,19 @@ Namespace EgtCAM5
|
||||
Dim vtMove As Vector3d
|
||||
' lo imposto a seconda del tipo del primo elemento selezionato
|
||||
Dim nFirstSelectedId As Integer = EgtGetFirstSelectedObj()
|
||||
' se è un grezzo
|
||||
If EgtVerifyRawPartCurrPhase(nFirstSelectedId) Then
|
||||
Dim bboxRawPart As New BBox3d
|
||||
' recupero il solido del grezzo dal primo elemento selezionato
|
||||
Dim nRawSolidId As Integer = EgtGetFirstNameInGroup(nFirstSelectedId, RAWSOLID)
|
||||
' ne calcolo il BBox
|
||||
EgtGetBBoxGlob(nRawSolidId, GDB_BB.STANDARD, bboxRawPart)
|
||||
' imposto il riferimento della tavola
|
||||
Dim ptTableRef As Point3d
|
||||
EgtGetTableRef(1, ptTableRef)
|
||||
' calcolo i punti min e max del bbox riferiti alla tavola
|
||||
Dim ptBBoxRawPartMin As New Point3d(bboxRawPart.Min)
|
||||
Dim ptBBoxRawPartMax As New Point3d(bboxRawPart.Max)
|
||||
ptBBoxRawPartMin.ToLoc(New Frame3d(ptTableRef))
|
||||
ptBBoxRawPartMax.ToLoc(New Frame3d(ptTableRef))
|
||||
' dal box e dal tipo di punto di riferimento selezionato ricavo le coordinate del punto di riferimento
|
||||
Dim ptRawRefPoint As Point3d
|
||||
Select Case m_RawRefPosition
|
||||
Case MCH_CR.TL
|
||||
ptRawRefPoint.x = ptBBoxRawPartMin.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMax.y
|
||||
Case MCH_CR.TR
|
||||
ptRawRefPoint.x = ptBBoxRawPartMax.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMax.y
|
||||
Case MCH_CR.BL
|
||||
ptRawRefPoint.x = ptBBoxRawPartMin.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMin.y
|
||||
Case MCH_CR.BR
|
||||
ptRawRefPoint.x = ptBBoxRawPartMax.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMin.y
|
||||
End Select
|
||||
ptRawRefPoint.z = ptBBoxRawPartMin.z
|
||||
' calcolo il punto del grezzo da posizionar nelle coordinate di input
|
||||
Dim ptRawRefPoint As Point3d = GetRawPartRefPoint(nFirstSelectedId, m_RawRefPosition)
|
||||
' creo un punto con le coordinate di input espresse rispetto alla tavola
|
||||
Dim TableRefInputPoint As New Point3d(InputPoint)
|
||||
TableRefInputPoint.LocToLoc(EgtGetGridFrame(), New Frame3d(ptTableRef))
|
||||
' calcolo il vettore di spostamento del grezzo
|
||||
vtMove = TableRefInputPoint - ptRawRefPoint
|
||||
' se è una ventosa
|
||||
ElseIf EgtVerifyFixture(nFirstSelectedId) Then
|
||||
Dim SelObjFrame3d As New Frame3d(Frame3d.GLOB)
|
||||
EgtGetGroupGlobFrame(nFirstSelectedId, SelObjFrame3d)
|
||||
@@ -381,11 +359,19 @@ Namespace EgtCAM5
|
||||
End If
|
||||
' Muovo tutti gli oggetti selezionati
|
||||
MoveRawPartPartAndFixture(GDB_ID.SEL, vtMove)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
' se è un grezzo
|
||||
If EgtVerifyRawPartCurrPhase(nFirstSelectedId) Then
|
||||
Dim ptRawRefPoint As Point3d = GetRawPartRefPoint(nFirstSelectedId, m_RawRefPosition)
|
||||
' verifico se lo spostamento effettuato differisce da quello richiesto
|
||||
Dim vtRemainingMove As Vector3d = InputPoint - ptRawRefPoint
|
||||
' se differisce
|
||||
If Not vtRemainingMove.IsSmall() Then
|
||||
' eseguo lo spostamento rimanente sull'asse x
|
||||
MoveRawPartPartAndFixture(GDB_ID.SEL, New Vector3d(vtRemainingMove.x, 0, 0))
|
||||
' eseguo lo spostamento rimanente sull'asse y
|
||||
MoveRawPartPartAndFixture(GDB_ID.SEL, New Vector3d(0, vtRemainingMove.y, 0))
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
@@ -494,6 +480,8 @@ Namespace EgtCAM5
|
||||
' End Select
|
||||
'nSelId = EgtGetNextSelectedObj()
|
||||
'End While
|
||||
|
||||
' se rotazione
|
||||
Else
|
||||
Dim InputAngle As Double = 0
|
||||
If Not StringToDouble(m_InputValue, InputAngle) Then
|
||||
@@ -524,6 +512,40 @@ Namespace EgtCAM5
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Shared Function GetRawPartRefPoint(nRawPartId As Integer, RawRefPosition As MCH_CR) As Point3d
|
||||
Dim bboxRawPart As New BBox3d
|
||||
' recupero il solido del grezzo dal primo elemento selezionato
|
||||
Dim nRawSolidId As Integer = EgtGetFirstNameInGroup(nRawPartId, RAWSOLID)
|
||||
' ne calcolo il BBox
|
||||
EgtGetBBoxGlob(nRawSolidId, GDB_BB.STANDARD, bboxRawPart)
|
||||
' imposto il riferimento della tavola
|
||||
Dim ptTableRef As Point3d
|
||||
EgtGetTableRef(1, ptTableRef)
|
||||
' calcolo i punti min e max del bbox riferiti alla tavola
|
||||
Dim ptBBoxRawPartMin As New Point3d(bboxRawPart.Min)
|
||||
Dim ptBBoxRawPartMax As New Point3d(bboxRawPart.Max)
|
||||
ptBBoxRawPartMin.ToLoc(New Frame3d(ptTableRef))
|
||||
ptBBoxRawPartMax.ToLoc(New Frame3d(ptTableRef))
|
||||
' dal box e dal tipo di punto di riferimento selezionato ricavo le coordinate del punto di riferimento
|
||||
Dim ptRawRefPoint As Point3d
|
||||
Select Case RawRefPosition
|
||||
Case MCH_CR.TL
|
||||
ptRawRefPoint.x = ptBBoxRawPartMin.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMax.y
|
||||
Case MCH_CR.TR
|
||||
ptRawRefPoint.x = ptBBoxRawPartMax.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMax.y
|
||||
Case MCH_CR.BL
|
||||
ptRawRefPoint.x = ptBBoxRawPartMin.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMin.y
|
||||
Case MCH_CR.BR
|
||||
ptRawRefPoint.x = ptBBoxRawPartMax.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMin.y
|
||||
End Select
|
||||
ptRawRefPoint.z = ptBBoxRawPartMin.z
|
||||
Return ptRawRefPoint
|
||||
End Function
|
||||
|
||||
Public Shared Function MoveRawPartPartAndFixture(nMoveId As Integer, vtMove As Vector3d, Optional nCount As Integer = 1) As Boolean
|
||||
Dim bErrorMoving As Boolean = False
|
||||
' Muovo gli oggetti selezionati se consentito
|
||||
@@ -772,11 +794,19 @@ Namespace EgtCAM5
|
||||
' calcolo il vettore di spostamento necessario ad allinearli
|
||||
Dim vtDelta As Vector3d = ptArcCenter - ptMin
|
||||
vtDelta.z = 0
|
||||
' se i punti non coincidono, esco
|
||||
If Not vtDelta.IsSmall() Then
|
||||
' se i punti coincidono, esco
|
||||
If vtDelta.IsSmall() Then
|
||||
' il grezzo è in battuta sul riferimento
|
||||
Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_CONTACTCOLDISK)
|
||||
EgtSetColor(nContactColDisk, ReferenceContactColGreen)
|
||||
Else
|
||||
' altrimenti riporto il vettore di correzione
|
||||
vtRefMove = -vtDelta.Glob(ccompoRawPartOutlineId)
|
||||
End If
|
||||
Else
|
||||
' il grezzo non è in battuta sul riferimento
|
||||
Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_CONTACTCOLDISK)
|
||||
EgtSetColor(nContactColDisk, ReferenceContactColRed)
|
||||
End If
|
||||
End Select
|
||||
End If
|
||||
@@ -881,7 +911,11 @@ Namespace EgtCAM5
|
||||
Dim vtDelta As Vector3d = -(ptDist - ptArcCenter)
|
||||
vtDelta.z = 0
|
||||
' se il vettore non è nullo
|
||||
If Not vtDelta.IsSmall() Then
|
||||
If vtDelta.IsSmall() Then
|
||||
' il grezzo è in battuta sul riferimento
|
||||
Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_CONTACTCOLDISK)
|
||||
EgtSetColor(nContactColDisk, ReferenceContactColGreen)
|
||||
Else
|
||||
vtDelta = vtDelta.Glob(ccompoRawPartOutlineId)
|
||||
' il vettore da restituire è nullo, quindi lo inizializzo
|
||||
If vtRefMove.IsSmall() Then
|
||||
@@ -902,6 +936,11 @@ Namespace EgtCAM5
|
||||
EgtErase(nDistLine)
|
||||
EgtErase(ccompoRawPartOutlineOffsetId)
|
||||
End Select
|
||||
' se non c'è sovrapposizione
|
||||
ElseIf FixtureType(nFixtureId) = FIX_TYPE.REFERENCE Then
|
||||
' il grezzo non è in battuta sul riferimento
|
||||
Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_CONTACTCOLDISK)
|
||||
EgtSetColor(nContactColDisk, ReferenceContactColRed)
|
||||
End If
|
||||
nFixtureId = EgtGetNextFixture(nFixtureId)
|
||||
End While
|
||||
|
||||
Reference in New Issue
Block a user