diff --git a/3dPrintApp/MachiningManager/CurrMachiningPanelVM.vb b/3dPrintApp/MachiningManager/CurrMachiningPanelVM.vb deleted file mode 100644 index 0e13c9d..0000000 --- a/3dPrintApp/MachiningManager/CurrMachiningPanelVM.vb +++ /dev/null @@ -1,89 +0,0 @@ -Imports EgtWPFLib5 - -Public Class CurrMachiningPanelVM - Inherits VMBase - -#Region "FIELDS & PROPERTIES" - - Private m_CurrMachining As CurrMachining - Public ReadOnly Property CurrMachining As CurrMachining - Get - Return m_CurrMachining - End Get - End Property - Friend Sub SetCurrMachining(CurrMachining As CurrMachining) - m_CurrMachining = CurrMachining - NotifyPropertyChanged(NameOf(CurrMachining)) - Map.refTopPanelVM.UpdateCurrMachining() - End Sub - - ' Definizione comandi - Private m_cmdOk As ICommand - Private m_cmdCancel As ICommand - -#End Region ' FIELDS & PROPERTIES - -#Region "CONSTRUCTORS" - - Sub New() - ' Creo riferimento a questa classe in Map - Map.SetRefCurrMachiningPanelVM(Me) - End Sub - -#End Region ' CONSTRUCTORS - - Friend Sub ReadMachParamFromSelPart() - If IsNothing(Map.refTopPanelVM.SelPart) Then Return - Dim nData As Integer = 0 - m_CurrMachining = New CurrMachining(Map.refTopPanelVM.SelPart.nPartId) - SetCurrMachining(m_CurrMachining) - ' aggiorno parametri mostrati nella barra - NotifyPropertyChanged(NameOf(CurrMachining)) - Map.refTopPanelVM.UpdateCurrMachining() - End Sub - - -#Region "COMMANDS" - -#Region "Ok" - - Public ReadOnly Property Ok_Command As ICommand - Get - If m_cmdOk Is Nothing Then - m_cmdOk = New Command(AddressOf Ok) - End If - Return m_cmdOk - End Get - End Property - - Public Sub Ok() - ' scrivo i parametri modificati - m_CurrMachining.WriteCurrParamInPart(Map.refTopPanelVM.SelPart.nPartId) - ' ripristino modalita' standard - Map.refTopPanelVM.SelPage = Pages.MODIFY - End Sub - -#End Region ' Ok - -#Region "Cancel" - - Public ReadOnly Property Cancel_Command As ICommand - Get - If m_cmdCancel Is Nothing Then - m_cmdCancel = New Command(AddressOf Cancel) - End If - Return m_cmdCancel - End Get - End Property - - Public Sub Cancel() - ' ripristino modalita' standard - Map.refTopPanelVM.SelPage = Pages.MODIFY - End Sub - -#End Region ' Cancel - -#End Region ' COMMANDS - -End Class - diff --git a/3dPrintApp/TSFEditor/TFSEditorV.xaml b/3dPrintApp/TSFEditor/TFSEditorV.xaml deleted file mode 100644 index 23ab95b..0000000 --- a/3dPrintApp/TSFEditor/TFSEditorV.xaml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - + @@ -178,12 +179,12 @@ Style="{StaticResource ToolBar_Button}"> - + --> @@ -292,5 +293,8 @@ + diff --git a/3dPrintApp/RibPanel/RibPanelV.xaml.vb b/Icarus/RibPanel/RibPanelV.xaml.vb similarity index 100% rename from 3dPrintApp/RibPanel/RibPanelV.xaml.vb rename to Icarus/RibPanel/RibPanelV.xaml.vb diff --git a/3dPrintApp/RibPanel/RibPanelVM.vb b/Icarus/RibPanel/RibPanelVM.vb similarity index 65% rename from 3dPrintApp/RibPanel/RibPanelVM.vb rename to Icarus/RibPanel/RibPanelVM.vb index 54bcecf..19c9de2 100644 --- a/3dPrintApp/RibPanel/RibPanelVM.vb +++ b/Icarus/RibPanel/RibPanelVM.vb @@ -14,6 +14,11 @@ Public Class RibPanelVM POINT = 1 COMPO = 2 End Enum + Public Enum RibSelectionTypes As Integer + CURVE = 1 + EXTRUSION = 2 + BOTH = 3 + End Enum Private m_nPartId As Integer = GDB_ID.NULL Private m_nRibLayerId As Integer = GDB_ID.NULL @@ -38,7 +43,10 @@ Public Class RibPanelVM m_SelRib = value EgtDeselectLayerObjs(m_nRibLayerId) If Not IsNothing(value) Then - EgtSelectObj(value.nId) + EgtSelectObj(value.nCurveId) + EgtSelectObj(value.nExtrusionId) + ' aggiorno visibilita' bottoni edit + NotifyPropertyChanged(NameOf(Compo_Visibility)) ' aggiorno campi di testo posizione NotifyPropertyChanged(NameOf(sXPos)) NotifyPropertyChanged(NameOf(sYPos)) @@ -51,20 +59,23 @@ Public Class RibPanelVM Public Property sXPos As String Get If Not IsNothing(m_SelRib) Then + Dim nId As Integer = If(m_SelRib.Type = RibEntity.RibTypes.FROMDRAW, m_SelRib.nCurveId, m_SelRib.nExtrusionId) Dim b3Reference As New BBox3d - EgtGetBBoxGlob(m_SelRib.nId, GDB_BB.STANDARD, b3Reference) + EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference) Return LenToString(b3Reference.Min.x, 1) Else Return "" End If End Get Set(value As String) + Dim nId As Integer = If(m_SelRib.Type = RibEntity.RibTypes.FROMDRAW, m_SelRib.nCurveId, m_SelRib.nExtrusionId) Dim b3Reference As New BBox3d - EgtGetBBoxGlob(m_SelRib.nId, GDB_BB.STANDARD, b3Reference) + EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference) Dim dNewXPos As Double = b3Reference.Min.x StringToLen(value, dNewXPos) If dNewXPos >= 0 AndAlso dNewXPos <= CurrentMachine.b3Tab.DimX Then - EgtMove(m_SelRib.nId, New Point3d(dNewXPos, b3Reference.Min.y, b3Reference.Min.z) - b3Reference.Min) + EgtMove(m_SelRib.nCurveId, New Point3d(dNewXPos, b3Reference.Min.y, b3Reference.Min.z) - b3Reference.Min) + EgtMove(m_SelRib.nExtrusionId, New Point3d(dNewXPos, b3Reference.Min.y, b3Reference.Min.z) - b3Reference.Min) EgtDraw() Else NotifyPropertyChanged(NameOf(sXPos)) @@ -75,20 +86,23 @@ Public Class RibPanelVM Public Property sYPos As String Get If Not IsNothing(m_SelRib) Then + Dim nId As Integer = If(m_SelRib.Type = RibEntity.RibTypes.FROMDRAW, m_SelRib.nCurveId, m_SelRib.nExtrusionId) Dim b3Reference As New BBox3d - EgtGetBBoxGlob(m_SelRib.nId, GDB_BB.STANDARD, b3Reference) + EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference) Return LenToString(b3Reference.Min.y, 1) Else Return "" End If End Get Set(value As String) + Dim nId As Integer = If(m_SelRib.Type = RibEntity.RibTypes.FROMDRAW, m_SelRib.nCurveId, m_SelRib.nExtrusionId) Dim b3Reference As New BBox3d - EgtGetBBoxGlob(m_SelRib.nId, GDB_BB.STANDARD, b3Reference) + EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference) Dim dNewYPos As Double = b3Reference.Min.y StringToLen(value, dNewYPos) If dNewYPos >= 0 AndAlso dNewYPos <= CurrentMachine.b3Tab.DimY Then - EgtMove(m_SelRib.nId, New Point3d(b3Reference.Min.x, dNewyPos, b3Reference.Min.z) - b3Reference.Min) + EgtMove(m_SelRib.nCurveId, New Point3d(b3Reference.Min.x, dNewYPos, b3Reference.Min.z) - b3Reference.Min) + EgtMove(m_SelRib.nExtrusionId, New Point3d(b3Reference.Min.x, dNewYPos, b3Reference.Min.z) - b3Reference.Min) EgtDraw() Else NotifyPropertyChanged(NameOf(sYPos)) @@ -99,20 +113,23 @@ Public Class RibPanelVM Public Property sZPos As String Get If Not IsNothing(m_SelRib) Then + Dim nId As Integer = If(m_SelRib.Type = RibEntity.RibTypes.FROMDRAW, m_SelRib.nCurveId, m_SelRib.nExtrusionId) Dim b3Reference As New BBox3d - EgtGetBBoxGlob(m_SelRib.nId, GDB_BB.STANDARD, b3Reference) + EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference) Return LenToString(b3Reference.Min.z, 1) Else Return "" End If End Get Set(value As String) + Dim nId As Integer = If(m_SelRib.Type = RibEntity.RibTypes.FROMDRAW, m_SelRib.nCurveId, m_SelRib.nExtrusionId) Dim b3Reference As New BBox3d - EgtGetBBoxGlob(m_SelRib.nId, GDB_BB.STANDARD, b3Reference) + EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference) Dim dNewZPos As Double = b3Reference.Min.y StringToLen(value, dNewZPos) If dNewZPos >= 0 Then - EgtMove(m_SelRib.nId, New Point3d(b3Reference.Min.x, b3Reference.Min.y, dNewZPos) - b3Reference.Min) + EgtMove(m_SelRib.nCurveId, New Point3d(b3Reference.Min.x, b3Reference.Min.y, dNewZPos) - b3Reference.Min) + EgtMove(m_SelRib.nExtrusionId, New Point3d(b3Reference.Min.x, b3Reference.Min.y, dNewZPos) - b3Reference.Min) EgtDraw() Else NotifyPropertyChanged(NameOf(sZPos)) @@ -154,9 +171,13 @@ Public Class RibPanelVM NotifyPropertyChanged(NameOf(sRotAngle)) Return End If + Dim nId As Integer = If(m_SelRib.Type = RibEntity.RibTypes.FROMDRAW, m_SelRib.nCurveId, m_SelRib.nExtrusionId) Dim b3Rib As New BBox3d - EgtGetBBoxGlob(m_SelRib.nId, GDB_BB.STANDARD, b3Rib) - If EgtRotate(m_SelRib.nId, b3Rib.Center, vtSelRotAxes, dNewAngle) Then + EgtGetBBox(nId, GDB_BB.STANDARD, b3Rib) + Dim bOk As Boolean = False + bOk = EgtRotate(nId, b3Rib.Center(), vtSelRotAxes, dNewAngle) + If bOk AndAlso m_SelRib.Type = RibEntity.RibTypes.FROMDRAW Then EgtRotate(m_SelRib.nExtrusionId, b3Rib.Center, vtSelRotAxes, dNewAngle) + If bOk Then EgtDraw() RefreshPos() m_sRotAngle = 0 @@ -173,16 +194,18 @@ Public Class RibPanelVM Return m_bAdd_IsChecked End Get Set(value As Boolean) - m_bAdd_IsChecked = value - If value Then - m_bEdit_IsChecked = False - m_bGrid_IsChecked = False - m_bMove_IsChecked = False - m_bRotate_IsChecked = False - NotifyPropertyChanged(NameOf(bEdit_IsChecked)) - NotifyPropertyChanged(NameOf(bGrid_IsChecked)) - NotifyPropertyChanged(NameOf(bMove_IsChecked)) - NotifyPropertyChanged(NameOf(bRotate_IsChecked)) + If Not m_bMachParam_IsChecked Then + m_bAdd_IsChecked = value + If value Then + m_bEdit_IsChecked = False + m_bGrid_IsChecked = False + m_bMove_IsChecked = False + m_bRotate_IsChecked = False + NotifyPropertyChanged(NameOf(bEdit_IsChecked)) + NotifyPropertyChanged(NameOf(bGrid_IsChecked)) + NotifyPropertyChanged(NameOf(bMove_IsChecked)) + NotifyPropertyChanged(NameOf(bRotate_IsChecked)) + End If End If End Set End Property @@ -193,7 +216,7 @@ Public Class RibPanelVM Return m_bEdit_IsChecked End Get Set(value As Boolean) - If Not IsNothing(m_SelRib) Then + If Not IsNothing(m_SelRib) AndAlso Not m_bMachParam_IsChecked Then m_bEdit_IsChecked = value If value Then m_bAdd_IsChecked = False @@ -217,16 +240,18 @@ Public Class RibPanelVM Return m_bGrid_IsChecked End Get Set(value As Boolean) - m_bGrid_IsChecked = value - If value Then - m_bAdd_IsChecked = False - m_bEdit_IsChecked = False - m_bMove_IsChecked = False - m_bRotate_IsChecked = False - NotifyPropertyChanged(NameOf(bAdd_IsChecked)) - NotifyPropertyChanged(NameOf(bEdit_IsChecked)) - NotifyPropertyChanged(NameOf(bMove_IsChecked)) - NotifyPropertyChanged(NameOf(bRotate_IsChecked)) + If Not m_bMachParam_IsChecked Then + m_bGrid_IsChecked = value + If value Then + m_bAdd_IsChecked = False + m_bEdit_IsChecked = False + m_bMove_IsChecked = False + m_bRotate_IsChecked = False + NotifyPropertyChanged(NameOf(bAdd_IsChecked)) + NotifyPropertyChanged(NameOf(bEdit_IsChecked)) + NotifyPropertyChanged(NameOf(bMove_IsChecked)) + NotifyPropertyChanged(NameOf(bRotate_IsChecked)) + End If End If End Set End Property @@ -237,7 +262,7 @@ Public Class RibPanelVM Return m_bMove_IsChecked End Get Set(value As Boolean) - If Not IsNothing(m_SelRib) Then + If Not IsNothing(m_SelRib) AndAlso Not m_bMachParam_IsChecked Then m_bMove_IsChecked = value If value Then m_bAdd_IsChecked = False @@ -261,7 +286,7 @@ Public Class RibPanelVM Return m_bRotate_IsChecked End Get Set(value As Boolean) - If Not IsNothing(m_SelRib) Then + If Not IsNothing(m_SelRib) AndAlso Not m_bMachParam_IsChecked Then m_bRotate_IsChecked = value If value Then m_bAdd_IsChecked = False @@ -279,6 +304,48 @@ Public Class RibPanelVM End Set End Property + Private m_bMachParam_IsChecked As Boolean + Public Property bMachParam_IsChecked As Boolean + Get + Return m_bMachParam_IsChecked + End Get + Set(value As Boolean) + If Not IsNothing(m_SelRib) AndAlso Not IsNothing(Map.refTopPanelVM.SelMachining) AndAlso value Then + m_bMachParam_IsChecked = True + m_bAdd_IsChecked = False + m_bEdit_IsChecked = False + m_bGrid_IsChecked = False + m_bMove_IsChecked = False + m_bRotate_IsChecked = False + NotifyPropertyChanged(NameOf(bAdd_IsChecked)) + NotifyPropertyChanged(NameOf(bEdit_IsChecked)) + NotifyPropertyChanged(NameOf(bGrid_IsChecked)) + NotifyPropertyChanged(NameOf(bMove_IsChecked)) + NotifyPropertyChanged(NameOf(bRotate_IsChecked)) + Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.RIBPARAM) + NotifyPropertyChanged(NameOf(RibList_IsEnabled)) + Else + NotifyPropertyChanged(NameOf(m_bMachParam_IsChecked)) + End If + End Set + End Property + Friend Sub ResetMachParamIsChecked() + m_bMachParam_IsChecked = False + NotifyPropertyChanged(NameOf(bMachParam_IsChecked)) + NotifyPropertyChanged(NameOf(RibList_IsEnabled)) + End Sub + + Public ReadOnly Property Compo_Visibility As Visibility + Get + Return If(Not IsNothing(m_SelRib) AndAlso m_SelRib.Type = RibEntity.RibTypes.FROMDRAW, Visibility.Visible, Visibility.Collapsed) + End Get + End Property + + Public ReadOnly Property RibList_IsEnabled As Boolean + Get + Return Not m_bMachParam_IsChecked + End Get + End Property ' riferimento griglia all'ingresso in questa pagina Private m_OriginalGridFrame As New Frame3d @@ -296,13 +363,15 @@ Public Class RibPanelVM End Get End Property + ' Definizione comandi Private m_cmdImport As ICommand - Private m_cmdPoint As ICommand Private m_cmdLine2P As ICommand + Private m_cmdDelete As ICommand Private m_cmdModifyCurve As ICommand Private m_cmdAddPointCurve As ICommand Private m_cmdRemovePointCurve As ICommand + Private m_cmdExtrude As ICommand Private m_cmdCPlaneTop As ICommand Private m_cmdCPlaneFront As ICommand Private m_cmdCPlaneRight As ICommand @@ -317,7 +386,8 @@ Public Class RibPanelVM Private m_cmdCPlanePerpObj As ICommand Private m_cmdCPlaneObj As ICommand Private m_cmdDragMove As ICommand - Private m_cmdDelete As ICommand + Private m_cmdDragRotate As ICommand + Private m_cmdMachParam As ICommand #End Region ' FIELDS & PROPERTIES @@ -344,7 +414,21 @@ Public Class RibPanelVM m_RibList.Clear() Dim nRibId As Integer = EgtGetFirstInGroup(m_nRibLayerId) While nRibId <> GDB_ID.NULL - m_RibList.Add(New RibEntity(nRibId)) + Dim EntityType As GDB_TY = EgtGetType(nRibId) + Dim DrawType As Integer = RibEntity.RibTypes.FROMDRAW + EgtGetInfo(nRibId, KEY_RIB_TYPE, DrawType) + If EntityType = GDB_TY.CRV_COMPO AndAlso DrawType = RibEntity.RibTypes.FROMDRAW Then + Dim nExtrusionId As Integer = GDB_ID.NULL + EgtGetInfo(nRibId, KEY_EXTRUSION_ID, nExtrusionId) + Dim RibEntity As RibEntity = New RibEntity(RibEntity.RibTypes.FROMDRAW, nRibId) + If nExtrusionId <> GDB_ID.NULL Then + RibEntity.SetExtrusionId(nExtrusionId) + End If + m_RibList.Add(RibEntity) + ElseIf (EntityType = GDB_TY.SRF_BEZ OrElse EntityType = GDB_TY.SRF_MESH OrElse EntityType = GDB_TY.SRF_FRGN) AndAlso DrawType = RibEntity.RibTypes.FROMIMPORT Then + Dim RibEntity As RibEntity = New RibEntity(RibEntity.RibTypes.FROMIMPORT, nRibId) + m_RibList.Add(RibEntity) + End If nRibId = EgtGetNext(nRibId) End While If m_RibList.Count > 0 Then @@ -357,6 +441,12 @@ Public Class RibPanelVM Friend Sub Dispose() ' ripristino frame originale EgtSetGridFrame(m_OriginalGridFrame) + ' se in modifica parametri + If m_bMachParam_IsChecked Then + ' ripristino modalita' standard + Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.NULL) + Map.refRibPanelVM.ResetMachParamIsChecked() + End If EgtDraw() Map.refSceneHostVM.MainScene.SetStatusNull() End Sub @@ -367,12 +457,27 @@ Public Class RibPanelVM NotifyPropertyChanged(NameOf(sZPos)) End Sub - Private Function InitCommand() As Boolean + Private Function InitCommand(RibSelectionType As RibSelectionTypes) As Boolean ' attivo modifiche su scena Map.refSceneHostVM.MainScene.ResetStatus() + ' rendo traspanete estrusione + EgtSetAlpha(m_SelRib.nExtrusionId, 50) ' seleziono percorso corrente EgtDeselectAll() - EgtSelectObj(m_SelRib.nId) + Select Case RibSelectionType + Case RibSelectionTypes.CURVE + EgtSelectObj(m_SelRib.nCurveId) + Case RibSelectionTypes.EXTRUSION + ' creo layer per estrusione + Dim nNewExtrusionLayerId As Integer = EgtCreateGroup(m_nPartId) + EgtSetName(nNewExtrusionLayerId, LAY_NEWEXTRUSION) + EgtSetCurrPartLayer(m_nPartId, nNewExtrusionLayerId) + EgtSelectObj(m_SelRib.nCurveId) + Case RibSelectionTypes.BOTH + EgtSelectObj(m_SelRib.nCurveId) + EgtSelectObj(m_SelRib.nExtrusionId) + End Select + EgtDraw() End Function Friend Sub UpdateUi() @@ -381,53 +486,96 @@ Public Class RibPanelVM End Sub Friend Sub OnExecCmdEnd(command As Controller.CMD) + Select Case command + Case Controller.CMD.MODIFYCURVE, Controller.CMD.ADDPOINTCURVE, Controller.CMD.REMOVEPOINTCURVE + ' leggo altezza estrusione + Dim dExtrusionLength As Double = 0 + EgtGetInfo(m_SelRib.nExtrusionId, KEY_EXTRUSION_LENGTH, dExtrusionLength) + ' cancello estrusione + EgtErase(m_SelRib.nExtrusionId) + Dim nNewEntityId As Integer = EgtCreateSurfTmByRegionExtrusion(m_nRibLayerId, 1, {m_SelRib.nCurveId}, Vector3d.Z_AX * dExtrusionLength, EPS_STM) + EgtSetName(nNewEntityId, RIB_EXTRUSION) + EgtSetInfo(nNewEntityId, KEY_EXTRUSION_LENGTH, dExtrusionLength) + ' coloro l'entita' di blu + Dim c3LightBlue As Color3d + c3LightBlue.FromColor(System.Drawing.Color.MediumOrchid) + EgtSetColor(nNewEntityId, c3LightBlue) + ' aggiorno riferimento nella curva + m_SelRib.SetExtrusionId(nNewEntityId) + ' seleziono nuova estrusione + EgtSelectObj(m_SelRib.nExtrusionId) + ' ripristino trasparenza estrusione + EgtSetAlpha(m_SelRib.nExtrusionId, 100) + EgtDraw() + ' rimetto la selezione scena a null + Map.refSceneHostVM.MainScene.SetStatusNull() + Case Controller.CMD.MOVE, Controller.CMD.ROTATE + EgtSetAlpha(Map.refRibPanelVM.SelRib.nExtrusionId, 100) + ' seleziono nuova estrusione + EgtSelectObj(m_SelRib.nExtrusionId) + EgtDraw() + ' rimetto la selezione scena a null + Map.refSceneHostVM.MainScene.SetStatusNull() + Case Controller.CMD.GRID_ELEVATION, Controller.CMD.GRID_3P, Controller.CMD.GRID_ORIGIN, Controller.CMD.GRID_PERPCURVE, Controller.CMD.GRID_ROTATE, Controller.CMD.GRID_ROTATE3D + ' rimetto la selezione scena a null + Map.refSceneHostVM.MainScene.SetStatusNull() + End Select If command <> Controller.CMD.LINE2P AndAlso command <> Controller.CMD.EXTRUDE Then Return ' se finita creazione estrusione If m_bIsCreatingExtrusion Then - Dim NewEntity As RibEntity = Nothing m_bIsCreatingExtrusion = False + ' se riferimento non nullo, elimino vecchia estrusione + If m_SelRib.nExtrusionId <> GDB_ID.NULL Then + EgtErase(m_SelRib.nExtrusionId) + End If + Dim NewEntity As RibEntity = Nothing Dim nNewExtrusionLayerId As Integer = EgtGetFirstNameInGroup(m_nPartId, LAY_NEWEXTRUSION) Dim nNewEntityId As Integer = EgtGetFirstInGroup(nNewExtrusionLayerId) Dim NewGeomType As GDB_TY = EgtGetType(nNewEntityId) If NewGeomType = GDB_TY.SRF_FRGN OrElse NewGeomType = GDB_TY.SRF_MESH Then EgtSetName(nNewEntityId, RIB_EXTRUSION) + Dim dExtrusionLength As Double = 0 + StringToLen(Map.refControllerInputPanelVM.Text, dExtrusionLength) + EgtSetInfo(nNewEntityId, KEY_EXTRUSION_LENGTH, dExtrusionLength) ' coloro l'entita' di blu Dim c3LightBlue As Color3d c3LightBlue.FromColor(System.Drawing.Color.MediumOrchid) EgtSetColor(nNewEntityId, c3LightBlue) '' lo sposto nel layer dei rib EgtRelocateGlob(nNewEntityId, m_nRibLayerId, GDB_POS.LAST_SON) - '' lo aggiungo alla lista - NewEntity = New RibEntity(nNewEntityId) - m_RibList.Add(NewEntity) - ' cancello layer - Dim nNewRibLayerId As Integer = EgtGetFirstNameInGroup(m_nPartId, LAY_NEWRIB) - EgtErase(nNewRibLayerId) - EgtErase(nNewExtrusionLayerId) + ' aggiungo riferimento a curva + m_SelRib.SetExtrusionId(nNewEntityId) End If + ' cancello layer estrusione + EgtErase(nNewExtrusionLayerId) ' aggiorno posizione RefreshPos() - ' se aggiunta entita' - If Not IsNothing(NewEntity) Then - SelRib = NewEntity - NotifyPropertyChanged(NameOf(SelRib)) - End If + EgtDraw() ' rimetto la selezione scena a null Map.refSceneHostVM.MainScene.SetStatusNull() End If ' se finita creazione curva If bIsCreatingPath Then - Dim NewEntity As RibEntity = Nothing m_bIsCreatingPath = False + Dim NewEntity As RibEntity = Nothing Dim nNewRibLayerId As Integer = EgtGetFirstNameInGroup(m_nPartId, LAY_NEWRIB) Dim nNewEntityId As Integer = EgtGetFirstInGroup(nNewRibLayerId) Dim NewGeomType As GDB_TY = EgtGetType(nNewEntityId) If NewGeomType = GDB_TY.CRV_COMPO Then - EgtSetName(nNewEntityId, RIB_EXTRUSION) + EgtSetName(nNewEntityId, RIB_CURVE) ' coloro l'entita' di blu Dim c3LightBlue As Color3d c3LightBlue.FromColor(System.Drawing.Color.MediumOrchid) EgtSetColor(nNewEntityId, c3LightBlue) + ' lo sposto nel layer dei rib + EgtRelocateGlob(nNewEntityId, m_nRibLayerId, GDB_POS.LAST_SON) + ' lo aggiungo alla lista + NewEntity = New RibEntity(RibEntity.RibTypes.FROMDRAW, nNewEntityId) + m_RibList.Add(NewEntity) + ' lo seleziono + SelRib = NewEntity + NotifyPropertyChanged(NameOf(SelRib)) + ' creo layer per estrusione Dim nNewExtrusionLayerId As Integer = EgtCreateGroup(m_nPartId) EgtSetName(nNewExtrusionLayerId, LAY_NEWEXTRUSION) EgtSetCurrPartLayer(m_nPartId, nNewExtrusionLayerId) @@ -438,32 +586,12 @@ Public Class RibPanelVM m_bIsCreatingExtrusion = True Else ' cancello layer - EgtErase(nNewRibLayerId) + 'EgtErase(nNewRibLayerId) EgtErase(nNewExtrusionLayerId) End If - - '' lo sposto nel layer degli start - 'EgtRelocateGlob(nNewEntityId, m_nRibLayerId, GDB_POS.LAST_SON) - '' lo aggiungo alla lista - 'NewEntity = New RibEntity(nNewEntityId) - 'm_RibList.Add(NewEntity) - '' cancello layer di disegno - 'EgtErase(nNewRibLayerId) End If - 'If NewGeomType = GDB_TY.CRV_COMPO Then - ' EgtSetName(nNewEntityId, RIB_GEOM) - ' ' coloro l'entita' di blu - ' Dim c3LightBlue As Color3d - ' c3LightBlue.FromColor(System.Drawing.Color.MediumOrchid) - ' EgtSetColor(nNewEntityId, c3LightBlue) - ' ' lo sposto nel layer degli start - ' EgtRelocateGlob(nNewEntityId, m_nRibLayerId, GDB_POS.LAST_SON) - ' ' lo aggiungo alla lista - ' NewEntity = New RibEntity(nNewEntityId) - ' m_RibList.Add(NewEntity) - ' ' cancello layer di disegno - ' EgtErase(nNewRibLayerId) - 'End If + ' cancello layer di disegno + EgtErase(nNewRibLayerId) End If End Sub @@ -478,17 +606,46 @@ Public Class RibPanelVM End Function Friend Sub SelStartFromId(nId) - Dim SelRibEntity As RibEntity = m_RibList.FirstOrDefault(Function(x) x.nId = nId) + Dim SelRibEntity As RibEntity = m_RibList.FirstOrDefault(Function(x) x.nCurveId = nId OrElse x.nExtrusionId = nId) If Not IsNothing(SelRibEntity) Then SelRib = SelRibEntity NotifyPropertyChanged(NameOf(SelRib)) End If End Sub + Friend Sub SelLastRib() + If RibList.Count <= 0 Then Return + SelRib = RibList(RibList.Count - 1) + NotifyPropertyChanged(NameOf(SelRib)) + End Sub + #End Region ' METHODS #Region "COMMANDS" +#Region "Import" + + ''' + ''' Returns a command that do CPlaneTop. + ''' + Public ReadOnly Property Import_Command As ICommand + Get + If m_cmdImport Is Nothing Then + m_cmdImport = New Command(AddressOf Import) + End If + Return m_cmdImport + End Get + End Property + + ''' + ''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand. + ''' + Public Sub Import(ByVal param As Object) + Map.refSceneHostVM.InsertRib() + End Sub + +#End Region ' Import + #Region "Line2P" ''' @@ -518,6 +675,43 @@ Public Class RibPanelVM #End Region ' Line2P +#Region "Delete" + + Public ReadOnly Property Delete_Command As ICommand + Get + If m_cmdDelete Is Nothing Then + m_cmdDelete = New Command(AddressOf Delete) + End If + Return m_cmdDelete + End Get + End Property + + Public Sub Delete() + If IsNothing(SelRib) Then Return + Dim bOk As Boolean = False + Select Case m_SelRib.Type + Case RibEntity.RibTypes.FROMDRAW + bOk = EgtErase(m_SelRib.nCurveId) + If bOk Then EgtErase(m_SelRib.nExtrusionId) + Case RibEntity.RibTypes.FROMIMPORT + bOk = EgtErase(m_SelRib.nExtrusionId) + End Select + If bOk Then + Dim nSelStartIndex As Integer = m_RibList.IndexOf(SelRib) + m_RibList.Remove(SelRib) + If nSelStartIndex < m_RibList.Count Then + SelRib = m_RibList(nSelStartIndex) + ElseIf m_RibList.Count > 0 Then + SelRib = m_RibList(m_RibList.Count - 1) + Else + SelRib = Nothing + End If + NotifyPropertyChanged(NameOf(SelRib)) + End If + End Sub + +#End Region ' Delete + #Region "ModifyCurve" ''' @@ -536,7 +730,7 @@ Public Class RibPanelVM ''' Execute the LinearDimension. This method is invoked by the LinDimCommand. ''' Public Sub ModifyCurve(ByVal param As Object) - InitCommand() + InitCommand(RibSelectionTypes.CURVE) Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.MODIFYCURVE) End Sub @@ -560,7 +754,7 @@ Public Class RibPanelVM ''' Execute the LinearDimension. This method is invoked by the LinDimCommand. ''' Public Sub AddPointCurve(ByVal param As Object) - InitCommand() + InitCommand(RibSelectionTypes.CURVE) If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.CURVETOARC) Else @@ -588,17 +782,42 @@ Public Class RibPanelVM ''' Execute the LinearDimension. This method is invoked by the LinDimCommand. ''' Public Sub RemovePointCurve(ByVal param As Object) + InitCommand(RibSelectionTypes.CURVE) If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then - InitCommand() Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.CURVETOLINE) Else - InitCommand() Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.REMOVEPOINTCURVE) End If End Sub #End Region ' RemovePointCurve +#Region "Extrude" + + ''' + ''' Returns a command that do Extrude. + ''' + Public ReadOnly Property Extrude_Command As ICommand + Get + If m_cmdExtrude Is Nothing Then + m_cmdExtrude = New Command(AddressOf Extrude) + End If + Return m_cmdExtrude + End Get + End Property + + ''' + ''' Execute the Extrude. This method is invoked by the ExtrudeCommand. + ''' + Public Sub Extrude(ByVal param As Object) + InitCommand(RibSelectionTypes.EXTRUSION) + If Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.EXTRUDE) Then + m_bIsCreatingExtrusion = True + End If + End Sub + +#End Region ' Extrude + #Region "CPlaneTop" ''' @@ -897,40 +1116,57 @@ Public Class RibPanelVM End Property Public Sub DragMove() - InitCommand() + InitCommand(RibSelectionTypes.BOTH) Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.MOVE) End Sub #End Region ' DragMove -#Region "Delete" +#Region "DragRotate" - Public ReadOnly Property Delete_Command As ICommand + Public ReadOnly Property DragRotate_Command As ICommand Get - If m_cmdDelete Is Nothing Then - m_cmdDelete = New Command(AddressOf Delete) + If m_cmdDragRotate Is Nothing Then + m_cmdDragRotate = New Command(AddressOf DragRotate) End If - Return m_cmdDelete + Return m_cmdDragRotate End Get End Property - Public Sub Delete() - If IsNothing(SelRib) Then Return - If EgtErase(m_SelRib.nId) Then - Dim nSelStartIndex As Integer = m_RibList.IndexOf(SelRib) - m_RibList.Remove(SelRib) - If nSelStartIndex < m_RibList.Count Then - SelRib = m_RibList(nSelStartIndex) - ElseIf m_RibList.Count > 0 Then - SelRib = m_RibList(m_RibList.Count - 1) - Else - SelRib = Nothing - End If - NotifyPropertyChanged(NameOf(SelRib)) - End If + Public Sub DragRotate() + InitCommand(RibSelectionTypes.BOTH) + Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.ROTATE) End Sub -#End Region ' Delete +#End Region ' DragRotate + +#Region "MachParam" + + Public ReadOnly Property MachParam_Command As ICommand + Get + If m_cmdMachParam Is Nothing Then + m_cmdMachParam = New Command(AddressOf MachParam) + End If + Return m_cmdMachParam + End Get + End Property + + Public Sub MachParam() + If IsNothing(Map.refTopPanelVM.SelMachining) Then Return + m_bAdd_IsChecked = False + m_bEdit_IsChecked = False + m_bGrid_IsChecked = False + m_bMove_IsChecked = False + m_bRotate_IsChecked = False + NotifyPropertyChanged(NameOf(bAdd_IsChecked)) + NotifyPropertyChanged(NameOf(bEdit_IsChecked)) + NotifyPropertyChanged(NameOf(bGrid_IsChecked)) + NotifyPropertyChanged(NameOf(bMove_IsChecked)) + NotifyPropertyChanged(NameOf(bRotate_IsChecked)) + Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.RIBPARAM) + End Sub + +#End Region ' MachParam #End Region ' COMMANDS @@ -939,6 +1175,11 @@ End Class Public Class RibEntity Inherits VMBase + Public Enum RibTypes As Integer + FROMDRAW = 1 + FROMIMPORT = 2 + End Enum + Private Shared m_nSharedIndex As Integer = 0 Private ReadOnly Property nSharedIndex As Integer Get @@ -950,13 +1191,31 @@ Public Class RibEntity m_nSharedIndex = 0 End Sub - Private m_nId As Integer - Public ReadOnly Property nId As Integer + Private m_Type As RibTypes + Public ReadOnly Property Type As RibTypes Get - Return m_nId + Return m_Type End Get End Property + Private m_nCurveId As Integer = GDB_ID.NULL + Public ReadOnly Property nCurveId As Integer + Get + Return m_nCurveId + End Get + End Property + + Private m_nExtrusionId As Integer = GDB_ID.NULL + Public ReadOnly Property nExtrusionId As Integer + Get + Return m_nExtrusionId + End Get + End Property + Friend Sub SetExtrusionId(nId As Integer) + m_nExtrusionId = nId + EgtSetInfo(m_nCurveId, KEY_EXTRUSION_ID, m_nExtrusionId) + End Sub + Private m_nIndex As Integer Public ReadOnly Property nIndex As Integer Get @@ -966,13 +1225,20 @@ Public Class RibEntity Public ReadOnly Property ghName As String Get - Return String.Format("[{0}] {1}", {m_nIndex, "Rib"}) + Return String.Format("[{0}] {1}", {m_nIndex, If(m_Type = RibTypes.FROMDRAW, "Draw Rib", "Import Rib")}) End Get End Property - Sub New(nId As Integer) - m_nId = nId + Sub New(Type As RibTypes, nId As Integer) m_nIndex = nSharedIndex + m_Type = Type + EgtSetInfo(nId, KEY_RIB_TYPE, Type) + Select Case Type + Case RibTypes.FROMDRAW + m_nCurveId = nId + Case RibTypes.FROMIMPORT + m_nExtrusionId = nId + End Select End Sub End Class diff --git a/Icarus/RibParamPanel/RibParamPanelV.xaml b/Icarus/RibParamPanel/RibParamPanelV.xaml new file mode 100644 index 0000000..470520d --- /dev/null +++ b/Icarus/RibParamPanel/RibParamPanelV.xaml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +