Files
egtbeamwall/EgtBEAMWALL.Core/BTLModel/BTLPartM.vb
T
Demetrio Cassarino a12ab8f531 -pulizia codice
2024-06-13 17:36:10 +02:00

1094 lines
35 KiB
VB.net

Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib5
Public Class BTLPartM
' Id geometrico del pezzo
Public m_nPartId As Integer
Public ReadOnly Property nPartId As Integer
Get
Return m_nPartId
End Get
End Property
Public WriteOnly Property SetPartId As Integer
Set(value As Integer)
m_nPartId = value
End Set
End Property
' Info del pezzo
Public m_nPDN As Integer
Public Property nPDN As Integer
Get
Return m_nPDN
End Get
Set(value As Integer)
m_nPDN = value
End Set
End Property
Public m_bDO As Boolean
Public Overridable Property bDO As Boolean
Get
Return m_bDO
End Get
Set(value As Boolean)
m_bDO = value
End Set
End Property
Public m_sNAM As String
Public Overridable Property sNAM As String
Get
Return m_sNAM
End Get
Set(value As String)
m_sNAM = value
End Set
End Property
Public m_dBtlL As Double
Public Property dBtlL As Double
Get
Return m_dBtlL
End Get
Set(value As Double)
m_dBtlL = value
End Set
End Property
Public m_dBtlW As Double
Public Property dBtlW As Double
Get
Return m_dBtlW
End Get
Set(value As Double)
m_dBtlW = value
End Set
End Property
Public m_dBtlH As Double
Public Property dBtlH As Double
Get
Return m_dBtlH
End Get
Set(value As Double)
m_dBtlH = value
End Set
End Property
#Region "Parametri pezzo"
Public m_nSINGLEMEMBERNUM As Integer
Public Property nSINGLEMEMBERNUM As Integer
Get
Return m_nSINGLEMEMBERNUM
End Get
Set(value As Integer)
m_nSINGLEMEMBERNUM = value
End Set
End Property
Public m_sASSEMBLYNUM As String
Public Property sASSEMBLYNUM As String
Get
Return m_sASSEMBLYNUM
End Get
Set(value As String)
m_sASSEMBLYNUM = value
End Set
End Property
Public m_nORDERNUM As Integer
Public Property nORDERNUM As Integer
Get
Return m_nORDERNUM
End Get
Set(value As Integer)
m_nORDERNUM = value
End Set
End Property
Public m_sDESIGN As String
Public Property sDESIGN As String
Get
Return m_sDESIGN
End Get
Set(value As String)
m_sDESIGN = value
End Set
End Property
Public m_sANNOT As String
Public Property sANNOT As String
Get
Return m_sANNOT
End Get
Set(value As String)
m_sANNOT = value
End Set
End Property
Public m_sSTOREY As String
Public Property sSTOREY As String
Get
Return m_sSTOREY
End Get
Set(value As String)
m_sSTOREY = value
End Set
End Property
Public m_sGROUP As String
Public Property sGROUP As String
Get
Return m_sGROUP
End Get
Set(value As String)
m_sGROUP = value
End Set
End Property
Public m_sPACKAGE As String
Public Property sPACKAGE As String
Get
Return m_sPACKAGE
End Get
Set(value As String)
m_sPACKAGE = value
End Set
End Property
Public m_sMATERIAL As String
Public Property sMATERIAL As String
Get
Return m_sMATERIAL
End Get
Set(value As String)
m_sMATERIAL = value
End Set
End Property
Public m_sTIMBERGRADE As String
Public Property sTIMBERGRADE As String
Get
Return m_sTIMBERGRADE
End Get
Set(value As String)
m_sTIMBERGRADE = value
End Set
End Property
Public m_sQUALITYGRADE As String
Public Property sQUALITYGRADE As String
Get
Return m_sQUALITYGRADE
End Get
Set(value As String)
m_sQUALITYGRADE = value
End Set
End Property
Public m_colCOLOR As Color3d
Public Property colCOLOR As Color3d
Get
Return m_colCOLOR
End Get
Set(value As Color3d)
m_colCOLOR = value
End Set
End Property
Public m_dPLANINGLEN As Double
Public Property dPLANINGLEN As Double
Get
Return m_dPLANINGLEN
End Get
Set(value As Double)
m_dPLANINGLEN = value
End Set
End Property
Public m_dSTARTOFFSET As Double
Public Property dSTARTOFFSET As Double
Get
Return m_dSTARTOFFSET
End Get
Set(value As Double)
m_dSTARTOFFSET = value
End Set
End Property
Public m_dENDOFFSET As Double
Public Property dENDOFFSET As Double
Get
Return m_dENDOFFSET
End Get
Set(value As Double)
m_dENDOFFSET = value
End Set
End Property
Public m_ocUID As New ObservableCollection(Of Integer)
Public ReadOnly Property ocUID As ObservableCollection(Of Integer)
Get
Return m_ocUID
End Get
End Property
Public m_SelUID As Integer
Public Property SelUID As Integer
Get
Return m_SelUID
End Get
Set(value As Integer)
m_SelUID = value
End Set
End Property
Public m_refTransfList As New List(Of Frame3d)
Public m_refTransf As Frame3d
Public Property refTransfList As List(Of Frame3d)
Get
Return m_refTransfList
End Get
Set(value As List(Of Frame3d))
m_refTransfList = value
End Set
End Property
Public Property refTransf As Frame3d
Get
Return m_refTransf
End Get
Set(value As Frame3d)
m_refTransf = value
End Set
End Property
Public m_ocCAMBERSIDE As New ObservableCollection(Of Integer)({1, 2, 3, 4})
Public ReadOnly Property ocCAMBERSIDE As ObservableCollection(Of Integer)
Get
Return m_ocCAMBERSIDE
End Get
End Property
Public m_SelCAMBERSIDE As Integer
Public Property SelCAMBERSIDE As Integer
Get
Return m_SelCAMBERSIDE
End Get
Set(value As Integer)
m_SelCAMBERSIDE = value
End Set
End Property
Public m_dCamberLen1 As Double
Public m_dCamberLen2 As Double
Public m_dCamberLen3 As Double
Public m_dCamberCross3 As Double
Public m_ocREFSIDEFIXCLAMP As New ObservableCollection(Of Object)({New IdNameStruct(PartOffset_RefSideFixClamp.INACTIVE, EgtMsg(61665)),
New IdNameStruct(PartOffset_RefSideFixClamp.REFSIDE1, EgtMsg(61687)),
New IdNameStruct(PartOffset_RefSideFixClamp.REFSIDE2, EgtMsg(61688)),
New IdNameStruct(PartOffset_RefSideFixClamp.REFSIDE3, EgtMsg(61689)),
New IdNameStruct(PartOffset_RefSideFixClamp.REFSIDE4, EgtMsg(61690))})
Public ReadOnly Property ocREFSIDEFIXCLAMP As ObservableCollection(Of Object)
Get
Return m_ocREFSIDEFIXCLAMP
End Get
End Property
Public m_SelREFSIDEFIXCLAMP As Integer
Public Property SelREFSIDEFIXCLAMP As Integer
Get
Return m_SelREFSIDEFIXCLAMP
End Get
Set(value As Integer)
m_SelREFSIDEFIXCLAMP = value
End Set
End Property
Public m_dPartOffsetSide1 As Double
Public m_dPartOffsetSide2 As Double
Public m_dPartOffsetSide3 As Double
Public m_dPartOffsetSide4 As Double
Public m_ocPROCESSINGQUALITY As New ObservableCollection(Of Object)({New IdNameStruct(ProcessingQuality.AUTOMATIC, EgtMsg(61658)),
New IdNameStruct(ProcessingQuality.VISIBLE, EgtMsg(61659)),
New IdNameStruct(ProcessingQuality.FAST, EgtMsg(61660))})
Public ReadOnly Property ocPROCESSINGQUALITY As ObservableCollection(Of Object)
Get
Return m_ocPROCESSINGQUALITY
End Get
End Property
Public m_SelPROCESSINGQUALITY As Integer
Public Property SelPROCESSINGQUALITY As Integer
Get
Return m_SelPROCESSINGQUALITY
End Get
Set(value As Integer)
m_SelPROCESSINGQUALITY = value
End Set
End Property
Public m_ocRECESS As New ObservableCollection(Of Object)({New IdNameStruct(Recess.AUTOMATIC, EgtMsg(61658)),
New IdNameStruct(Recess.MANUAL, EgtMsg(61661))})
Public ReadOnly Property ocRECESS As ObservableCollection(Of Object)
Get
Return m_ocRECESS
End Get
End Property
Public m_SelRECESS As Integer
Public Property SelRECESS As Integer
Get
Return m_SelRECESS
End Get
Set(value As Integer)
m_SelRECESS = value
End Set
End Property
Public m_ocSTOREYTYPE As New ObservableCollection(Of Object)({New IdNameStruct(StoreyType.CEILING, EgtMsg(61662)),
New IdNameStruct(StoreyType.ROOF, EgtMsg(61663)),
New IdNameStruct(StoreyType.WALL, EgtMsg(61664))})
Public ReadOnly Property ocSTOREYTYPE As ObservableCollection(Of Object)
Get
Return m_ocSTOREYTYPE
End Get
End Property
Public m_SelSTOREYTYPE As Integer
Public Property SelSTOREYTYPE As Integer
Get
Return m_SelSTOREYTYPE
End Get
Set(value As Integer)
m_SelSTOREYTYPE = value
End Set
End Property
Public m_sELEMENTNUM As String
Public Property sELEMENTNUM As String
Get
Return m_sELEMENTNUM
End Get
Set(value As String)
m_sELEMENTNUM = value
End Set
End Property
Public m_nLAYER As Integer
Public Property nLAYER As Integer
Get
Return m_nLAYER
End Get
Set(value As Integer)
m_nLAYER = value
End Set
End Property
Public m_sMODULENUM As String
Public Property sMODULENUM As String
Get
Return m_sMODULENUM
End Get
Set(value As String)
m_sMODULENUM = value
End Set
End Property
Public m_sCOMMENT As String
Public Property sCOMMENT As String
Get
Return m_sCOMMENT
End Get
Set(value As String)
m_sCOMMENT = value
End Set
End Property
Public m_refGrainDir As Vector3d
Public Property refGrainDir As Vector3d
Get
Return m_refGrainDir
End Get
Set(value As Vector3d)
m_refGrainDir = value
End Set
End Property
Public m_bGRAINDIRALIGN As Boolean
Public Property bGRAINDIRALIGN As Boolean
Get
Return m_bGRAINDIRALIGN
End Get
Set(value As Boolean)
m_bGRAINDIRALIGN = value
End Set
End Property
Public m_ocREFSIDE As New ObservableCollection(Of Integer)({1, 2, 3, 4})
Public ReadOnly Property ocREFSIDE As ObservableCollection(Of Integer)
Get
Return m_ocREFSIDE
End Get
End Property
Public m_SelREFSIDE As Integer
Public Property SelREFSIDE As Integer
Get
Return m_SelREFSIDE
End Get
Set(value As Integer)
m_SelREFSIDE = value
End Set
End Property
Public m_bREFSIDEALIGN As Boolean
Public Property bREFSIDEALIGN As Boolean
Get
Return m_bREFSIDEALIGN
End Get
Set(value As Boolean)
m_bREFSIDEALIGN = value
End Set
End Property
Public m_ocALIGNLOCATION As New ObservableCollection(Of Object)({New IdNameStruct(AlignmentLocation.INACTIV, EgtMsg(61665)),
New IdNameStruct(AlignmentLocation.BR, EgtMsg(61666)),
New IdNameStruct(AlignmentLocation.TR, EgtMsg(61667)),
New IdNameStruct(AlignmentLocation.BA, EgtMsg(61668)),
New IdNameStruct(AlignmentLocation.TA, EgtMsg(61669)),
New IdNameStruct(AlignmentLocation.HC, EgtMsg(61670)),
New IdNameStruct(AlignmentLocation.VC, EgtMsg(61671)),
New IdNameStruct(AlignmentLocation.AC, EgtMsg(61672))})
Public ReadOnly Property ocALIGNLOCATION As ObservableCollection(Of Object)
Get
Return m_ocALIGNLOCATION
End Get
End Property
Public m_SelALIGNLOCATION As Integer
Public Property SelALIGNLOCATION As Integer
Get
Return m_SelALIGNLOCATION
End Get
Set(value As Integer)
m_SelALIGNLOCATION = value
End Set
End Property
Public m_ocALIGNENDTYPE As New ObservableCollection(Of Object)({New IdNameStruct(AlignmentEndtype.R, EgtMsg(61673)),
New IdNameStruct(AlignmentEndtype.A, EgtMsg(61674)),
New IdNameStruct(AlignmentEndtype.D, EgtMsg(61675))})
Public ReadOnly Property ocALIGNENDTYPE As ObservableCollection(Of Object)
Get
Return m_ocALIGNENDTYPE
End Get
End Property
Public m_SelALIGNENDTYPE As Integer
Public Property SelALIGNENDTYPE As Integer
Get
Return m_SelALIGNENDTYPE
End Get
Set(value As Integer)
m_SelALIGNENDTYPE = value
End Set
End Property
Public m_ocMATERIALTYPEGRP As New ObservableCollection(Of Object)({New IdNameStruct(MaterialType.INACTIV, EgtMsg(61665)),
New IdNameStruct(MaterialType.BA, EgtMsg(61676)),
New IdNameStruct(MaterialType.CL, EgtMsg(61677)),
New IdNameStruct(MaterialType.MT, EgtMsg(61678)),
New IdNameStruct(MaterialType.ME_, EgtMsg(61679)),
New IdNameStruct(MaterialType.GB, EgtMsg(61680)),
New IdNameStruct(MaterialType.GF, EgtMsg(61681)),
New IdNameStruct(MaterialType.IN_, EgtMsg(61682)),
New IdNameStruct(MaterialType.SH, EgtMsg(61683)),
New IdNameStruct(MaterialType.FB, EgtMsg(61684)),
New IdNameStruct(MaterialType.PB, EgtMsg(61685)),
New IdNameStruct(MaterialType.PL, EgtMsg(61686))})
Public ReadOnly Property ocMATERIALTYPEGRP As ObservableCollection(Of Object)
Get
Return m_ocMATERIALTYPEGRP
End Get
End Property
Public m_SelMATERIALTYPEGRP As Integer
Public Property SelMATERIALTYPEGRP As Integer
Get
Return m_SelMATERIALTYPEGRP
End Get
Set(value As Integer)
m_SelMATERIALTYPEGRP = value
End Set
End Property
Public m_sMATERIALTYPESPEC As String
Public Property sMATERIALTYPESPEC As String
Get
Return m_sMATERIALTYPESPEC
End Get
Set(value As String)
m_sMATERIALTYPESPEC = value
End Set
End Property
#End Region ' Parametri pezzo
' volume del pezzo
Private m_dVolume As Double
Public Property dVolume As Double
Get
Return m_dVolume
End Get
Set(value As Double)
m_dVolume = value
End Set
End Property
' numero di pezzi da fare da BTL
Public m_nCNT As Integer
Public Property nCNT As Integer
Get
Return m_nCNT
End Get
Set(value As Integer)
m_nCNT = value
End Set
End Property
' numero di pezzi aggiunti (da fare in piu' rispetto a CNT)
Public m_nADDED As Integer
Public Property nADDED As Integer
Get
Return m_nADDED
End Get
Set(value As Integer)
If EgtSetInfo(nPartId, BTL_PRT_ADDED, value) Then
m_nADDED = value
End If
End Set
End Property
' numero di pezzi inseriti nelle barre (in PROD), quindi numero di duplo del pezzo
Public ReadOnly Property nINPROD As Integer
Get
Dim INPROD As Integer = 0
EgtDuploInRawCount(m_nPartId, INPROD)
Return INPROD
End Get
End Property
' numero di pezzi gia' prodotti
Public m_nDONE As Integer
Public Property nDONE As Integer
Get
Return m_nDONE
End Get
Set(value As Integer)
m_nDONE = value
End Set
End Property
Private m_nINVERTED As Integer
Public Property nINVERTED As Integer
Get
Return m_nINVERTED
End Get
Set(value As Integer)
m_nINVERTED = value
End Set
End Property
Private m_bLockInversion As Boolean = False
Public Property bLockInversion As Boolean
Get
Return m_bLockInversion
End Get
Set(value As Boolean)
m_bLockInversion = value
End Set
End Property
Private m_nROTATED As Integer
Public Property nROTATED As Integer
Get
Return m_nROTATED
End Get
Set(value As Integer)
m_nROTATED = value
End Set
End Property
Private m_bLockRotation As Boolean = False
Public Property bLockRotation As Boolean
Get
Return m_bLockRotation
End Get
Set(value As Boolean)
m_bLockRotation = value
End Set
End Property
Private m_nCALC_ERR As Integer
Public Property nCALC_ERR As Integer
Get
Return m_nCALC_ERR
End Get
Set(value As Integer)
m_nCALC_ERR = value
End Set
End Property
Private m_nCALC_FALL As Integer
Public Property nCALC_FALL As Integer
Get
Return m_nCALC_FALL
End Get
Set(value As Integer)
m_nCALC_FALL = value
End Set
End Property
Private m_sCALC_MSG As String
Public Property sCALC_MSG As String
Get
Return MessageFromLuaMsg(m_sCALC_MSG)
End Get
Set(value As String)
m_sCALC_MSG = value
End Set
End Property
Public m_nCALC_ROT As Integer
Public Property nCALC_ROT As Integer
Get
Return m_nCALC_ROT
End Get
Set(value As Integer)
m_nCALC_ROT = value
End Set
End Property
Public m_nCALC_TIME As Integer
Public Property nCALC_TIME As Integer
Get
Return m_nCALC_TIME
End Get
Set(value As Integer)
m_nCALC_TIME = value
End Set
End Property
Public m_nGlobalState As CalcStates = -1
Public Property nGlobalState As CalcStates
Get
Return m_nGlobalState
End Get
Set(value As CalcStates)
m_nGlobalState = value
End Set
End Property
Private m_nFeaturesGlobalState As CalcStates
Public Property nFeaturesGlobalState As CalcStates
Get
Return m_nFeaturesGlobalState
End Get
Set(value As CalcStates)
m_nFeaturesGlobalState = value
End Set
End Property
Private m_nCALC_GlobalERR As Integer
Public Property nCALC_GlobalERR As Integer
Get
Return m_nCALC_GlobalERR
End Get
Set(value As Integer)
m_nCALC_GlobalERR = value
End Set
End Property
Public m_nState As CalcStates = -1
Public Property nState As CalcStates
Get
Return m_nState
End Get
Set(value As CalcStates)
m_nState = value
End Set
End Property
' lista delle feature del pezzo
Public m_BTLFeatureMList As List(Of BTLFeatureM)
Public Property BTLFeatureMList As List(Of BTLFeatureM)
Get
Return m_BTLFeatureMList
End Get
Set(value As List(Of BTLFeatureM))
m_BTLFeatureMList = value
End Set
End Property
#Region "CONSTRUCTOR"
Protected Sub New()
End Sub
Public Shared Function CreateNewBTLPart() As BTLPartM
Return New BTLPartM
End Function
Public Shared Function CreateBTLPart(nPartId As Integer) As BTLPartM
Dim NewBTLPart As New BTLPartM
NewBTLPart.m_nPartId = nPartId
' leggo info pezzo
Dim sValArray() As String
Dim sValue As String = String.Empty
Dim nValue As Integer = 0
EgtGetInfo(nPartId, BTL_PRT_PDN, NewBTLPart.m_nPDN)
Dim nDO As Integer = 1
If EgtGetInfo(nPartId, BTL_PRT_DO, nDO) Then
NewBTLPart.m_bDO = (nDO <> 0)
Else
NewBTLPart.m_bDO = True
End If
EgtGetInfo(nPartId, BTL_PRT_NAM, NewBTLPart.m_sNAM)
EgtGetInfo(nPartId, BTL_PRT_L, NewBTLPart.m_dBtlL)
EgtGetInfo(nPartId, BTL_PRT_W, NewBTLPart.m_dBtlW)
EgtGetInfo(nPartId, BTL_PRT_H, NewBTLPart.m_dBtlH)
EgtGetInfo(nPartId, BTL_PRT_CNT, NewBTLPart.m_nCNT)
EgtGetInfo(nPartId, BTL_PRT_ADDED, NewBTLPart.m_nADDED)
EgtGetInfo(nPartId, BTL_PRT_ASSEMBLYNUM, NewBTLPart.m_sASSEMBLYNUM)
EgtGetInfo(nPartId, BTL_PRT_ORDERNUM, NewBTLPart.m_nORDERNUM)
EgtGetInfo(nPartId, BTL_PRT_DESIGNATION, NewBTLPart.m_sDESIGN)
EgtGetInfo(nPartId, BTL_PRT_ANNOTATION, NewBTLPart.m_sANNOT)
EgtGetInfo(nPartId, BTL_PRT_STOREY, NewBTLPart.m_sSTOREY)
EgtGetInfo(nPartId, BTL_PRT_GROUP, NewBTLPart.m_sGROUP)
EgtGetInfo(nPartId, BTL_PRT_PACKAGE, NewBTLPart.m_sPACKAGE)
EgtGetInfo(nPartId, BTL_PRT_TIMBERGRADE, NewBTLPart.m_sTIMBERGRADE)
EgtGetInfo(nPartId, BTL_PRT_QUALITYGRADE, NewBTLPart.m_sQUALITYGRADE)
EgtGetInfo(nPartId, BTL_PRT_COLOUR, sValue)
NewBTLPart.m_colCOLOR.FromString(sValue)
EgtGetInfo(nPartId, BTL_PRT_PLANINGLENGTH, NewBTLPart.m_dPLANINGLEN)
EgtGetInfo(nPartId, BTL_PRT_STARTOFFSET, NewBTLPart.m_dSTARTOFFSET)
EgtGetInfo(nPartId, BTL_PRT_ENDOFFSET, NewBTLPart.m_dENDOFFSET)
Dim ind As Integer = 1
While EgtGetInfo(nPartId, BTL_PRT_UID & ind, nValue)
NewBTLPart.ocUID.Add(nValue)
EgtGetInfo(nPartId, BTL_PRT_TRANSFORMATION & ind, sValue)
NewBTLPart.m_refTransf = New Frame3d
Dim ptOri As New Point3d
Dim vtVersX As New Vector3d
Dim vtVersY As New Vector3d
sValArray = sValue.Split({","}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 9 Then
StringToLenAdv(sValArray(0), ptOri.x)
StringToLenAdv(sValArray(1), ptOri.y)
StringToLenAdv(sValArray(2), ptOri.z)
StringToDoubleAdv(sValArray(3), vtVersX.x)
StringToDoubleAdv(sValArray(4), vtVersX.y)
StringToDoubleAdv(sValArray(5), vtVersX.z)
StringToDoubleAdv(sValArray(6), vtVersY.x)
StringToDoubleAdv(sValArray(7), vtVersY.y)
StringToDoubleAdv(sValArray(8), vtVersY.z)
NewBTLPart.m_refTransf.ChangeOrigin(ptOri)
NewBTLPart.m_refTransf.Setup(ptOri, ptOri + vtVersX, ptOri + vtVersY)
End If
NewBTLPart.refTransfList.Add(NewBTLPart.m_refTransf)
ind = ind + 1
End While
EgtGetInfo(nPartId, BTL_PRT_CAMBER, sValue)
sValArray = sValue.Split(New String() {":", "P"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 10 Then
StringToLenAdv(sValArray(3), NewBTLPart.m_dCamberLen1)
StringToLenAdv(sValArray(5), NewBTLPart.m_dCamberLen2)
StringToLenAdv(sValArray(7), NewBTLPart.m_dCamberLen3)
StringToLenAdv(sValArray(9), NewBTLPart.m_dCamberCross3)
End If
Dim pFrom As Integer = sValue.IndexOf("SIDE: ") + "SIDE: ".Length
Dim pTo As Integer = sValue.LastIndexOf(" P01")
If pTo >= 0 Then
nValue = CInt(sValue.Substring(pFrom, pTo - pFrom))
NewBTLPart.m_SelCAMBERSIDE = NewBTLPart.ocCAMBERSIDE.IndexOf(CInt(sValue.Substring(pFrom, pTo - pFrom)))
End If
EgtGetInfo(nPartId, BTL_PRT_PARTOFFSET, sValue)
sValArray = sValue.Split(New String() {":", "P"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 10 Then
StringToLenAdv(sValArray(3), NewBTLPart.m_dPartOffsetSide1)
StringToLenAdv(sValArray(5), NewBTLPart.m_dPartOffsetSide2)
StringToLenAdv(sValArray(7), NewBTLPart.m_dPartOffsetSide3)
StringToLenAdv(sValArray(9), NewBTLPart.m_dPartOffsetSide4)
End If
pFrom = sValue.IndexOf("P04: ") + "P04: ".Length
pTo = sValue.LastIndexOf(" P11")
If pTo >= 0 Then
NewBTLPart.m_SelREFSIDEFIXCLAMP = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue.Substring(pFrom, pTo - pFrom),
NewBTLPart.ocREFSIDEFIXCLAMP),
NewBTLPart.ocREFSIDEFIXCLAMP)
End If
Dim EnumIndex As Integer = 0
EgtGetInfo(nPartId, BTL_PRT_PROCESSINGQUALITY, sValue)
For ind = 1 To NewBTLPart.ocPROCESSINGQUALITY.Count
Dim sEnumName = [Enum].GetName(GetType(ProcessingQuality), ind)
If sEnumName.Equals(sValue) Then
EnumIndex = ind
Exit For
End If
Next
NewBTLPart.m_SelPROCESSINGQUALITY = EnumIndex - 1
EgtGetInfo(nPartId, BTL_PRT_RECESS, sValue)
EnumIndex = 0
For ind = 1 To NewBTLPart.ocRECESS.Count
Dim sEnumName = [Enum].GetName(GetType(Recess), ind)
If sEnumName.Equals(sValue) Then
EnumIndex = ind
Exit For
End If
Next
NewBTLPart.m_SelRECESS = EnumIndex - 1
EgtGetInfo(nPartId, BTL_PRT_STOREYTYPE, sValue)
EnumIndex = 0
For ind = 1 To NewBTLPart.ocSTOREYTYPE.Count
Dim sEnumName = [Enum].GetName(GetType(StoreyType), ind)
If sEnumName.Equals(sValue) Then
EnumIndex = ind
Exit For
End If
Next
NewBTLPart.m_SelSTOREYTYPE = EnumIndex - 1
EgtGetInfo(nPartId, BTL_PRT_ELEMENTNUM, NewBTLPart.m_sELEMENTNUM)
EgtGetInfo(nPartId, BTL_PRT_LAYER, NewBTLPart.m_nLAYER)
EgtGetInfo(nPartId, BTL_PRT_MODULENUM, NewBTLPart.m_sMODULENUM)
EgtGetInfo(nPartId, BTL_PRT_COMMENT, NewBTLPart.m_sCOMMENT)
EgtGetInfo(nPartId, BTL_PRT_GRAINDIR, sValue)
NewBTLPart.m_refGrainDir = New Vector3d
sValArray = sValue.Split(New String() {",", ";"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 4 Then
StringToDoubleAdv(sValArray(0), NewBTLPart.m_refGrainDir.x)
StringToDoubleAdv(sValArray(1), NewBTLPart.m_refGrainDir.y)
StringToDoubleAdv(sValArray(2), NewBTLPart.m_refGrainDir.z)
NewBTLPart.m_bGRAINDIRALIGN = (CInt(sValArray(3)) = 1)
End If
EgtGetInfo(nPartId, BTL_PRT_REFSIDE, sValue)
sValArray = sValue.Split({";"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 2 Then
NewBTLPart.m_SelREFSIDE = NewBTLPart.ocREFSIDE.IndexOf(CInt(sValArray(0)))
NewBTLPart.m_bREFSIDEALIGN = (CInt(sValArray(1)) = 1)
End If
EgtGetInfo(nPartId, BTL_PRT_ALIGNMENT, sValue)
sValArray = sValue.Split({":"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 2 Then
NewBTLPart.m_SelALIGNLOCATION = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(0), NewBTLPart.ocALIGNLOCATION),
NewBTLPart.ocALIGNLOCATION)
NewBTLPart.m_SelALIGNENDTYPE = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(1).Trim(),
NewBTLPart.ocALIGNENDTYPE),
NewBTLPart.ocALIGNENDTYPE)
End If
EgtGetInfo(nPartId, BTL_PRT_MATERIALTYPE, sValue)
sValArray = sValue.Split({":"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 1 Then
NewBTLPart.m_SelMATERIALTYPEGRP = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(0),
NewBTLPart.ocMATERIALTYPEGRP),
NewBTLPart.ocMATERIALTYPEGRP)
If sValArray.Count() >= 2 Then NewBTLPart.m_sMATERIALTYPESPEC = sValArray(1).Trim()
End If
If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, NewBTLPart.m_nROTATED) Then
NewBTLPart.m_nROTATED = 0
End If
If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, NewBTLPart.m_nINVERTED) Then
NewBTLPart.m_nINVERTED = 0
End If
EgtGetInfo(nPartId, BTL_PRT_MATERIAL, NewBTLPart.m_sMATERIAL)
If Not EgtGetInfo(nPartId, LOCK_ROT, NewBTLPart.m_bLockRotation) Then
NewBTLPart.m_bLockRotation = False
End If
If Not EgtGetInfo(nPartId, LOCK_FLIP, NewBTLPart.m_bLockInversion) Then
NewBTLPart.m_bLockInversion = False
End If
EgtGetInfo(nPartId, BTL_PRT_VOLUME, NewBTLPart.m_dVolume)
' Leggo outline e features
NewBTLPart.m_BTLFeatureMList = LoadFeatures(nPartId, NewBTLPart)
' leggo calc error
Dim nErr As Integer = 0
Dim nRot As Integer = 0
Dim nFall As Integer = 0
Dim sMsg As String = ""
Dim bCalc As Boolean = False
bCalc = EgtGetInfo(nPartId, ITG_PROJ_ERR, nErr)
EgtGetInfo(nPartId, ITG_PROJ_ROT, nRot)
EgtGetInfo(nPartId, ITG_PROJ_FALL, nFall)
EgtGetInfo(nPartId, ITG_PROJ_MSG, sMsg)
If Not bCalc Then
NewBTLPart.m_nState = CalcStates.NOTCALCULATED
NewBTLPart.m_nCALC_ERR = 0
NewBTLPart.m_nCALC_ROT = 0
NewBTLPart.m_nCALC_FALL = 0
NewBTLPart.m_sCALC_MSG = ""
Else
NewBTLPart.m_nCALC_ERR = nErr
NewBTLPart.m_nCALC_ROT = nRot
NewBTLPart.m_nCALC_FALL = nFall
NewBTLPart.m_sCALC_MSG = sMsg
Select Case nErr
Case 0
NewBTLPart.nState = CalcStates.OK
Case 22
NewBTLPart.nState = CalcStates.COLLISION
Case 17, 19
NewBTLPart.nState = CalcStates.WARNING
Case < 0
NewBTLPart.nState = CalcStates.INFO
Case > 0
NewBTLPart.nState = CalcStates.ERROR_
End Select
End If
EgtGetInfo(nPartId, ITG_PROJ_TIME, NewBTLPart.m_nCALC_TIME)
Return NewBTLPart
End Function
Private Shared Function LoadFeatures(nPartId As Integer, NewBTLPart As BTLPartM) As List(Of BTLFeatureM)
Dim TempList As New List(Of BTLFeatureM)
' Leggo outline
Dim nOutlineLayerId As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayerId)
While nOutlineId <> GDB_ID.NULL
' verifico che sia una feature
Dim nGRP As Integer
If EgtGetInfo(nOutlineId, BTL_FTR_GRP, nGRP) Then
' creo la feature
TempList.Add(BTLFeatureM.CreateBTLFeature(NewBTLPart, nOutlineId))
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
' Leggo feature
Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
While nFeatureId <> GDB_ID.NULL
' verifico che sia una feature
Dim nGRP As Integer
If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) AndAlso Not EgtExistsInfo(nFeatureId, BTL_FTR_MAINID) Then
' creo la feature
Dim NewFeature As BTLFeatureM = BTLFeatureM.CreateBTLFeature(NewBTLPart, nFeatureId)
TempList.Add(NewFeature)
' aggiorno Id feature perchè potrebbe essere stata ricalcolata
nFeatureId = NewFeature.nFeatureId
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
Return TempList
End Function
#End Region ' CONSTRUCTOR
#Region "METHODS"
Public Event BTLFeatureAdded As EventHandler(Of BTLFeatureAddedEventArgs)
Public Sub AddBTLFeature(BTLFeatureM As BTLFeatureM)
If IsNothing(BTLFeatureM) Then Return
If Not m_BTLFeatureMList.Contains(BTLFeatureM) Then
m_BTLFeatureMList.Add(BTLFeatureM)
RaiseEvent BTLFeatureAdded(Me, New BTLFeatureAddedEventArgs(BTLFeatureM))
End If
End Sub
Public Function GetBTLFeatures() As List(Of BTLFeatureM)
Return New List(Of BTLFeatureM)(m_BTLFeatureMList)
End Function
Public Function Rotation(IsPositive As Boolean, SelectedMachineType As MachineType, Optional bRedraw As Boolean = True, Optional dAng As Double = 90) As Boolean
' recupero il box del pezzo
Dim nLs As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
Dim b3Solid As New BBox3d
EgtGetBBoxGlob(nLs, GDB_BB.STANDARD, b3Solid)
If b3Solid.IsEmpty() Then
EgtOutLog("ERROR: Box non definito per la trave " & sNAM)
Return False
End If
' eseguo rotazione di 90 gradi attorno asse X
Dim dRot = If(IsPositive, 1, -1) * Math.Abs(dAng)
Dim vtAxes As Vector3d
' se travi ruoto attorno all'asse X
If SelectedMachineType = MachineType.BEAM Then
vtAxes = Vector3d.X_AX
' se pareti ruoto attorno all'asse Z
ElseIf SelectedMachineType = MachineType.WALL Then
vtAxes = -Vector3d.Z_AX
End If
' se invertito
Dim bInverted As Boolean = m_nINVERTED <> 0
If bInverted Then
' annullo inversione
Inversion(SelectedMachineType)
End If
' eseguo rotazione
Dim bOk As Boolean = EgtRotate(nPartId, b3Solid.Center, vtAxes, dRot, GDB_RT.GLOB)
If bOk Then
Dim dNewRotation As Double = (m_nROTATED + dRot) Mod 360
m_nROTATED = If(dNewRotation >= 0, dNewRotation, 360 + dNewRotation)
EgtSetInfo(nPartId, BTL_PRT_ROTATED, m_nROTATED)
' imposto modificato per copie
MyMachGroupPanelM.SetDuploModified(nPartId)
End If
' se era invertito
If bInverted Then
' ripristino inversione
Inversion(SelectedMachineType)
End If
If bRedraw Then EgtDraw()
Return bOk
End Function
Public Sub Inversion(SelectedMachineType As MachineType)
' recupero il box del pezzo
Dim nLs As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
Dim b3Solid As New BBox3d
EgtGetBBoxGlob(nLs, GDB_BB.STANDARD, b3Solid)
If b3Solid.IsEmpty() Then
EgtOutLog("ERROR: Box non definito per la trave " & sNAM)
Return
End If
Dim vtAxes As Vector3d
' se travi ruoto attorno all'asse Z
If SelectedMachineType = MachineType.BEAM Then
vtAxes = Vector3d.Z_AX
' se pareti ruoto attorno all'asse X
ElseIf SelectedMachineType = MachineType.WALL Then
vtAxes = Vector3d.X_AX
End If
' eseguo rotazione di 180 gradi
If EgtRotate(nPartId, b3Solid.Center, vtAxes, 180, GDB_RT.GLOB) Then
m_nINVERTED = If(m_nINVERTED = 0, 180, 0)
EgtSetInfo(nPartId, BTL_PRT_INVERTED, m_nINVERTED)
' imposto modificato per copie
MyMachGroupPanelM.SetDuploModified(nPartId)
End If
End Sub
Public Function NewProcId() As Integer
Dim nMaxProcId As Integer = 0
If Not IsNothing(BTLFeatureMList) AndAlso BTLFeatureMList.Count > 0 Then
nMaxProcId = BTLFeatureMList.Max(Function(x) x.nPRID)
End If
Return nMaxProcId + 1
End Function
#End Region ' METHODS
End Class