UserControl bajo carpeta de UserControl

This commit is contained in:
Miguel 2024-05-18 23:14:46 +02:00
parent f458a031c5
commit 6155f8475e
28 changed files with 28 additions and 21 deletions

View File

@ -11,6 +11,8 @@
<ItemGroup> <ItemGroup>
<Compile Remove="ObjetosSim\ucBasicExample.xaml.cs" /> <Compile Remove="ObjetosSim\ucBasicExample.xaml.cs" />
<Compile Remove="ObjetosSim\ucTransporteCurva.xaml.cs" /> <Compile Remove="ObjetosSim\ucTransporteCurva.xaml.cs" />
<Compile Remove="ObjetosSim\UserControls\ucBasicExample.xaml.cs" />
<Compile Remove="ObjetosSim\UserControls\ucTransporteCurva.xaml.cs" />
<Compile Remove="Simulacion\GeometrySimulator.cs" /> <Compile Remove="Simulacion\GeometrySimulator.cs" />
</ItemGroup> </ItemGroup>
@ -30,13 +32,15 @@
<ItemGroup> <ItemGroup>
<Page Remove="ObjetosSim\ucBasicExample.xaml" /> <Page Remove="ObjetosSim\ucBasicExample.xaml" />
<Page Remove="ObjetosSim\ucTransporteCurva.xaml" /> <Page Remove="ObjetosSim\ucTransporteCurva.xaml" />
<Page Remove="ObjetosSim\UserControls\ucBasicExample.xaml" />
<Page Remove="ObjetosSim\UserControls\ucTransporteCurva.xaml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="ObjetosSim\ucBasicExample.xaml" /> <None Include="ObjetosSim\UserControls\ucBasicExample.xaml" />
<None Include="ObjetosSim\ucBasicExample.xaml.cs" /> <None Include="ObjetosSim\UserControls\ucBasicExample.xaml.cs" />
<None Include="ObjetosSim\ucTransporteCurva.xaml" /> <None Include="ObjetosSim\UserControls\ucTransporteCurva.xaml" />
<None Include="ObjetosSim\ucTransporteCurva.xaml.cs" /> <None Include="ObjetosSim\UserControls\ucTransporteCurva.xaml.cs" />
<None Include="Simulacion\GeometrySimulator.cs" /> <None Include="Simulacion\GeometrySimulator.cs" />
</ItemGroup> </ItemGroup>

View File

@ -10,7 +10,6 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using CtrEditor.ObjetosSim;
using CtrEditor.Convertidores; using CtrEditor.Convertidores;
using CtrEditor.Siemens; using CtrEditor.Siemens;
using static System.Runtime.InteropServices.JavaScript.JSType; using static System.Runtime.InteropServices.JavaScript.JSType;
@ -22,6 +21,7 @@ using UserControl = System.Windows.Controls.UserControl;
using CheckBox = System.Windows.Controls.CheckBox; using CheckBox = System.Windows.Controls.CheckBox;
using Orientation = System.Windows.Controls.Orientation; using Orientation = System.Windows.Controls.Orientation;
using ListBox = System.Windows.Controls.ListBox; using ListBox = System.Windows.Controls.ListBox;
using CtrEditor.ObjetosSim;
namespace CtrEditor namespace CtrEditor

View File

@ -15,7 +15,8 @@ using System.Windows.Shapes;
using CtrEditor.Convertidores; using CtrEditor.Convertidores;
using CtrEditor.Siemens; using CtrEditor.Siemens;
namespace CtrEditor.ObjetosSim
namespace CtrEditor.ObjetosSim.UserControls
{ {
/// <summary> /// <summary>
/// Interaction logic for ucTransporteCurva.xaml /// Interaction logic for ucTransporteCurva.xaml

View File

@ -83,9 +83,9 @@ namespace CtrEditor.ObjetosSim
{ {
foreach (var objetoSimulable in _mainViewModel.ObjetosSimulables) foreach (var objetoSimulable in _mainViewModel.ObjetosSimulables)
{ {
if (tipoOsBase.IsInstanceOfType(objetoSimulable) && ((osBase)objetoSimulable).Nombre == NameLink) if (tipoOsBase.IsInstanceOfType(objetoSimulable) && objetoSimulable.Nombre == NameLink)
{ {
return (osBase)objetoSimulable; return objetoSimulable;
} }
} }
} }
@ -123,7 +123,7 @@ namespace CtrEditor.ObjetosSim
if (!string.IsNullOrEmpty(Tag)) if (!string.IsNullOrEmpty(Tag))
{ {
SDataValue plcData = new SDataValue(); SDataValue plcData = new SDataValue();
plcData.UInt16 = (ushort)(((Value - IN_scale_Min) / (IN_scale_Max - IN_scale_Min) * (OUT_scale_Max - OUT_scale_Min)) + OUT_scale_Min); plcData.UInt16 = (ushort)((Value - IN_scale_Min) / (IN_scale_Max - IN_scale_Min) * (OUT_scale_Max - OUT_scale_Min) + OUT_scale_Min);
plc.EscribirTag(Tag, plcData); plc.EscribirTag(Tag, plcData);
} }
} }
@ -138,7 +138,7 @@ namespace CtrEditor.ObjetosSim
{ {
SDataValue plcData = plc.LeerTag(Tag); SDataValue plcData = plc.LeerTag(Tag);
float Value = plcData.UInt16; // WORD float Value = plcData.UInt16; // WORD
return (((Value - OUT_scale_Min) / (OUT_scale_Max - OUT_scale_Min) * (IN_scale_Max - IN_scale_Min)) + IN_scale_Min); return (Value - OUT_scale_Min) / (OUT_scale_Max - OUT_scale_Min) * (IN_scale_Max - IN_scale_Min) + IN_scale_Min;
} }
} }
return 0; return 0;

View File

@ -234,7 +234,7 @@ namespace CtrEditor.Simulacion
Body.LinearDamping = 0f; // Ajustar para controlar la reducción de la velocidad lineal Body.LinearDamping = 0f; // Ajustar para controlar la reducción de la velocidad lineal
Body.AngularDamping = 0f; // Ajustar para controlar la reducción de la velocidad angular Body.AngularDamping = 0f; // Ajustar para controlar la reducción de la velocidad angular
Body.Restitution = 0.2f; // Baja restitución para menos rebote Body.Restitution = 0.2f; // Baja restitución para menos rebote
Body.IsBullet = true; // Body.IsBullet = true;
} }
public void SetDiameter(float diameter) public void SetDiameter(float diameter)
@ -326,8 +326,10 @@ namespace CtrEditor.Simulacion
public void Clear() public void Clear()
{ {
Cuerpos.Clear(); if (world.BodyList.Count > 0)
world.Clear(); world.Clear();
if (Cuerpos.Count > 0)
Cuerpos.Clear();
} }
public void Step() public void Step()