init: 导入项目到 meswork Gitea

This commit is contained in:
XingCheng3
2026-05-29 10:07:05 +08:00
commit ad9a4106fb
3582 changed files with 460312 additions and 0 deletions

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7A8CC5EC-9795-4FCD-A85F-BB01DA377225}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Foundation</RootNamespace>
<AssemblyName>Foundation</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\WebAppDll\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Numerics" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Base.Class\ActPlayModelVisibleAndRotation.cs" />
<Compile Include="Base.Class\A_BAK_1 - 复制%283%29 - 复制%284%29.cs" />
<Compile Include="Base.Class\A_BAK_1 - 复制%283%29 - 复制%285%29.cs" />
<Compile Include="Base.Class\A_BAK_1 - 复制%283%29 - 复制%286%29.cs" />
<Compile Include="Base.Class\A_BAK_1 - 复制%283%29 - 复制.cs" />
<Compile Include="Base.Class\A_BAK_1 - 复制%283%29.cs" />
<Compile Include="Base.Class\BasicData.cs" />
<Compile Include="Base.Class\Cmd_Const.cs" />
<Compile Include="Base.Class\Cmd_Frame.cs" />
<Compile Include="Base.Class\Cmd_Protocol.cs" />
<Compile Include="Base.Class\CurrSignalList.cs" />
<Compile Include="Base.Class\Data_ClickModel.cs" />
<Compile Include="Base.Class\Data_RobotCurr.cs" />
<Compile Include="Base.Class\DeviceCraftData.cs" />
<Compile Include="Base.Class\DownLoadRobotProgram.cs" />
<Compile Include="Base.Class\EnumTagTypeID.cs" />
<Compile Include="Base.Class\GeneralFunction.cs" />
<Compile Include="Base.Class\Kinematics.cs" />
<Compile Include="Base.Class\KinematicsActionType.cs" />
<Compile Include="Base.Class\KinematicsPropertyType.cs" />
<Compile Include="Base.Class\LogicalBlockBasic.cs" />
<Compile Include="Base.Class\ModelAttribute.cs" />
<Compile Include="Base.Class\ModelGroup.cs" />
<Compile Include="Base.Class\ModelNameData.cs" />
<Compile Include="Base.Class\ModelNameVisible.cs" />
<Compile Include="Base.Class\ModelProcess.cs" />
<Compile Include="Base.Class\Mode_Run.cs" />
<Compile Include="Base.Class\OperateResult.cs" />
<Compile Include="Base.Class\OPERATION.cs" />
<Compile Include="Base.Class\OperationResult.cs" />
<Compile Include="Base.Class\PlayTransmitParam.cs" />
<Compile Include="Base.Class\ProgramHandler.cs" />
<Compile Include="Base.Class\QueueExecScriptParam.cs" />
<Compile Include="Base.Class\ShowMainProgress.cs" />
<Compile Include="Base.Class\ShowMainProgressSet.cs" />
<Compile Include="Base.Class\SignalHandler.cs" />
<Compile Include="Base.Class\TagContent.cs" />
<Compile Include="Base.Class\TagTriggerHandler.cs" />
<Compile Include="Base.Class\Type_Craft.cs" />
<Compile Include="Base.Class\Type_Device.cs" />
<Compile Include="Base.Class\Type_DeviceSignalSimTree.cs" />
<Compile Include="Base.Class\Type_GenerateSignal.cs" />
<Compile Include="Base.Class\Type_Jurisdiction.cs" />
<Compile Include="Base.Class\Type_OperationCmd.cs" />
<Compile Include="Base.Class\Type_OperationTree.cs" />
<Compile Include="Base.Class\Type_Signal_Raw.cs" />
<Compile Include="Base.Class\Type_TagIDHandler.cs" />
<Compile Include="Base.Class\UseTriggerPlayParameter.cs" />
<Compile Include="Interface3\IIErr.cs" />
<Compile Include="Interface3\IIExecCmd.cs" />
<Compile Include="Interface3\IIMM.cs" />
<Compile Include="Interface3\IIProj.cs" />
<Compile Include="Interface\IErrHandler.cs" />
<Compile Include="Interface\IGlobalVar.cs" />
<Compile Include="Interface\IIErrInterface.cs" />
<Compile Include="Interface\IIMMInterface.cs" />
<Compile Include="Interface\IIProjectInterface.cs" />
<Compile Include="Interface\IMM.Interface.cs" />
<Compile Include="Interface\IProjectVar.cs" />
<Compile Include="Interface_Delegate.cs" />
<Compile Include="Interface_Var.cs" />
<Compile Include="Kinematics\Kinematics.Joint.cs" />
<Compile Include="Kinematics\Kinematics.JointPose.cs" />
<Compile Include="Kinematics\Kinematics.Kinematics.cs" />
<Compile Include="Kinematics\Kinematics.Link.cs" />
<Compile Include="Kinematics\Kinematics.OPERATION.cs" />
<Compile Include="Kinematics\Kinematics.Pose.cs" />
<Compile Include="Kinematics\Kinematics.Sensor.cs" />
<Compile Include="ModelBasic\CallbackBsae.cs" />
<Compile Include="ModelBasic\CallbackObjectFromJs.cs" />
<Compile Include="ModelBasic\ErrHandler.cs" />
<Compile Include="ModelBasic\Error.cs" />
<Compile Include="ModelBasic\ErrorDefinition.cs" />
<Compile Include="ModelBasic\GlobalVar.cs" />
<Compile Include="ModelBasic\InitVar.cs" />
<Compile Include="ModelBasic\NewIProjectVar.cs" />
<Compile Include="ModelBasic\ProjectVar.cs" />
<Compile Include="ModelBasic\ProjectVarDefinition.cs" />
<Compile Include="ModelBasic\TheVar.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LogNet\20-01LogNet.csproj">
<Project>{4b777069-a494-40ff-8e88-e3d815ed80cb}</Project>
<Name>20-01LogNet</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace ModelBasic
{
public partial class SS
{
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace ModelBasic
{
public partial class SS
{
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace ModelBasic
{
public partial class SS
{
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace ModelBasic
{
public partial class SS
{
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace ModelBasic
{
public partial class SS
{
}
}

View File

@@ -0,0 +1,44 @@
using System;
/// <summary>
/// 承载类
/// 模型显示隐藏自转
/// 2021.1.15
/// </summary>
[Serializable]
public class ActPlayModelVisibleAndRotation
{
/// <summary>
/// CraftDeviceTypeCode
/// </summary>
public int CraftDeviceTypeCode { get; set; }
/// <summary>
/// CraftCade
/// </summary>
public string CraftCade { get; set; }
/// <summary>
/// CraftName
/// </summary>
public string CraftName { get; set; }
/// <summary>
/// StartTime
/// </summary>
public int StartTime { get; set; }
/// <summary>
/// KeepTime
/// </summary>
public int KeepTime { get; set; }
/// <summary>
/// StartFrame
/// </summary>
public int StartFrame { get; set; }
/// <summary>
/// OperationValue
/// </summary>
public string OperationValue { get; set; }
/// <summary>
/// ModelCode
/// </summary>
public string ModelCode { get; set; }
}

View File

@@ -0,0 +1,308 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Text;
namespace BasicData
{
/// <summary>
/// 变量类型代码
/// 101 合格数据变量
/// 102 不合格数据变量
/// 103 机床报警变量
/// 1 MES通讯状态PLC
///2 MES激发变量开始扫描
///3 MES激发变量返修标志
///4 MES通讯状态MES
///5 MES激发变量扫描完成
///6 MES激发变量允许工作
///7 MES激发变量物料验证完毕
///8 MES激发变量返修放行
///9 MES发动机机型标志
///10 MES发动机号
///11 MES发动机机型
///25 MES发动机追踪代码
///12 机床状态变量
///13 MES激发变量托盘到位离开
///14 监控系统通讯状态PLC
///15 监控系统通讯状态MIS
///16 加工时间变量激发
///17 加工时间变量目标时间
///18 加工时间变量实际时间
///19 质量数据可以读数据
///21 质量数据总成合格标志
///20 MES保存完数据
///26 加工时间保存完数据
///22 质量数据发动机机型标志
///23 质量数据发动机号
///24 质量数据发动机机型
///27 操作者工号
///28 订单号
///29 工位具体零件合格标志
/// </summary>
public struct QualityDataType
{
/// <summary>
/// 变量类型代码
/// 101 合格数据变量
/// 102 不合格数据变量
/// 103 机床报警变量
/// 1 MES通讯状态PLC
///2 MES激发变量开始扫描
///3 MES激发变量返修标志
///4 MES通讯状态MES
///5 MES激发变量扫描完成
///6 MES激发变量允许工作
///7 MES激发变量物料验证完毕
///8 MES激发变量返修放行
///9 MES发动机机型标志
///10 MES发动机号
///11 MES发动机机型
///25 MES发动机追踪代码
///12 机床状态变量
///13 MES激发变量托盘到位离开
///14 监控系统通讯状态PLC
///15 监控系统通讯状态MIS
///16 加工时间变量激发
///17 加工时间变量目标时间
///18 加工时间变量实际时间
///19 质量数据可以读数据
///21 质量数据总成合格标志
///20 MES保存完数据
///26 加工时间保存完数据
///22 质量数据发动机机型标志
///23 质量数据发动机号
///24 质量数据发动机机型
///27 操作者工号
///28 订单号
/// 10 前提条件不满足
///20 不合格
///251 合格
///254 直通
///255 不要求工作
///253 备用工位完成
///254 返修工位完成
///0 未定义
///29 工位具体零件合格标志
/// </summary>
public int tagValueType;
/// <summary>
/// 变量类型
/// </summary>
public int tagTypeID;
/// <summary>
/// 工位号
/// </summary>
public string opName;
/// <summary>
/// 变量代码
/// </summary>
public int tagID;
/// <summary>
/// 变量值
/// </summary>
public object tagValue;
/// <summary>
/// 数据质量代码
/// 192 数据正常
/// </summary>
public int tagQuality;
/// <summary>
/// 列位置1234
/// </summary>
public int tagOrderBy;
/// <summary>
/// 变量排序(1:拧矩2转角)
/// </summary>
public int tagItemOrderBy;
/// <summary>
/// 变量代码与变量特点
/// 0:没定义1工位合格标志2需要合格标志的测量数据3每个工位的合格标志4:物料5:IQA码6:压装数据
/// 7:压装合格标志8(自动拧紧)工位合格标志
/// </summary>
public int tagProperty;
/// <summary>
/// 合格标志01
/// </summary>
public int isGoodBad;
}
[Serializable]
public class jsonobj
{
public string Type;
public string Name;
public string Param;
public string Pagination;
public bool HasReturn;
}
[Serializable]
public class jsonobjV2
{
public string Type;
public string Name;
public object Param;
public string Pagination;
public bool HasReturn;
}
/// <summary>
///
/// </summary>
public class MesBasicData
{
/// <summary>
/// 通过指定路径将 文本文件 转换成 DataTable
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
public static DataTable GetBasicData(string fileName)
{
string[] strFileLines = File.ReadAllLines(fileName, Encoding.Default);
if (strFileLines.Length < 2) return null;
string[] strFieldName = strFileLines[0].Split('\t');
DataTable dtBasicData;
dtBasicData = new DataTable();
for (int i = 0; i < strFieldName.Length; i++)
{
dtBasicData.Columns.Add(strFieldName[i]);
}
DataRow dr = dtBasicData.NewRow();
for (int i = 1; i < strFileLines.Length; i++)
{
string[] strColumns = strFileLines[i].Split('\t');
for (int j = 0; j < strColumns.Length; j++)
{
strColumns[j] = strColumns[j].Trim('"').TrimEnd('"');
dr[j] = strColumns[j];
}
if (dr["是否启用"].ToString() == "1")
{
dtBasicData.Rows.Add(strColumns);
}
}
return dtBasicData;
}
/// <summary>
///
/// </summary>
public class DataTableSelect
{
static public DataTable SelectTable(DataTable SourceTable, string filterString)
{
DataTable dt = SourceTable.Clone();
var rows = SourceTable.Select(filterString);
if (rows != null && rows.Length > 0)
{
foreach (DataRow row in rows)
{
dt.ImportRow(row);
}
}
return dt;
}
/// <summary>
/// 返回执行Select distinct后的DataTable
/// </summary>
/// <param name="SourceTable">源数据表</param>
/// <param name="filterString">字段集</param>
/// <param name="FieldNames">字段集</param>
/// <returns></returns>
static public DataTable SelectDistinctGroup(DataTable SourceTable, string filterString, params string[] FieldNames)
{
DataTable dtFilter;
DataTable newTable;
dtFilter = SelectTable(SourceTable, filterString);
newTable = SelectDistinct(dtFilter, FieldNames);
return newTable;
}
/// <summary>
/// 返回执行Select distinct后的DataTable
/// </summary>
/// <param name="SourceTable">源数据表</param>
/// <param name="FieldNames">字段集</param>
/// <returns></returns>
static public DataTable SelectDistinct(DataTable SourceTable, params string[] FieldNames)
{
object[] lastValues;
DataTable newTable;
DataRow[] orderedRows;
if (FieldNames == null || FieldNames.Length == 0)
throw new ArgumentNullException("FieldNames");
lastValues = new object[FieldNames.Length];
newTable = new DataTable();
foreach (string fieldName in FieldNames)
newTable.Columns.Add(fieldName, SourceTable.Columns[fieldName].DataType);
orderedRows = SourceTable.Select("", string.Join(",", FieldNames));
foreach (DataRow row in orderedRows)
{
if (!fieldValuesAreEqual(lastValues, row, FieldNames))
{
newTable.Rows.Add(createRowClone(row, newTable.NewRow(), FieldNames));
setLastValues(lastValues, row, FieldNames);
}
}
return newTable;
}
static private bool fieldValuesAreEqual(object[] lastValues, DataRow currentRow, string[] fieldNames)
{
bool areEqual = true;
for (int i = 0; i < fieldNames.Length; i++)
{
if (lastValues[i] == null || !lastValues[i].Equals(currentRow[fieldNames[i]]))
{
areEqual = false;
break;
}
}
return areEqual;
}
static private DataRow createRowClone(DataRow sourceRow, DataRow newRow, string[] fieldNames)
{
foreach (string field in fieldNames)
newRow[field] = sourceRow[field];
return newRow;
}
static private void setLastValues(object[] lastValues, DataRow sourceRow, string[] fieldNames)
{
for (int i = 0; i < fieldNames.Length; i++)
lastValues[i] = sourceRow[fieldNames[i]];
}
}
}
}

View File

@@ -0,0 +1,29 @@
/// <summary>
/// 2021.2.23
///
/// </summary>
public struct Cmd_Const
{
public const string Receive_Position = "Position";
public const string Receive_ClickModel = "ClickModel";
public const string RobotTcpCurr = "RobotTcpCurr";
public const string RobotTcpEnd = "RobotTcpEnd";
public const string B_C_ImportModel = "B_C_ImportModel";//2021.4.10
public const string B_C_ExportModel = "B_C_ExportModel";//2021.4.10
public const string Receive_ModelTree = "ModelTree";//2021.5.7
public const string B_C_GetProjectCode = "B_C_GetProjectCode";//2021.9.6
public const string B_C_WriteLog = "B_C_WriteLog";//2021.12.04
}

View File

@@ -0,0 +1,20 @@
/// <summary>
/// 2021.2.23
/// 2021.10.11.1916.LLX
/// </summary>
public struct Cmd_Frame
{
public const string Craft = "craft";
public const string SignalWrite = "signalwrite";
public const string Visible = "visible";
public const string Rotation = "rotation";
public const string Wait = "wait";
public const string Attach = "attach";
}

View File

@@ -0,0 +1,25 @@
/// <summary>
/// 2021.2.23
///
/// </summary>
public struct Cmd_Protocol
{
public static string Frames => "|Frames|";
public static string Select => "|Select|";
public static string DragMove => "|DragMove|";
public static string PlayAct => "|PlayAct|";
public static string DrawPath => "|DrawPath|";
public static string CraftCurrOperation => "|CraftCurrOperation|";
public static string ReLoadData => "|ReLoadData|";
public static string RobotTcp => "|RobotTcp|";
public static string C_B_ImportModel => "|C_B_ImportModel|";//2021.4.10
public static string C_B_SetProjectCode => "|C_B_SetProjectCode|";//2021.9.6
public static string C_B_ReLoad_TagIDHandler => "|C_B_ReLoad_TagIDHandler|";//2021.10.10
public static string C_B_TagIDTrigger => "|C_B_TagIDTrigger|";//2021.10.10
public static string C_B_KinematicsEditing => "|C_B_KinematicsEditing|";//2021.11.25
public static string C_B_SaveModel => "|C_B_SaveModel|";//2021.11.26
}

View File

@@ -0,0 +1,467 @@
using System;
using System.Collections.Generic;
/// <summary>
/// CurrPostion
/// 2021.1.~
/// </summary>
[Serializable]
public class CurrPostion
{
///// <summary>
///// 帧
///// </summary>
//public int Index
//{
// get;
// set;
//}
public string CraftCode
{
get;
set;
}
/// <summary>
/// 模型名
/// </summary>
public string ModelCode
{
get;
set;
}
/// <summary>
/// 模型名
/// </summary>
public string ModelName
{
get;
set;
}
/// <summary>
/// X
/// </summary>
public double X
{
get;
set;
}
/// <summary>
/// Y
/// </summary>
public double Y
{
get;
set;
}
/// <summary>
/// Z
/// </summary>
public double Z
{
get;
set;
}
/// <summary>
/// RX
/// </summary>
public double RX
{
get;
set;
}
/// <summary>
/// RY
/// </summary>
public double RY
{
get;
set;
}
/// <summary>
/// RZ
/// </summary>
public double RZ
{
get;
set;
}
/// <summary>
/// QX
/// </summary>
public double QX
{
get;
set;
}
/// <summary>
/// QY
/// </summary>
public double QY
{
get;
set;
}
/// <summary>
/// QZ
/// </summary>
public double QZ
{
get;
set;
}
/// <summary>
/// QW
/// </summary>
public double QW
{
get;
set;
}
/// <summary>
/// X_Base
/// </summary>
public double X_Base
{
get;
set;
}
/// <summary>
/// Y_Base
/// </summary>
public double Y_Base
{
get;
set;
}
/// <summary>
/// Z_Base
/// </summary>
public double Z_Base
{
get;
set;
}
/// <summary>
/// RX_Base
/// </summary>
public double RX_Base
{
get;
set;
}
/// <summary>
/// RY_Base
/// </summary>
public double RY_Base
{
get;
set;
}
/// <summary>
/// RZ_Base
/// </summary>
public double RZ_Base
{
get;
set;
}
/// <summary>
/// QX_Base
/// </summary>
public double QX_Base
{
get;
set;
}
/// <summary>
/// QY_Base
/// </summary>
public double QY_Base
{
get;
set;
}
/// <summary>
/// QZ_Base
/// </summary>
public double QZ_Base
{
get;
set;
}
/// <summary>
/// QW_Base
/// </summary>
public double QW_Base
{
get;
set;
}
/// <summary>
/// X_Tool
/// </summary>
public double X_Tool
{
get;
set;
}
/// <summary>
/// Y_Tool
/// </summary>
public double Y_Tool
{
get;
set;
}
/// <summary>
/// Z_Tool
/// </summary>
public double Z_Tool
{
get;
set;
}
/// <summary>
/// RX_Tool
/// </summary>
public double RX_Tool
{
get;
set;
}
/// <summary>
/// RY_Tool
/// </summary>
public double RY_Tool
{
get;
set;
}
/// <summary>
/// RZ_Tool
/// </summary>
public double RZ_Tool
{
get;
set;
}
/// <summary>
/// QX_Tool
/// </summary>
public double QX_Tool
{
get;
set;
}
/// <summary>
/// QY_Tool
/// </summary>
public double QY_Tool
{
get;
set;
}
/// <summary>
/// QZ_Tool
/// </summary>
public double QZ_Tool
{
get;
set;
}
/// <summary>
/// QW_Tool
/// </summary>
public double QW_Tool
{
get;
set;
}
public string CurrJoint { get; set; }
public string MoveType { get; set; }
public double J1 { get; set; }
public double J2 { get; set; }
public double J3 { get; set; }
public double J4 { get; set; }
public double J5 { get; set; }
public double J6 { get; set; }
public string ProcessCode { get; set; }
public int SequenceNo { get; set; }
public string ProcessName { get; set; }
public int UseTime { get; set; }
public List<JointData> currentJoint = null;
public void SetCurrJoint()
{
this.CurrJoint =
"["
+ J1.ToString("f5") + ","
+ J2.ToString("f5") + ","
+ J3.ToString("f5") + ","
+ J4.ToString("f5") + ","
+ J5.ToString("f5") + ","
+ J6.ToString("f5")
+ "]";
}
public void SetTcpQ(double[] tcpQ)
{
X = tcpQ[0];
Y = tcpQ[1];
Z = tcpQ[2];
QX = tcpQ[3];
QY = tcpQ[4];
QZ = tcpQ[5];
QW = tcpQ[6];
}
public void SetTcpRpy(double[] tcpRpy)
{
X = tcpRpy[0];
Y = tcpRpy[1];
Z = tcpRpy[2];
RX = tcpRpy[3];
RY = tcpRpy[4];
RZ = tcpRpy[5];
}
public void SetJ(double[] p_JList)
{
J1 = p_JList[0];
J2 = p_JList[1];
J3 = p_JList[2];
J4 = p_JList[3];
J5 = p_JList[4];
J6 = p_JList[5];
SetCurrJoint();
}
public double[] GetJ()
{
return new double[] { J1, J2, J3, J4, J5, J6 };
}
public double[] GetTcpQ()
{
return new double[] { X, Y, Z, QX, QY, QZ, QW };
}
public double[] GetTcpRpy()
{
return new double[] { X, Y, Z, RX, RY, RZ };
}
public double[] GetTen()
{
return new double[] { X, Y, Z, QX, QY, QZ, QW, RX, RY, RZ };
}
public double[] GetBaseTen()
{
return new double[] { X_Base, Y_Base, Z_Base, QX_Base, QY_Base, QZ_Base, QW_Base, RX_Base, RY_Base, RZ_Base };
}
public double[] GetBaseQ()
{
return new double[] { X_Base, Y_Base, Z_Base, QX_Base, QY_Base, QZ_Base, QW_Base };
}
public double[] GetBaseRpy()
{
return new double[] { X_Base, Y_Base, Z_Base, RX_Base, RY_Base, RZ_Base };
}
public double[] GetToolTen()
{
return new double[] { X_Tool, Y_Tool, Z_Tool, QX_Tool, QY_Tool, QZ_Tool, QW_Tool, RX_Tool, RY_Tool, RZ_Tool };
}
public double[] GetToolQ()
{
return new double[] { X_Tool, Y_Tool, Z_Tool, QX_Tool, QY_Tool, QZ_Tool, QW_Tool };
}
public double[] GetToolRpy()
{
return new double[] { X_Tool, Y_Tool, Z_Tool, RX_Tool, RY_Tool, RZ_Tool };
}
}
[Serializable]
public class JointData
{
public string id;
public string name;
public string value;
public string type;
}
/////// <summary>
/////// 带 currentJoint 信息
/////// </summary>
////[Serializable]
////public class CurrJoint : CurrPostion
////{
//// public List<JointData> currentJoint = null;
////}
///// <summary>
///// 带 currentJoint 信息
///// </summary>
//[Serializable]
//public class CurrJoint_J : CurrJoint
//{
//}
public class CurrJointName
{
public const string CraftCode = "CraftCode";
public const string ProcessCode = "ProcessCode";
public const string SequenceNo = "SequenceNo";
public const string ProcessName = "ProcessName";
public const string UseTime = "UseTime";
public const string X = "X";
public const string Y = "Y";
public const string Z = "Z";
public const string RX = "RX";
public const string RY = "RY";
public const string RZ = "RZ";
public const string X_Base = "X_Base";
public const string Y_Base = "Y_Base";
public const string Z_Base = "Z_Base";
public const string RX_Base = "RX_Base";
public const string RY_Base = "RY_Base";
public const string RZ_Base = "RZ_Base";
public const string X_Tool = "X_Tool";
public const string Y_Tool = "Y_Tool";
public const string Z_Tool = "Z_Tool";
public const string RX_Tool = "RX_Tool";
public const string RY_Tool = "RY_Tool";
public const string RZ_Tool = "RZ_Tool";
public const string QX = "QX";
public const string QY = "QY";
public const string QZ = "QZ";
public const string QW = "QW";
public const string QX_Base = "QX_Base";
public const string QY_Base = "QY_Base";
public const string QZ_Base = "QZ_Base";
public const string QW_Base = "QW_Base";
public const string QX_Tool = "QX_Tool";
public const string QY_Tool = "QY_Tool";
public const string QZ_Tool = "QZ_Tool";
public const string QW_Tool = "QW_Tool";
public const string ModelCode = "ModelCode";
public const string ModelName = "ModelName";
public const string Reverse = "Reverse";
public const string CurrJoint = "CurrJoint";
public const string MoveType = "MoveType";
public const string J1 = "J1";
public const string J2 = "J2";
public const string J3 = "J3";
public const string J4 = "J4";
public const string J5 = "J5";
public const string J6 = "J6";
}

View File

@@ -0,0 +1,23 @@
/// <summary>
/// CurrSignalList
/// 2021.10.10.LLX
/// </summary>
public class CurrSignalList
{
/// <summary>
/// TagID
/// </summary>
public string TagID
{
get;
set;
}
/// <summary>
/// TagValue
/// </summary>
public string TagValue
{
get;
set;
}
}

View File

@@ -0,0 +1,199 @@
using KinematicsBase;
/// <summary>
///
/// </summary>
public class Data_ClickModel
{
/// <summary>
///
/// </summary>
public DeviceType DeviceTypeCode
{
get;
set;
} = DeviceType.Device;
/// <summary>
///
/// </summary>
public string ModelCode
{
get;
set;
} = "";
/// <summary>
///
/// </summary>
public string ModelName
{
get;
set;
} = "";
/// <summary>
///
/// </summary>
public string ModelCodeBase
{
get;
set;
} = "";
/// <summary>
///
/// </summary>
public string ModelNameBase
{
get;
set;
} = "";
/// <summary>
///
/// </summary>
public string ModelCodeTool
{
get;
set;
} = "";
/// <summary>
///
/// </summary>
public string ModelNameTool
{
get;
set;
} = "";
/// <summary>
///
/// </summary>
public string ModelCodeTcp
{
get;
set;
} = "";
/// <summary>
///
/// </summary>
public string ModelNameTcp
{
get;
set;
} = "";
/// <summary>
///
/// </summary>
public Data_Position Position
{
get;
set;
} = new Data_Position();
/// <summary>
///
/// </summary>
public Data_Position Base
{
get;
set;
} = new Data_Position();
/// <summary>
///
/// </summary>
public Data_Position Tool
{
get;
set;
} = new Data_Position();
/// <summary>
///
/// </summary>
public Data_Position Tcp
{
get;
set;
} = new Data_Position();
}
/// <summary>
///
/// </summary>
public class Data_Position
{
/// <summary>
///
/// </summary>
public double tx
{
get;
set;
} = 0;
/// <summary>
///
/// </summary>
public double ty
{
get;
set;
} = 0;
/// <summary>
///
/// </summary>
public double tz
{
get;
set;
} = 0;
/// <summary>
///
/// </summary>
public double rx
{
get;
set;
} = 0;
/// <summary>
///
/// </summary>
public double ry
{
get;
set;
} = 0;
/// <summary>
///
/// </summary>
public double rz
{
get;
set;
} = 0;
/// <summary>
///
/// </summary>
public double qx
{
get;
set;
} = 0;
/// <summary>
///
/// </summary>
public double qy
{
get;
set;
} = 0;
/// <summary>
///
/// </summary>
public double qz
{
get;
set;
} = 0;
/// <summary>
///
/// </summary>
public double qw
{
get;
set;
} = 0;
}

View File

@@ -0,0 +1,84 @@
using KinematicsBase;
using System;
using System.Collections.Generic;
/// <summary>
///
/// </summary>
public class Data_RobotCurr
{
/// <summary>
///
/// </summary>
public string ModelCode
{
get;
set;
} = "";
/// <summary>
///
/// </summary>
public string ModelName
{
get;
set;
} = "";
public string TcpSelf
{
get;
set;
} = "";
public List<Data_CurrentJoint> CurrentJoint
{
get;
set;
} = new List<Data_CurrentJoint> ();
/// <summary>
///
/// </summary>
public Data_Position Base
{
get;
set;
} = new Data_Position();
/// <summary>
///
/// </summary>
public Data_Position Tool
{
get;
set;
} = new Data_Position();
/// <summary>
///
/// </summary>
public Data_Position Tcp
{
get;
set;
} = new Data_Position();
}
public class Data_CurrentJoint
{
public string JId
{
get;
set;
} = "";
public string JName
{
get;
set;
} = "";
public string JValue
{
get;
set;
} = "";
public string JType
{
get;
set;
} = "";
}

View File

@@ -0,0 +1,40 @@
/// <summary>
/// 设备工艺内容
/// 2021.12.15
/// </summary>
public class DeviceCraftData
{
public string ModelCode
{
get;
set;
}
public string AttitudeCode_From
{
get;
set;
}
public string AttitudeCode_To
{
get;
set;
}
public string AttitudeName_From
{
get;
set;
}
public string AttitudeName_To
{
get;
set;
}
public int KeepTime
{
get;
set;
}
}

View File

@@ -0,0 +1,165 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace DownLoadProgram
{
public class DownLoadRobotProgram
{
public string pathName { get; set; } = "";//CraftName
public string robotId { get; set; } = "";//ModelCode
public string robotName { get; set; } = "";//ModelName
public string robotType { get; set; } = "IRB6640";
public string rcsVersion { get; set; } = "IRC5";
public List<PathTag> tags { get; set; } = new List<PathTag>() { new PathTag(), new PathTag() };
}
public class PathTag
{
public string tagName { get; set; } = "";
public string tagId { get; set; } = "";
public string moveType { get; set; } = "MoveJ";
public string storageType { get; set; } = "PERS";
public TagLocationConf location { get; set; } = new TagLocationConf();
public TagJoint joint { get; set; } = new TagJoint();
public TagTool tool { get; set; } = new TagTool();
public TagSpeed speed { get; set; } = new TagSpeed();
public TagZone zone { get; set; } = new TagZone();
public Wobj wobj { get; set; } = new Wobj();
public List<String> olpCommand { get; set; } = new List<String>() { "WaitDI DI1,1", "SetDO DO1,1" };
}
public class TagLocationConf
{
public TagPosition position { get; set; } = new TagPosition();
public TagQuaternion quaternion { get; set; } = new TagQuaternion();
public List<String> robotConf { get; set; } = new List<String>() { "0", "0", "0", "0" };
}
public class TagLocation
{
public TagPosition position { get; set; } = new TagPosition();
public TagQuaternion quaternion { get; set; } = new TagQuaternion();
}
public class TagPosition
{
public string x { get; set; } = "0";
public string y { get; set; } = "0";
public string z { get; set; } = "0";
}
public class TagQuaternion
{
public string x { get; set; } = "0";
public string y { get; set; } = "0";
public string z { get; set; } = "0";
public string w { get; set; } = "1";
}
public class TagJoint
{
public List<String> robotJoint { get; set; } = new List<String>() { "0", "0", "0", "0", "0", "0" };
public List<String> externalJoint { get; set; } = new List<String>() { "9000000000", "9000000000", "9000000000", "9000000000", "9000000000", "9000000000" };
}
public class TagTool
{
public string toolId { get; set; } = Guid.NewGuid().ToString().ToUpper();
public string toolName { get; set; } = "t1";
public string robotHold { get; set; } = "1";
public string storageType { get; set; } = "PERS";
public TagLocation toolFrame { get; set; } = new TagLocation();
public TagLocation centerOfGravity { get; set; } = new TagLocation();
public LoadParameter loadParameter { get; set; } = new LoadParameter();
}
public class LoadParameter
{
public string mass { get; set; } = "0.001";
public string inertiaX { get; set; } = "0";
public string inertiaY { get; set; } = "0";
public string inertiaZ { get; set; } = "0";
}
public class TagSpeed
{
public string speedId { get; set; } = Guid.NewGuid().ToString().ToUpper();
public string speedName { get; set; } = "s1";
public string storageType { get; set; } = "CONST";
public string tcpSpeed { get; set; } = "5";
public string orientation { get; set; } = "500";
public string linearExternalAxis { get; set; } = "5000";
public string rotationalExternalAxis { get; set; } = "1000";
}
public class TagZone
{
public string zoneId { get; set; } = "";
public string zoneName { get; set; } = "z1";
public string storageType { get; set; } = "CONST";
public string finePoint { get; set; } = "0";
public TcpMovement tcpMovement { get; set; } = new TcpMovement();
public NoTcpMovement noTcpMovement { get; set; } = new NoTcpMovement();
}
public class TcpMovement
{
public string tcpPath { get; set; } = "50";
public string orientation { get; set; } = "75";
public string externalAxis { get; set; } = "75";
}
public class NoTcpMovement
{
public string orientation { get; set; } = "7.5";
public string linearExternalAxis { get; set; } = "75";
public string rotationalExternalAxis { get; set; } = "7.5";
}
public class Wobj
{
public string wobjId { get; set; } = "";
public string wobjName { get; set; } = "w1";
public string robotHold { get; set; } = "0";
public string userFrameProg { get; set; } = "1";
public string mechanicalUnit { get; set; } = "";
public string storageType { get; set; } = "PERS";
public TagLocation userFrame { get; set; } = new TagLocation();
public TagLocation objectFrame { get; set; } = new TagLocation();
}
}

View File

@@ -0,0 +1,16 @@
/// <summary>
///
/// </summary>
public enum EnumTagTypeID
{
Int16 = 2,
Int32 = 3,
Float = 4,
UInt64 = 7,
String = 8,
Bool = 11,
Byte = 17,
UInt16 = 18,
Double = 19,
}

View File

@@ -0,0 +1,2 @@
public delegate void GeneralFunction( double[] a, double[] b, double[] c);

View File

@@ -0,0 +1,192 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace KinematicsBase
{
#region BaseClass
/// <summary>
/// Clones the specified list.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="List">The list.</param>
/// <returns>List{``0}.</returns>
[Serializable]
public enum DeviceType
{
Default = 0,
Device = 1,
Robot = 2,
AGV = 3,
Gripper = 4,
Err = 1000
}
[Serializable]
/// <summary>
/// 接受选择的模型
/// </summary>
public class ModelSelect
{
public string ModelCode { get; set; }
public string ModelName { get; set; }
public string tx { get; set; }
public string ty { get; set; }
public string rx { get; set; }
public string ry { get; set; }
public string rz { get; set; }
public DeviceType DeviceTypeCode { get; set; }
}
[Serializable]
public enum AxisFlag
{
X,
Y,
Z
}
/// <summary>
/// 从一个姿态到另一个姿态是时间优先或速度有限
/// </summary>
[Serializable]
public enum MoveToPosePriorType
{
Time,
Velocity
}
[Serializable]
public class Position
{
public double X { set; get; }
public double Y { set; get; }
public double Z { set; get; }
}
[Serializable]
public class FixedAngle
{
public FixedAngle()
{
}
public double R { set; get; }
public double P { set; get; }
public double Y { set; get; }
}
/// <summary>
/// 运动约束单位矩阵
/// </summary>
[Serializable]
public class PositionNormalMatrix
{
public int x { set; get; }
public int y { set; get; }
public int z { set; get; }
public int rx { set; get; }
public int ry { set; get; }
public int rz { set; get; }
}
[Serializable]
public class Quaternion
{
public Quaternion()
{
}
public double X { set; get; }
public double Y { set; get; }
public double Z { set; get; }
public double W { set; get; }
}
[Serializable]
public class PositionFixedAngle
{
public PositionFixedAngle()
{
this.Position = new Position();
this.FixedAngle = new FixedAngle();
}
public Position Position { set; get; }
public FixedAngle FixedAngle { set; get; }
}
[Serializable]
public class PositionQuaternion
{
public PositionQuaternion()
{
this.Position = new Position();
this.Quaternion = new Quaternion();
}
public Position Position { set; get; }
public Quaternion Quaternion { set; get; }
}
[Serializable]
public class PositionQuaternionWithID : PositionQuaternion
{
public PositionQuaternionWithID()
{
this.UUID = "";
}
public string UUID { set; get; }
}
[Serializable]
public class Point
{
public Point()
{
}
public Point(double x, double y, double z)
{
this.X = x;
this.Y = y;
this.Z = z;
}
public double X { get; set; }
public double Y { get; set; }
public double Z { get; set; }
}
[Serializable]
public class Axis
{
public Axis()
{
this.Start = new Point();
this.End = new Point();
this.Flip = 0;
}
public Axis(Point start, Point end)
{
this.Start = start;
this.End = end;
this.Flip = 0;
}
public Point Start { get; set; }
public Point End { get; set; }
public AxisFlag AxisFlag { get; set; }
/// <summary>
/// 1.反向0.正常
/// </summary>
public int Flip { get; set; }
public PositionFixedAngle Loaction { get; set; }
public PositionQuaternion LoactionQuaternion { get; set; }
}
#endregion
}

View File

@@ -0,0 +1,9 @@
public enum KinematicsActionType
{
Add,
Update,
Remove,
ReceiveDevice,
Save
}

View File

@@ -0,0 +1,8 @@
public enum KinematicsPropertyType
{
Link,
Joint,
Pose,
Kinematics
}

View File

@@ -0,0 +1,596 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/// <summary>
///
/// </summary>
namespace LogicalBlock
{
/// <summary>
///
/// </summary>
public class LogicalBlockBasic
{
/// <summary>
/// 模型代码 或 工艺代码
/// </summary>
public string ResourcesCode
{
get;
set;
} = "";
/// <summary>
///
/// </summary>
public Type_Resources ResourcesType
{
get;
set;
} = Type_Resources.Model;
/// <summary>
///
/// </summary>
public string LogicalBlockCode
{
get;
set;
} = Guid.NewGuid().ToString().ToUpper();
/// <summary>
///
/// </summary>
public string LogicalBlockName
{
get;
set;
} = "空逻辑块";
/// <summary>
///
/// </summary>
public List<LogicalBlock_Input> List_LogicalBlock_Input
{
get;
set;
} = new List<LogicalBlock_Input>();
/// <summary>
///
/// </summary>
public List<LogicalBlock_Output> List_LogicalBlock_Output
{
get;
set;
} = new List<LogicalBlock_Output>();
/// <summary>
///
/// </summary>
public List<LogicalBlock_Param> List_LogicalBlock_Param
{
get;
set;
} = new List<LogicalBlock_Param>();
/// <summary>
///
/// </summary>
public List<LogicalBlock_Const> List_LogicalBlock_Const
{
get;
set;
} = new List<LogicalBlock_Const>();
/// <summary>
///
/// </summary>
public List<LogicalBlock_Operation> List_LogicalBlock_Operation
{
get;
set;
} = new List<LogicalBlock_Operation>();
/// <summary>
///
/// </summary>
public void GetConnectedSignalStr_Input()
{
foreach (LogicalBlock_Input logicalBlock_Input in List_LogicalBlock_Input)
{
var ConnectedSignal = logicalBlock_Input.ConnectedSignal;
logicalBlock_Input.ConnectedSignalStr = string.Join(", ", ConnectedSignal.Select(k => k.SignalName).ToArray());
}
}
/// <summary>
///
/// </summary>
public void GetConnectedSignalStr_Output()
{
foreach (LogicalBlock_Output logicalBlock_Output in List_LogicalBlock_Output)
{
var ConnectedSignal = logicalBlock_Output.ConnectedSignal;
logicalBlock_Output.ConnectedSignalStr = string.Join(", ", ConnectedSignal.Select(k => k.SignalName).ToArray());
}
}
}
/// <summary>
///
/// </summary>
public class LogicalBlock_Output : LogicalBlock_Input
{
/// <summary>
///
/// </summary>
public string ScriptText
{
get;
set;
}
}
/// <summary>
///
/// </summary>
public class LogicalBlock_Input
{
/// <summary>
///
/// </summary>
public string VarName
{
get;
set;
}
/// <summary>
///
/// </summary>
public Type_Signal VarType
{
get;
set;
}
/// <summary>
///
/// </summary>
public string ConnectedSignalStr
{
get;
set;
}
/// <summary>
///
/// </summary>
public List<LB_Device_Signal> ConnectedSignal
{
get;
set;
}
/// <summary>
///
/// </summary>
public string Explain
{
get;
set;
}
}
/// <summary>
///
/// </summary>
public class LogicalBlock_Param
{
/// <summary>
///
/// </summary>
public string VarName
{
get;
set;
}
/// <summary>
///
/// </summary>
public Type_Sensor SensorType
{
get;
set;
}
/// <summary>
///
/// </summary>
public string Explain
{
get;
set;
}
/// <summary>
///
/// </summary>
public string ScriptText
{
get;
set;
}
/// <summary>
/// 姿态代码,或者是位置数据代码等,即参数的代码。
/// </summary>
public string ParamCode
{
get;
set;
}
}
/// <summary>
///
/// </summary>
public class LogicalBlock_Const
{
/// <summary>
///
/// </summary>
public string VarName
{
get;
set;
}
/// <summary>
///
/// </summary>
public Type_Signal VarType
{
get;
set;
}
/// <summary>
///
/// </summary>
public string VarValue
{
get;
set;
}
/// <summary>
///
/// </summary>
public string Explain
{
get;
set;
}
}
/// <summary>
///
/// </summary>
public class LogicalBlock_Operation
{
/// <summary>
///
/// </summary>
public string OperationName
{
get;
set;
}
/// <summary>
///
/// </summary>
public Type_Operation ApplyType
{
get;
set;
}
/// <summary>
///
/// </summary>
public string ApplyToCode
{
get;
set;
}
/// <summary>
///
/// </summary>
public string ApplyToName
{
get;
set;
}
/// <summary>
///
/// </summary>
public string Explain
{
get;
set;
}
/// <summary>
///
/// </summary>
public string ScriptText
{
get;
set;
}
/// <summary>
///
/// </summary>
public string ScriptText_Speed
{
get;
set;
}
}
/// <summary>
///
/// </summary>
public class LB_Device_Signal
{
/// <summary>
///
/// </summary>
public string SignalCode
{
get;
set;
}
/// <summary>
///
/// </summary>
public string SignalName
{
get;
set;
}
/// <summary>
///
/// </summary>
public string SignalRegion
{
get;
set;
}
}
/// <summary>
/// 资源类型
/// </summary>
public enum Type_Resources
{
/// <summary>
/// 模型资源
/// </summary>
Model = 1,
/// <summary>
/// 工艺资源
/// </summary>
Craft = 2
}
/// <summary>
///
/// </summary>
public class JsSymbolTable
{
/// <summary>
///
/// </summary>
public string SymbolName
{
get;
set;
}
/// <summary>
///
/// </summary>
public string SymbolValue
{
get;
set;
}
}
/// <summary>
///
/// </summary>
public class ResourcesArithmeticUnit
{
/// <summary>
///
/// </summary>
public Dictionary<String, JsSymbolTable> DC_SignalCode_JsSymbolTable
{
get;
set;
}
/// <summary>
///
/// </summary>
public Dictionary<String, LogicalBlock_Param> DC_ParamCode_LogicalBlockParam
{
get;
set;
}
/// <summary>
///
/// </summary>
public Dictionary<String, String> DC_ParamName_ParamValue
{
get;
set;
}
}
/// <summary>
///
/// </summary>
public enum Type_Signal
{
/// <summary>
///
/// </summary>
BOOL = 1,
/// <summary>
///
/// </summary>
BYTE = 2,
/// <summary>
///
/// </summary>
WORD = 3,
/// <summary>
///
/// </summary>
DWORD = 4,
/// <summary>
///
/// </summary>
INT = 5,
/// <summary>
///
/// </summary>
DINT = 6,
/// <summary>
///
/// </summary>
REAL = 7,
/// <summary>
///
/// </summary>
LREAL = 8
}
/// <summary>
///
/// </summary>
public enum Type_Sensor
{
/// <summary>
///
/// </summary>
BOOL = 1,
/// <summary>
///
/// </summary>
BYTE = 2,
/// <summary>
///
/// </summary>
WORD = 3,
/// <summary>
///
/// </summary>
DWORD = 4,
/// <summary>
///
/// </summary>
INT = 5,
/// <summary>
///
/// </summary>
DINT = 6,
/// <summary>
///
/// </summary>
REAL = 7,
/// <summary>
///
/// </summary>
LREAL = 8,
/// <summary>
/// 关节值传感器(BOOL)
/// 姿态传感器
/// 2021.11.26.LLX
/// </summary>
JointValueSensor = 9,
/// <summary>
/// 关节距离传感器(REAL)
/// 2021.11.26.LLX
/// </summary>
JointDistanceSensor = 10,
/// <summary>
/// 关节运行中传感器(BOOL)
/// 2021.12.07.LLX
/// </summary>
JointRuningSensor = 11,
/// <summary>
/// 位置传感器
/// 2021.11.26.LLX
/// </summary>
PositionSensor = 12
}
/// <summary>
///
/// </summary>
public enum Type_Operation
{
/// <summary>
/// BOOL
/// </summary>
MoveToAttitude = 1,
/// <summary>
/// BOOL
/// </summary>
JumpToAttitude = 2,
/// <summary>
/// REAL
/// </summary>
MoveToJoint = 3,
/// <summary>
/// BOOL
/// </summary>
CraftInvoke = 4,
/// <summary>
/// BOOL
/// </summary>
Visible = 5,
/// <summary>
/// BOOL
/// </summary>
Rotation = 6,
/// <summary>
/// BOOL
/// </summary>
Attach = 7
}
/// <summary>
///
/// </summary>
public struct SensorParamChangedParam
{
/// <summary>
/// 资源代码
/// </summary>
public string ResourcesCode
{
get;
set;
}
/// <summary>
/// 姿态代码,或轴数据等代码
/// 传感器代码
/// </summary>
public string ParamCode
{
get;
set;
}
/// <summary>
/// 传感器值发生变化
/// </summary>
public string ChangedValue
{
get;
set;
}
}
}

View File

@@ -0,0 +1,21 @@
/// <summary>
/// 全局运行模式
/// 2021.12.3.LLX
/// </summary>
public enum Mode_Run
{
/// <summary>
/// 仿真模式
/// </summary>
Simulation = 1,
/// <summary>
/// 虚拟调试模式
/// </summary>
VirtualCommissioning = 2,
/// <summary>
/// 数字孪生模式
/// </summary>
DigitaTwin = 3
}

View File

@@ -0,0 +1,164 @@
/// <summary>
/// 模型属性
/// 2021.4.2,修改
/// </summary>
//[System.Serializable]
public class ModelAttribute
{
/// <summary>
///ModelCode
/// </summary>
public string ModelCode
{
get;
set;
}
/// <summary>
/// ModelTypeCode
/// </summary>
public string ModelTypeCode
{
get;
set;
}
/// <summary>
///ModelName
/// </summary>
public string ModelName
{
get;
set;
}
/// <summary>
/// DeviceTypeCode
/// </summary>
public int DeviceTypeCode
{
get;
set;
}
/// <summary>
/// DeviceTypeName
/// </summary>
public string DeviceTypeName
{
get;
set;
}
/// <summary>
/// 完整的Urdf文件内容
/// 2021.5.10
/// </summary>
public string UrdfContent
{
get;
set;
}
/// <summary>
/// 运动学
/// 2021.12.22.LLX
/// KinematicsData
/// </summary>
public KinematicsBase.Kinematics KinematicsData
{
get;
set;
} = null;
public CurrModelPosition Position
{
get;
set;
} = null;
}
/// <summary>
///
/// </summary>
public class CurrModelPosition
{
/// <summary>
///
/// </summary>
public double tx
{
get;
set;
}
/// <summary>
///
/// </summary>
public double ty
{
get;
set;
}
/// <summary>
///
/// </summary>
public double tz
{
get;
set;
}
/// <summary>
///
/// </summary>
public double rx
{
get;
set;
}
/// <summary>
///
/// </summary>
public double ry
{
get;
set;
}
/// <summary>
///
/// </summary>
public double rz
{
get;
set;
}
/// <summary>
///
/// </summary>
public double qx
{
get;
set;
}
/// <summary>
///
/// </summary>
public double qy
{
get;
set;
}
/// <summary>
///
/// </summary>
public double qz
{
get;
set;
}
/// <summary>
///
/// </summary>
public double qw
{
get;
set;
}
}

View File

@@ -0,0 +1,24 @@
/// <summary>
/// 模型组
/// 2022.01.05
/// </summary>
public class ModelGroup
{
/// <summary>
/// 模型代码
/// </summary>
public string ModelCode
{
get;
set;
}
/// <summary>
/// 模型名称
/// </summary>
public string ModelName
{
get;
set;
}
}

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
/// <summary>
/// 模型名称数据
/// </summary>
public class ModelNameData
{
/// <summary>
/// 模型名称数据
/// </summary>
/// <param name="modelName"></param>
/// <param name="progressNum"></param>
/// <param name="visible"></param>
public ModelNameData(string modelName, double progressNum, int visible)
{
this.ModelName = modelName;
this.ProgressNum = progressNum;
this.Visible = visible;
}
/// <summary>
/// 模型名称
/// </summary>
public string ModelName { get; set; }
/// <summary>
/// 进度条
/// </summary>
public double ProgressNum { get; set; }
/// <summary>
/// 可见性
/// </summary>
public int Visible { get; set; }
}

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
/// <summary>
/// 模型可见
/// </summary>
public class ModelNameVisible
{
/// <summary>
/// 模型名称数据
/// </summary>
/// <param name="modelName"></param>
/// <param name="progressNum"></param>
/// <param name="visible"></param>
public ModelNameVisible(int modelCode, int modelTypeCode, string modelName, int visible)
{
this.ModelCode = modelCode;
this.ModelTypeCode = modelTypeCode;
this.ModelName = modelName;
this.Visible = visible;
}
/// <summary>
/// 模型代码
/// </summary>
public int ModelCode { get; set; }
/// <summary>
/// 父节点代码
/// </summary>
public int ModelTypeCode { get; set; }
/// <summary>
/// 模型名称
/// </summary>
public string ModelName { get; set; }
/// <summary>
/// 可见性
/// </summary>
public int Visible { get; set; }
}

View File

@@ -0,0 +1,312 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
/// <summary>
///
/// </summary>
[Serializable]
public class ModelProcess
{
/// <summary>
///
/// </summary>
public string ProcessCode
{
get;
set;
}
/// <summary>
///
/// </summary>
public string SequenceNo
{
get;
set;
}
/// <summary>
///
/// </summary>
public string ProcessName
{
get;
set;
}
/// <summary>
///
/// </summary>
public string UseTime
{
get;
set;
}
/// <summary>
///
/// </summary>
public string X
{
get;
set;
}
/// <summary>
///
/// </summary>
public string Y
{
get;
set;
}
/// <summary>
///
/// </summary>
public string Z
{
get;
set;
}
/// <summary>
///
/// </summary>
public string RX
{
get;
set;
}
/// <summary>
///
/// </summary>
public string RY
{
get;
set;
}
/// <summary>
///
/// </summary>
public string RZ
{
get;
set;
}
/// <summary>
///
/// </summary>
public string X_Base
{
get;
set;
}
/// <summary>
///
/// </summary>
public string Y_Base
{
get;
set;
}
/// <summary>
///
/// </summary>
public string Z_Base
{
get;
set;
}
/// <summary>
///
/// </summary>
public string RX_Base
{
get;
set;
}
/// <summary>
///
/// </summary>
public string RY_Base
{
get;
set;
}
/// <summary>
///
/// </summary>
public string RZ_Base
{
get;
set;
}
/// <summary>
///
/// </summary>
public string X_Tool
{
get;
set;
}
/// <summary>
///
/// </summary>
public string Y_Tool
{
get;
set;
}
/// <summary>
///
/// </summary>
public string Z_Tool
{
get;
set;
}
/// <summary>
///
/// </summary>
public string RX_Tool
{
get;
set;
}
/// <summary>
///
/// </summary>
public string RY_Tool
{
get;
set;
}
/// <summary>
///
/// </summary>
public string RZ_Tool
{
get;
set;
}
/// <summary>
///
/// </summary>
public string QX
{
get;
set;
}
/// <summary>
///
/// </summary>
public string QY
{
get;
set;
}
/// <summary>
///
/// </summary>
public string QZ
{
get;
set;
}
/// <summary>
///
/// </summary>
public string QW
{
get;
set;
}
/// <summary>
///
/// </summary>
public string QX_Base
{
get;
set;
}
/// <summary>
///
/// </summary>
public string QY_Base
{
get;
set;
}
/// <summary>
///
/// </summary>
public string QZ_Base
{
get;
set;
}
/// <summary>
///
/// </summary>
public string QW_Base
{
get;
set;
}
/// <summary>
///
/// </summary>
public string QX_Tool
{
get;
set;
}
/// <summary>
///
/// </summary>
public string QY_Tool
{
get;
set;
}
/// <summary>
///
/// </summary>
public string QZ_Tool
{
get;
set;
}
/// <summary>
///
/// </summary>
public string QW_Tool
{
get;
set;
}
/// <summary>
///
/// </summary>
public string ModelName
{
get;
set;
}
/// <summary>
///
/// </summary>
public string ModelCode
{
get;
set;
}
}

View File

@@ -0,0 +1,281 @@
using System.Collections.Generic;
/// <summary>
/// 项目帧
/// </summary>
public class P_OPERATION
{
/// <summary>
/// 一组项目帧
/// </summary>
public C_OPERATION OPERATION
{
set;
get;
} = new C_OPERATION();
}
/// <summary>
/// 帧集合
/// </summary>
public class C_OPERATION
{
/// <summary>
/// 帧集合
/// </summary>
public List<C_Frames> frames
{
set;
get;
} = new List<C_Frames>();
}
/// <summary>
/// 帧
/// </summary>
public class C_Frames
{
/// <summary>
/// 帧
/// </summary>
public string time
{
set;
get;
} = "0.01";
/// <summary>
/// 帧内容集合
/// </summary>
public List<C_ObjStates> objStates
{
set;
get;
} = new List<C_ObjStates>();
public List<C_Craft> crafts
{
set;
get;
} = new List<C_Craft>();
public List<C_Signalwrite> signalwrites
{
set;
get;
} = new List<C_Signalwrite>();
public List<C_Visible> visibles
{
set;
get;
} = new List<C_Visible>();
public List<C_Rotation> rotations
{
set;
get;
} = new List<C_Rotation>();
public List<C_Wait> waits
{
set;
get;
} = new List<C_Wait>();
public List<C_Attach> attachs
{
set;
get;
} = new List<C_Attach>();
}
/// <summary>
/// 帧内容
/// </summary>
public class C_ObjStates
{
/// <summary>
/// 模型代码
/// </summary>
public string i
{
set;
get;
} = "";
/// <summary>
/// tx
/// </summary>
public string tx
{
set;
get;
} = "";
/// <summary>
/// ty
/// </summary>
public string ty
{
set;
get;
} = "";
/// <summary>
/// tz
/// </summary>
public string tz
{
set;
get;
} = "";
/// <summary>
/// qx
/// </summary>
public string qx
{
set;
get;
} = "";
/// <summary>
/// qy
/// </summary>
public string qy
{
set;
get;
} = "";
/// <summary>
/// qz
/// </summary>
public string qz
{
set;
get;
} = "";
/// <summary>
/// qw
/// </summary>
public string qw
{
set;
get;
} = "";
}
/// <summary>
///
/// </summary>
public class C_Craft
{
public string CraftCode
{
get;
set;
}
public string CraftValue
{
get;
set;
}
}
/// <summary>
/// 帧信号
/// </summary>
public class C_Signalwrite
{
/// <summary>
/// TagID
/// </summary>
public string TagID
{
get;
set;
}
/// <summary>
/// TagValue
/// </summary>
public string TagValue
{
get;
set;
}
}
/// <summary>
///
/// </summary>
public class C_Visible
{
public string ModelCode
{
get;
set;
}
public string Visible
{
get;
set;
}
}
public class C_Rotation
{
public string ModelCode
{
get;
set;
}
public string Axis
{
get;
set;
}
public int Rate
{
get;
set;
}
}
public class C_Wait
{
public string WaitStr
{
get;
set;
}
}
public class C_Attach
{
/// <summary>
///
/// </summary>
public string AttachToModelCode
{
get;
set;
} = "";
public string AttachToModelName
{
get;
set;
} = "";
/// <summary>
///
/// </summary>
public List<ModelGroup> List_AttachModel
{
get;
set;
} = new List<ModelGroup>();
/// <summary>
///
/// </summary>
public bool IsTwoWay
{
get;
set;
} = false;
/// <summary>
///
/// </summary>
public bool IsAttach
{
get;
set;
} = false;
}

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
public class OperateResult
{
/// <summary>
/// 实例化一个默认的结果对象
/// </summary>
public OperateResult()
{
}
/// <summary>
/// 使用指定的消息实例化一个默认的结果对象
/// </summary>
/// <param name="msg">错误消息</param>
public OperateResult(string msg)
{
this.Message = msg;
}
/// <summary>
/// 使用错误代码,消息文本来实例化对象
/// </summary>
/// <param name="err">错误代码</param>
/// <param name="msg">错误消息</param>
public OperateResult(int err, string msg)
{
this.ErrorCode = err;
this.Message = msg;
}
/// <summary>
/// 指示本次访问是否成功
/// </summary>
public bool IsSuccess
{
get;
set;
} = false;
/// <summary>
/// 具体的错误描述
/// </summary>
public string Message
{
get;
set;
} = "";
/// <summary>
/// 具体的错误代码
/// </summary>
public int ErrorCode
{
get;
set;
} = 10000;
}

View File

@@ -0,0 +1,734 @@
using System;
/// <summary>
/// 操作结果
/// </summary>
/// <typeparam name="T1"></typeparam>
/// <typeparam name="T2"></typeparam>
/// <typeparam name="T3"></typeparam>
public class OperationResult<T1, T2, T3> : OperateResult
{
/// <summary>
/// T1
/// </summary>
public T1 PlayIDList
{
get;
set;
}
/// <summary>
/// T2
/// </summary>
public T2 PlayName
{
get;
set;
}
/// <summary>
/// T3
/// </summary>
public T3 ModelName
{
get;
set;
}
}
/// <summary>
/// 操作结果
/// </summary>
/// <typeparam name="T1"></typeparam>
/// <typeparam name="T2"></typeparam>
public class OperationResult<T1, T2> : OperateResult
{
/// <summary>
/// T
/// </summary>
public T1 t1
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T2 t2
{
get;
set;
}
}
public class OperationResultMesDtSim<T1, T2, T3, T4,T5,T6> : OperateResult
{
/// <summary>
/// T1
/// </summary>
public T1 PlayIDList
{
get;
set;
}
/// <summary>
/// T2
/// </summary>
public T2 PlayName
{
get;
set;
}
/// <summary>
/// T3
/// </summary>
public T3 ModelName
{
get;
set;
}
/// <summary>
/// 1 : From DT
/// 2: From MisData
/// </summary>
public T4 TagFrom
{
get;
set;
}
public T5 OpName
{
get;
set;
}
public T6 TagIDCopyFrom
{
get;
set;
}
}
///// <summary>
///// 操作结果
///// </summary>
///// <typeparam name="T1"></typeparam>
///// <typeparam name="T2"></typeparam>
///// <typeparam name="T3"></typeparam>
///// <typeparam name="T4"></typeparam>
//public class OperationResult<T1, T2, T3, T4> : OperateResult
//{
// /// <summary>
// /// T
// /// </summary>
// public T1 t1
// {
// get;
// set;
// }
// /// <summary>
// /// T
// /// </summary>
// public T2 t2
// {
// get;
// set;
// }
// /// <summary>
// /// T
// /// </summary>
// public T3 t3
// {
// get;
// set;
// }
// /// <summary>
// /// T
// /// </summary>
// public T4 t4
// {
// get;
// set;
// }
//}
/// <summary>
/// 操作结果
/// </summary>
/// <typeparam name="T1"></typeparam>
/// <typeparam name="T2"></typeparam>
/// <typeparam name="T3"></typeparam>
/// <typeparam name="T4"></typeparam>
/// <typeparam name="T5"></typeparam>
public class OperationResult<T1, T2, T3, T4, T5> : OperateResult
{
/// <summary>
/// T
/// </summary>
public T1 t1
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T2 t2
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T3 t3
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T4 t4
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T5 t5
{
get;
set;
}
}
/// <summary>
/// 操作结果
/// </summary>
/// <typeparam name="T1"></typeparam>
/// <typeparam name="T2"></typeparam>
/// <typeparam name="T3"></typeparam>
/// <typeparam name="T4"></typeparam>
/// <typeparam name="T5"></typeparam>
/// <typeparam name="T6"></typeparam>
public class OperationResult<T1, T2, T3, T4, T5, T6> : OperateResult
{
/// <summary>
/// T
/// </summary>
public T1 ID
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T2 TagID
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T3 TagValue
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T4 ModelCode
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T5 Visible
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T6 ModelName
{
get;
set;
}
}
/// <summary>
/// 操作结果
/// </summary>
/// <typeparam name="T1"></typeparam>
/// <typeparam name="T2"></typeparam>
/// <typeparam name="T3"></typeparam>
/// <typeparam name="T4"></typeparam>
/// <typeparam name="T5"></typeparam>
/// <typeparam name="T6"></typeparam>
public class OperationResultAct<T1, T2, T3, T4, T5, T6> : OperateResult
{
/// <summary>
/// T
/// </summary>
public T1 t1
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T2 t2
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T3 t3
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T4 t4
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T5 t5
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T6 t6
{
get;
set;
}
}
/// <summary>
/// 操作结果
/// </summary>
/// <typeparam name="T1"></typeparam>
/// <typeparam name="T2"></typeparam>
/// <typeparam name="T3"></typeparam>
/// <typeparam name="T4"></typeparam>
/// <typeparam name="T5"></typeparam>
/// <typeparam name="T6"></typeparam>
/// <typeparam name="T7"></typeparam>
public class OperationResult<T1, T2, T3, T4, T5, T6, T7> : OperateResult
{
/// <summary>
/// T
/// </summary>
public T1 ID
{
get;
set;
}
public T2 HandlerType
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T3 TagID
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T4 TagValue
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T5 HandlerCode
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T6 HandlerValue
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T7 HandlerName
{
get;
set;
}
}
/// <summary>
/// 操作结果
/// </summary>
/// <typeparam name="T1"></typeparam>
/// <typeparam name="T2"></typeparam>
/// <typeparam name="T3"></typeparam>
/// <typeparam name="T4"></typeparam>
/// <typeparam name="T5"></typeparam>
/// <typeparam name="T6"></typeparam>
/// <typeparam name="T7"></typeparam>
/// <typeparam name="T8"></typeparam>
public class OperationResult<T1, T2, T3, T4, T5, T6, T7, T8> : OperateResult
{
/// <summary>
/// T
/// </summary>
public T1 t1
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T2 t2
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T3 t3
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T4 t4
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T5 t5
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T6 t6
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T7 t7
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T8 t8
{
get;
set;
}
}
/// <summary>
/// 操作结果
/// </summary>
/// <typeparam name="T1"></typeparam>
/// <typeparam name="T2"></typeparam>
/// <typeparam name="T3"></typeparam>
/// <typeparam name="T4"></typeparam>
/// <typeparam name="T5"></typeparam>
/// <typeparam name="T6"></typeparam>
/// <typeparam name="T7"></typeparam>
/// <typeparam name="T8"></typeparam>
/// <typeparam name="T9"></typeparam>
public class OperationResult<T1, T2, T3, T4, T5, T6, T7, T8, T9> : OperateResult
{
/// <summary>
/// T
/// </summary>
public T1 t1
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T2 t2
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T3 t3
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T4 t4
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T5 t5
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T6 t6
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T7 t7
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T8 t8
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T9 t9
{
get;
set;
}
}
/// <summary>
/// 工艺的帧数据
/// 2021.1.28
/// 修改
/// </summary>
/// <typeparam name="T1"></typeparam>
/// <typeparam name="T2"></typeparam>
/// <typeparam name="T3"></typeparam>
/// <typeparam name="T4"></typeparam>
[Serializable]
public class FrameD<T1, T2, T3, T4>
{
/// <summary>
/// T1
/// </summary>
public T1 StartFrame
{
get;
set;
}
/// <summary>
/// T2
/// </summary>
public T2 Data
{
get;
set;
}
/// <summary>
/// T4
/// </summary>
public T3 ModelCode
{
get;
set;
}
/// <summary>
/// T5
/// </summary>
public T4 CraftCode
{
get;
set;
}
}
/// <summary>
///
/// 2021.2.19
/// </summary>
/// <typeparam name="T1"></typeparam>
/// <typeparam name="T2"></typeparam>
/// <typeparam name="T3"></typeparam>
[Serializable]
public class FrameData<T1, T2, T3>
{
/// <summary>
/// T1
/// </summary>
public T1 StartFrame
{
get;
set;
}
/// <summary>
/// T2
/// </summary>
public T2 Data
{
get;
set;
}
/// <summary>
/// T3
/// </summary>
public T3 CraftCode
{
get;
set;
}
}
/// <summary>
/// OperationResultActPlay
/// </summary>
/// <typeparam name="T1"></typeparam>
/// <typeparam name="T2"></typeparam>
/// <typeparam name="T3"></typeparam>
/// <typeparam name="T4"></typeparam>
/// <typeparam name="T5"></typeparam>
/// <typeparam name="T6"></typeparam>
public class OperationResultActPlay<T1, T2, T3, T4, T5, T6, T7> : OperateResult
{
/// <summary>
/// T
/// </summary>
public T1 t1
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T2 t2
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T3 t3
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T4 t4
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T5 t5
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T6 t6
{
get;
set;
}
/// <summary>
/// T
/// </summary>
public T7 t7
{
get;
set;
}
}

View File

@@ -0,0 +1,65 @@
/// <summary>
/// 播放传递的参数
/// 2021.3.29
/// </summary>
public struct PlayTransmitParam
{
/// <summary>
/// 工艺代码
/// </summary>
public int CraftCode
{
get;
set;
}
/// <summary>
/// 模型代码
/// </summary>
public int ModelCode
{
get;
set;
}
/// <summary>
/// 基座标组
/// </summary>
public System.Collections.Generic.List<double[]> List_BaseQ
{
get;
set;
}
/// <summary>
/// 工具坐标组
/// </summary>
public System.Collections.Generic.List<double[]> List_ToolQ
{
get;
set;
}
/// <summary>
/// 位置点坐标组
/// </summary>
public System.Collections.Generic.List<double[]> List_PtQ
{
get;
set;
}
/// <summary>
/// 使用时间组
/// </summary>
public System.Collections.Generic.List<System.Int32> List_UseTime
{
get;
set;
}
/// <summary>
/// 当前工艺所有工序离散结果
/// </summary>
public System.Collections.Generic.List<double[]> List_PtQ_All
{
get;
set;
}
}

View File

@@ -0,0 +1 @@
public delegate void ErrInfoHandler<T>(T t);

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
/// <summary>
/// 执行脚本
/// 排队参数
/// 2021.11.25.LLX
/// </summary>
public struct QueueExecScriptParam
{
/// <summary>
/// 产生变化的信号代码
/// </summary>
public string ChangedTagID;
/// <summary>
/// 产生变化的信号值
/// </summary>
public string ChangedTagValue;
/// <summary>
/// 信号表
/// </summary>
public Dictionary<String, String> DC_TagID_PlcValue;
/// <summary>
/// 资源代码
/// 模型代码 或 工艺代码
/// </summary>
public string ResourcesCode;
}

View File

@@ -0,0 +1,3 @@
public delegate void ShowMainProgress(int c);
public delegate void ShowMainProgressCountPer(string countPer,int c);
public delegate void HideMainProgress(int delayTime);

View File

@@ -0,0 +1 @@
public delegate void ShowMainProgressSet(string o, int m);

View File

@@ -0,0 +1 @@
public delegate void Func(string t, string i, string v,string a);

View File

@@ -0,0 +1,78 @@
/// <summary>
///
/// </summary>
public class TagContent
{
//[ID],[TagID],[Value],[OperationTime]
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <param name="opName"></param>
/// <param name="tagID"></param>
/// <param name="tagValue"></param>
/// <param name="operationTime"></param>
/// <param name="directData"></param>
public TagContent(string id, string opName, string tagID, string tagValue, long operationTime, string directData)
{
ID = id;
OpName = opName;
TagID = tagID;
TagValue = tagValue;
OperationTime = operationTime;
DirectData = directData;
}
/// <summary>
///
/// </summary>
public string ID
{
get;
set;
}
/// <summary>
///
/// </summary>
public string OpName
{
get;
set;
}
/// <summary>
///
/// </summary>
public string TagID
{
get;
set;
}
/// <summary>
///
/// </summary>
public string TagValue
{
get;
set;
}
/// <summary>
///
/// </summary>
public long OperationTime
{
get;
set;
}
/// <summary>
///
/// </summary>
public string DirectData
{
get;
set;
}
}

View File

@@ -0,0 +1,88 @@
/// <summary>
/// TagID绑定的处理
/// </summary>
public class TagTriggerHandler
{
/// <summary>
/// 执行类型
/// </summary>
public string HandlerType
{
get;
set;
} = "";
/// <summary>
/// TagID
/// </summary>
public string TagID
{
get;
set;
} = "";
/// <summary>
/// TagValue
/// </summary>
public string TagValue
{
get;
set;
} = "";
/// <summary>
/// 处理代码
/// </summary>
public string HandlerCode
{
get;
set;
} = "";
/// <summary>
/// 处理值
/// </summary>
public string HandlerValue
{
get;
set;
} = "";
/// <summary>
/// 关节运动类型
/// </summary>
public string JointType
{
get;
set;
} = "";
/// <summary>
/// 轴
/// </summary>
public string Axis
{
get;
set;
} = "";
/// <summary>
/// 轴运动方向
/// </summary>
public int Flip
{
get;
set;
} = 1;
/// <summary>
/// 值位置初始值
/// </summary>
public double Value
{
get;
set;
} = 0;
/// <summary>
/// 轴比率
/// </summary>
public double ValueFactor
{
get;
set;
} = 1;
}

View File

@@ -0,0 +1,27 @@
/// <summary>
/// 2020.10.17 ,llx , 工艺类型驱动代码
/// 2021.02.23 ,llx , 工艺类型驱动代码,修改
/// </summary>
public enum Type_Craft
{
/// <summary>
/// 非仿真操作
/// </summary>
UnSim = 1,
/// <summary>
/// 通用机器人操作
/// </summary>
Robot_Currency = 2,
/// <summary>
/// 设备操作
/// </summary>
Device = 3,
/// <summary>
/// 线性流操作
/// </summary>
LinearFlow = 4,
/// <summary>
/// 外部的设备实际位置时刻数据
/// </summary>
Device_Import = 5
}

View File

@@ -0,0 +1,24 @@
/// <summary>
/// 2021.6.18
/// 2021.11.17.LLX
/// </summary>
public class Type_Device
{
/// <summary>
/// Connect
/// </summary>
public const string Connect = "Connect";
/// <summary>
/// Signal
/// </summary>
public const string Signal = "Signal";
/// <summary>
/// ConnectRobot
/// </summary>
public const string ConnectRobot = "ConnectRobot";
/// <summary>
/// SignalRobot
/// </summary>
public const string SignalRobot = "SignalRobot";
}

View File

@@ -0,0 +1,32 @@
/// <summary>
/// 设备信号仿真树
/// 2021.6.21
/// </summary>
public class Type_DeviceSignalSimTree
{
/// <summary>
///
/// </summary>
public const string Plant = "Plant";
/// <summary>
///
/// </summary>
public const string Zone = "Zone";
/// <summary>
///
/// </summary>
public const string Line = "Line";
/// <summary>
///
/// </summary>
public const string Station = "Station";
/// <summary>
///
/// </summary>
public const string Group = "Group";
/// <summary>
///
/// </summary>
public const string Signal = "Signal";
}

View File

@@ -0,0 +1,24 @@
/// <summary>
/// 生成信号的类型
/// 2021.9.11
/// </summary>
public enum Type_GenerateSignal
{
/// <summary>
/// 虚拟调试
/// 2021.9.11
/// </summary>
VirtualDebug = 1,
/// <summary>
/// 数字孪生
/// 2021.9.11
/// </summary>
DigitalTwin = 2,
/// <summary>
/// 仅回写信号
/// 2021.10.7
/// </summary>
OnlyWrite = 3
}

View File

@@ -0,0 +1,19 @@
/// <summary>
/// 系统权限
/// 2022.01.19.LLX
/// </summary>
public enum Type_Jurisdiction
{
/// <summary>
/// 未知用户
/// </summary>
Unknown = 0,
/// <summary>
/// 管理员
/// </summary>
Administrator = 1,
/// <summary>
/// 用户
/// </summary>
User = 2
}

View File

@@ -0,0 +1,24 @@
/// <summary>
/// 操作的指令
/// 2021.11.16.LLX
/// </summary>
public enum OperationCmd
{
/// <summary>
/// 1.
/// </summarInserty>
Insert = 1,
/// <summary>
/// 2.Update
/// </summary>
Update = 2,
/// <summary>
/// 3.Delete
/// </summary>
Delete = 3,
/// <summary>
/// 4.Select
/// </summary>
Select = 4
}

View File

@@ -0,0 +1,32 @@
/// <summary>
/// 操作树
/// 2021.6.21
/// </summary>
public class Type_OperationTree
{
/// <summary>
///
/// </summary>
public const string Plant = "Plant";
/// <summary>
///
/// </summary>
public const string Zone = "Zone";
/// <summary>
///
/// </summary>
public const string Line = "Line";
/// <summary>
///
/// </summary>
public const string Station = "Station";
/// <summary>
///
/// </summary>
public const string Group = "Group";
/// <summary>
///
/// </summary>
public const string Craft = "Craft";
}

View File

@@ -0,0 +1,43 @@
/// <summary>
///
/// </summary>
public enum Type_Signal_Raw
{
/// <summary>
///
/// </summary>
INT16 = 2,
/// <summary>
///
/// </summary>
INT32 = 3,
/// <summary>
///
/// </summary>
FLOAT = 4,
/// <summary>
///
/// </summary>
UINT64 = 7,
/// <summary>
///
/// </summary>
STRING = 8,
/// <summary>
///
/// </summary>
BOOL = 11,
/// <summary>
///
/// </summary>
BYTE = 17,
/// <summary>
///
/// </summary>
UINT16 = 18,
/// <summary>
///
/// </summary>
DOUBLE = 19
}

View File

@@ -0,0 +1,33 @@
/// <summary>
/// 2020.9.23 ,llx , TagIdHandlerO
/// 2021.2.23 ,llx , TagIdHandlerO,修改
/// 2021.10.11.2350.LLX
/// </summary>
public class Type_TagIDHandler
{
/// <summary>
/// 1
/// </summary>
public const string Visible = "visible";
/// <summary>
/// 2
/// </summary>
public const string Rotation = "rotation";
/// <summary>
/// 3
/// </summary>
public const string Craft = "craft";
/// <summary>
/// 4
/// </summary>
public const string TargetLocation = "targetlocation";
/// <summary>
/// 5
/// </summary>
public const string Attach = "attach";
/// <summary>
/// 6
/// </summary>
public const string Warning = "warning";
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
public struct UseTriggerPlayParameter
{
public string ActCode { get; set; }
public int MaxRunFrame { get; set; }
public List<OperationResultActPlay<String, String, Int32, Int32, Int32, DataTable, String>> List_CraftAlign { get; set; }
public List<ActPlayModelVisibleAndRotation> List_CraftAlign_ModelVisibleAndRotation { get; set; }
}

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ModelBasic
{
public interface IErrHandler <T>
{
/// <summary>
///
/// </summary>
/// <param name="f"></param>
void ErrInfoTransmit_Give(ErrInfoHandler<String> f);
/// <summary>
///
/// </summary>
/// <param name="s"></param>
void ErrInfoTransmit(string s)
;
/// <summary>
///
/// </summary>
/// <returns></returns>
bool ErrInfoTransmit_IsNull()
;
}
public class U<T>
{
}
}

View File

@@ -0,0 +1,218 @@
using DTTest;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/// <summary>
///
/// </summary>
namespace Global
{
/// <summary>
///
/// </summary>
public interface IGlobalVar
{
/// <summary>
/// 工艺树刷新
/// </summary>
void RefreshCraftTree();
/// <summary>
/// 传递工艺组
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
void TransmitCraftGroup(string craftName, string craftCode);
/// <summary>
/// 传递模型名
/// </summary>
/// <param name="modelName"></param>
/// <param name="modelCode"></param>
void TransmitModelName(string modelName, string modelCode);
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
void TransmitCraftGroup_UnSim(string craftName, string craftCode);
/// <summary>
/// (位置控制器)关闭
/// </summary>
void CloseSeatOperationForm();
/// <summary>
/// (位置控制器)选择模型发送消息
/// </summary>
/// <param name="modelName"></param>
void CurrTreeSelectModelHandler_SeatOperation(string modelCode, string modelName);
/// <summary>
/// 传递逻辑脚本名称
/// </summary>
/// <param name="modelName"></param>
void TransitionEditorPageScriptNameUpdate(string internalVarCode, string internalVarName);
/// <summary>
/// 工艺树刷新 赋予
/// </summary>
void RefreshCraftTree_Give(Action f);
/// <summary>
/// 传递工艺组 赋予
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
void TransmitCraftGroup_Give(Func<String, String, bool> f);
/// <summary>
/// 传递模型名 赋予
/// </summary>
/// <param name="modelName"></param>
/// <param name="modelCode"></param>
void TransmitModelName_Give(Func<String, String, bool> f);
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递 赋予
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
void TransmitCraftGroup_UnSim_Give(Func<String, String, bool> f);
/// <summary>
/// (位置控制器)关闭 赋予
/// </summary>
void CloseSeatOperationForm_Give(Func<bool> f);
/// <summary>
/// (位置控制器)选择模型发送消息 赋予
/// </summary>
/// <param name="modelName"></param>
void CurrTreeSelectModelHandler_SeatOperation_Give(Func<String, String, bool> f);
/// <summary>
/// 传递逻辑脚本名称 赋予
/// </summary>
/// <param name="f"></param>
void TransitionEditorPageScriptNameUpdate_Give(Func<String, String, bool> f);
/// <summary>
/// 工艺树刷新 判断
/// </summary>
bool RefreshCraftTree_IsNull();
/// <summary>
/// 传递工艺组 判断
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
bool TransmitCraftGroup_IsNull();
/// <summary>
/// 传递模型名 判断
/// </summary>
/// <param name="modelName"></param>
/// <param name="modelCode"></param>
bool TransmitModelName_IsNull();
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递 判断
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
bool TransmitCraftGroup_UnSim_IsNull();
/// <summary>
/// (位置控制器)关闭 判断
/// </summary>
bool CloseSeatOperationForm_IsNull();
/// <summary>
/// (位置控制器)传递位置信息 判断
/// </summary>
/// <param name="e"></param>
bool CurrPostionInfoHandler_SeatOperation_IsNull();
/// <summary>
/// (位置控制器)选择模型发送消息 判断
/// </summary>
/// <param name="modelName"></param>
bool CurrTreeSelectModelHandler_SeatOperation_IsNull();
/// <summary>
/// 传递逻辑脚本名称 判断
/// </summary>
/// <returns></returns>
bool TransitionEditorPageScriptNameUpdate_IsNull();
bool ShowMainProgressSet_IsNull(string n, int m);
bool ShowMainProgress_IsNull(int c);
void ShowMainProgressSet_Give(ShowMainProgressSet f);
void ShowMainProgress_Give(ShowMainProgress f);
void ShowMainProgress_Give_CountPer(ShowMainProgressCountPer f);
void HideMainProgress_Give(HideMainProgress f);
void ShowMainProgressSet(string n, int m);
void HideMainProgress(int delayTime);
void ShowMainProgressCountPer(string msg,int c);
void ShowMainProgress(int c);
}
/// <summary>
///
/// </summary>
public interface BaseA
{
/// <summary>
///
/// </summary>
/// <returns></returns>
bool RefreshCraftTree_IsNull();
/// <summary>
/// 传递工艺组 判断
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
bool TransmitCraftGroup_IsNull();
/// <summary>
/// 传递模型名 判断
/// </summary>
/// <param name="modelName"></param>
/// <param name="modelCode"></param>
bool TransmitModelName_IsNull();
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递 判断
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
bool TransmitCraftGroup_UnSim_IsNull();
bool ShowMainProgressSet_IsNull(string n, int m);
bool ShowMainProgress_IsNull(int c);
void ShowMainProgressSet_Give(ShowMainProgressSet f);
void ShowMainProgress_Give_CountPer(ShowMainProgressCountPer f);
void ShowMainProgress_Give(ShowMainProgress f);
void ShowMainProgressSet(string n, int m);
void ShowMainProgress(int c);
}
}

View File

@@ -0,0 +1,30 @@
using Global;
using ModelBasic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTTest
{
/// <summary>
///
/// </summary>
public static class IIErrInterface
{
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="tt"></param>
/// <returns></returns>
public static IErrHandler<String> GetIErrHandler<T>(this T tt) where T : IIERR
{
return new ErrHandler<String>();
}
}
}

View File

@@ -0,0 +1,21 @@
using Global;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTTest
{
public static class IIMMInterface
{
//public static IModelManagement3 GetModelManagement<T>(this T tt) where T : IIMM
//{
// return new ModelManagement();
//}
}
}

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace DTTest
{
public interface IModelManagement3
{
/// <summary>
/// 为了数字孪生初始化加载数据(单个链接)
/// </summary>
/// <param name="ipPortOpName_1"></param>
/// <param name="prefix0"></param>
/// <param name="objectHeader0"></param>
/// <param name="sendInterval0"></param>
/// <param name="connectionString"></param>
/// <param name="projectName"></param>
void Load_PlcVarName_Trig_3DModel_Movement_Interface(
string ipPortOpName_1, string prefix0, string objectHeader0, int sendInterval0,
string connectionString, string projectName)
;
/// <summary>
/// 为了数字孪生初始化加载数据(两个链接)
/// </summary>
/// <param name="ipPortOpName_1"></param>
/// <param name="ipPortOpName_2"></param>
/// <param name="prefix0"></param>
/// <param name="objectHeader0"></param>
/// <param name="sendInterval0"></param>
/// <param name="connectionString"></param>
/// <param name="projectName"></param>
void Load_PlcVarName_Trig_3DModel_Movement_Interface(
string ipPortOpName_1, string ipPortOpName_2, string prefix0, string objectHeader0, int sendInterval0,
string connectionString, string projectName)
;
/// <summary>
/// PLC 信号 触发3D模型运动
/// </summary>
/// <param name="tagNamePlc"></param>
/// <param name="inputValue"></param>
void PlcVarName_Trig_3DModel_Movement(string tagNamePlc, bool inputValue)
;
/// <summary>
/// 模型可见控制
/// </summary>
/// <param name="modelName"></param>
/// <param name="visible"></param>
void ModelVisible(string modelName, bool visible)
;
}
}

View File

@@ -0,0 +1,182 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Global
{
/// <summary>
///
/// </summary>
public interface IProjectVar
{
/// <summary>
/// 工艺树刷新
/// </summary>
void RefreshCraftTree();
/// <summary>
/// 传递工艺组
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
void TransmitCraftGroup(string craftName, string craftCode);
/// <summary>
/// 传递模型名
/// </summary>
/// <param name="modelName"></param>
/// <param name="modelCode"></param>
void TransmitModelName(string modelName, string modelCode);
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
void TransmitCraftGroup_UnSim(string craftName, string craftCode);
/// <summary>
/// 传递项目名称
/// 2020.11.2
/// </summary>
/// <returns></returns>
void ProjectNameFunc(string projectName);
/// <summary>
/// (位置控制器)关闭
/// </summary>
void CloseSeatOperationForm();
/// <summary>
/// (位置控制器)选择模型发送消息
/// </summary>
/// <param name="modelName"></param>
void CurrTreeSelectModelHandler_SeatOperation(string modelCode, string modelName);
/// <summary>
/// 传递逻辑脚本名称
/// </summary>
/// <param name="modelName"></param>
void TransitionEditorPageScriptNameUpdate(string internalVarCode, string internalVarName)
;
/// <summary>
/// 工艺树刷新 赋予
/// </summary>
void RefreshCraftTree_Give(Action f);
/// <summary>
/// 传递工艺组 赋予
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
void TransmitCraftGroup_Give(Func<String, String, bool> f)
;
/// <summary>
/// 传递模型名 赋予
/// </summary>
/// <param name="modelName"></param>
/// <param name="modelCode"></param>
void TransmitModelName_Give(Func<String, String, bool> f)
;
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递 赋予
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
void TransmitCraftGroup_UnSim_Give(Func<String, String, bool> f)
;
/// <summary>
/// (位置控制器)关闭 赋予
/// </summary>
void CloseSeatOperationForm_Give(Func<bool> f)
;
/// <summary>
/// (位置控制器)选择模型发送消息 赋予
/// </summary>
/// <param name="modelName"></param>
void CurrTreeSelectModelHandler_SeatOperation_Give(Func<String, String, bool> f)
;
/// <summary>
/// 传递项目名称 赋予
/// 2020.11.2
/// </summary>
/// <param name="f"></param>
void ProjectNameFunc_Give(Func<String, Boolean> f)
;
/// <summary>
/// 传递逻辑脚本名称 赋予
/// </summary>
/// <param name="f"></param>
void TransitionEditorPageScriptNameUpdate_Give(Func<String, String, bool> f)
;
/// <summary>
/// 工艺树刷新 判断
/// </summary>
bool RefreshCraftTree_IsNull()
;
/// <summary>
/// 传递工艺组 判断
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
bool TransmitCraftGroup_IsNull()
;
/// <summary>
/// 传递模型名 判断
/// </summary>
/// <param name="modelName"></param>
/// <param name="modelCode"></param>
bool TransmitModelName_IsNull()
;
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递 判断
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
bool TransmitCraftGroup_UnSim_IsNull()
;
/// <summary>
/// (位置控制器)关闭 判断
/// </summary>
bool CloseSeatOperationForm_IsNull()
;
/// <summary>
/// 传递项目名称 判断
/// 2020.11.2
/// </summary>
/// <param name="f"></param>
bool ProjectNameFunc_IsNull()
;
/// <summary>
/// (位置控制器)传递位置信息 判断
/// </summary>
/// <param name="e"></param>
bool CurrPostionInfoHandler_SeatOperation_IsNull()
;
/// <summary>
/// (位置控制器)选择模型发送消息 判断
/// </summary>
/// <param name="modelName"></param>
bool CurrTreeSelectModelHandler_SeatOperation_IsNull()
;
/// <summary>
/// 传递逻辑脚本名称 判断
/// </summary>
/// <returns></returns>
bool TransitionEditorPageScriptNameUpdate_IsNull()
;
bool ShowMainProgressSet_IsNull(string n, int m)
;
bool ShowMainProgress_IsNull(int c)
;
void ShowMainProgressSet_Give(ShowMainProgressSet f)
;
void ShowMainProgress_Give_CountPer(ShowMainProgressCountPer f);
void ShowMainProgress_Give(ShowMainProgress f);
void ShowMainProgressSet(string n, int m)
;
void ShowMainProgress(int c)
;
void ShowMainProgressCountPer(string msg,int c)
;
}
}

View File

@@ -0,0 +1,15 @@
using Global;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTTest
{
public interface IIERR
{
}
}

View File

@@ -0,0 +1,16 @@
using Global;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTTest
{
public interface IIExecCmd
{
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTTest
{
public interface IIMM
{
}
}

View File

@@ -0,0 +1,16 @@
using Global;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTTest
{
public interface IIPROJ
{
}
}

View File

@@ -0,0 +1,232 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
public class GlobalEventInterface
{
/// <summary>
/// 模型加载完成通知工艺tree可以选择
/// </summary>
public static Action<string> E_Model_LoadModelTree;
/// <summary>
/// id name type
/// </summary>
public static Action<string, string, string> E_SelectCraft;
/// <summary>
/// 模型信息
/// </summary>
public static Action<object, Data_ClickModel> E_ModelMotionControl_CurrClickModel;
/// <summary>
/// 机器人数据
/// </summary>
public static Action<double[], double[], double[], double[], double[], double[]> E_RobotData;
/// <summary>
///
/// </summary>
public static Action<int, int, C_Frames> E_ModelControl_CurrRunInfoEvent;
/// <summary>
///
/// </summary>
public static Action E_ModelControl_PlayTaskEnd;
/// <summary>
///
/// </summary>
public static Action<long> E_CurrTime_Play;
/// <summary>
///
/// </summary>
public static Action<string> E_PlayCurrCraftTaskEnd;
/// <summary>
///
/// </summary>
public static Action<int, int> E_ShowIndex;
/// <summary>
///
/// </summary>
public static Action<string> E_PlayCurrActTaskEnd;
/// <summary>
///
/// </summary>
public static Action<int> E_PlayCurrActCraftTaskEnd;
/// <summary>
///
/// </summary>
public static Action<int> E_ModelControl_CurrRunInfoEventPs;
/// <summary>
///
/// </summary>
public static Action<string> E_PlayDeviceSignalSimTaskEnd;
/// <summary>
///
/// </summary>
public static Action E_OpenFileModel;
/// <summary>
///
/// </summary>
public static Action E_GetCurrSignalList;
/// <summary>
///
/// </summary>
public static Action<String> OnReceiveMsgDataChange = null;
/// <summary>
/// 监控信号产生变化
/// </summary>
public static Action<QueueExecScriptParam> GlobalSignalChanged = null;
/// <summary>
///
/// </summary>
public static Action<String,String> E_SignalMonitorChanged = null;
/// <summary>
/// 浏览器下载的百分比
/// </summary>
public static Action<Int32,Boolean> E_CefDownloadPercentComplete = null;
/// <summary>
/// 传递姿态
/// </summary>
public static Action<String, String> E_TransmitAttitude = null;
#region MoveIt
/// <summary>
///
/// </summary>
public static Func<String, String, Int32, String> E_AttitudeGenerateFrameData = null;
/// <summary>
///
/// </summary>
public static Action<String> E_MoveIt_MoveTo = null;
public static Action<string , string , double , double > E_MoveIt_MoveToJoint = null;
#endregion
/// <summary>
///
/// </summary>
public static Action<KinematicsBase.Kinematics> E_Transmit_SaveToModel = null;
#region CraftTree
public static Action<String> E_CraftTree_DrawSelect_UseCraft = null;
public static Action E_Refresh_CraftTree = null;
#endregion
#region PathEditor
public static Action<Type_Craft, String, String, String, String, Int32> E_Refresh_PathEditor = null;
public static Action<String> E_Refresh_PathEditor_Null = null;
#endregion
#region ActGantt
public static Action<string , string , List<String>> E_ActGantt_RefreshGantt = null;
public static Action<TreeNode> E_ActGantt_RefreshGanttWithTreeNode = null;
#endregion
#region DebugOption
#endregion
#region SignalViewer
public static Action<String> E_SignalViewer_ActSelect_TagID_Handler = null;
public static Action<String> E_SignalViewer_TagIDSelect_TagID_Handler = null;
public static Action E_SignalViewer_Rendering_dgv_Handler = null;
#endregion
#region p_SimulationPanel
public static Action<String> E_SimulationPanel_PlayThisCraft_Task = null;
public static Action E_SimulationPanel_PlayThisCraft_Task_Stop = null;
public static Action<string, string> E_SimulationPanel_VirtualDebug_SignalWrite = null;
#endregion
#region SignalLabelForm
public static Action<string , string , string > E_SignalLabelForm_TransmitSelect = null;
#endregion
#region TagID_Add_Handler
public static Action<string, string, string> E_Transmit_TagID_Add_Handler_ShowSelectInfo = null;
#endregion
#region LogicalBlock
public static Action<string, string> E_LogicalBlock_ShowSelect = null;
public static Action<LogicalBlock.LB_Device_Signal> E_LogicalBlock_AddSignal = null;
#endregion
#region Craft_Add_Device
public static Action<string> E_Craft_Add_Device_Fill_CB = null;
#endregion
#region DeviceSignalSimGantt
public static Action<string> E_DeviceSignalSimGantt_RefreshGantt = null;
public static Action<string, string> E_DeviceSignalSimGantt_RefreshDeviceSignalSimGantt = null;
public static Action<string, string> E_DeviceSignalSimGantt_TransmitTagToDeviceSignalSim = null;
public static Action<string, string,int,string,string> E_MisDataPlcTagIDSignal_TransmitTagToDeviceSignalSim = null;
//
#endregion
#region SimplifyPdps
public static Action E_SimplifyPdps_Start = null;
#endregion
#region Project_O
public static Action E_Project_O_Start = null;
#endregion
}

View File

@@ -0,0 +1,961 @@
using Global;
using KinematicsBase;
using System;
using System.Collections.Generic;
using System.Threading;
/// <summary>
/// 项目参数
/// 2021.5.25
/// 2021.12.22
/// </summary>
public class PP
{
#region SystemUser
/// <summary>
///
/// </summary>
public static string UserID
{
get;
set;
} = "";
/// <summary>
///
/// </summary>
public static string UserName
{
get;
set;
} = "";
/// <summary>
///
/// </summary>
public static string UserPassword
{
get;
set;
} = "";
/// <summary>
///
/// </summary>
public static Type_Jurisdiction Jurisdiction
{
get;
set;
} = Type_Jurisdiction.Administrator;
/// <summary>
///
/// </summary>
public static List<String> ProjectList
{
get;
set;
} = new List<String> ();
#endregion
#region Current Operation Data
/// <summary>
/// 设备类型的代码
/// </summary>
public static DeviceType DeviceTypeCode = DeviceType.Device;
/// <summary>
/// 当前的Web模型代码
/// </summary>
public static string ModelCode = "-1";
/// <summary>
/// 当前的Web模型名称
/// </summary>
public static string ModelName = "-1";
/// <summary>
/// 当前的Web模型代码
/// </summary>
public static string ModelCodeBase = "-1";
/// <summary>
/// 当前的Web模型名称
/// </summary>
public static string ModelNameBase = "-1";
/// <summary>
/// 当前的Web模型代码
/// </summary>
public static string ModelCodeTool = "-1";
/// <summary>
/// 当前的Web模型名称
/// </summary>
public static string ModelNameTool = "-1";
/// <summary>
/// 当前的Web模型代码
/// </summary>
public static string ModelCodeTcp = "-1";
/// <summary>
/// 当前的Web模型名称
/// </summary>
public static string ModelNameTcp = "-1";
/// <summary>
/// 当前的Web模型位置X
/// </summary>
public static double TX = 0;
/// <summary>
/// 当前的Web模型位置Y
/// </summary>
public static double TY = 0;
/// <summary>
/// 当前的Web模型位置Z
/// </summary>
public static double TZ = 0;
/// <summary>
/// 当前的Web模型位置RX
/// </summary>
public static double RX = 0;
/// <summary>
/// 当前的Web模型位置RY
/// </summary>
public static double RY = 0;
/// <summary>
/// 当前的Web模型位置RZ
/// </summary>
public static double RZ = 0;
/// <summary>
/// 当前的Web模型位置QX
/// </summary>
public static double QX = 0;
/// <summary>
/// 当前的Web模型位置QY
/// </summary>
public static double QY = 0;
/// <summary>
/// 当前的Web模型位置QZ
/// </summary>
public static double QZ = 0;
/// <summary>
/// 当前的Web模型位置QW
/// </summary>
public static double QW = 0;
/// <summary>
/// 当前的Web_Base模型位置X
/// </summary>
public static double TX_Base = 0;
/// <summary>
/// 当前的Web_Base模型位置Y
/// </summary>
public static double TY_Base = 0;
/// <summary>
/// 当前的Web_Base模型位置Z
/// </summary>
public static double TZ_Base = 0;
/// <summary>
/// 当前的Web_Base模型位置RX
/// </summary>
public static double RX_Base = 0;
/// <summary>
/// 当前的Web_Base模型位置RY
/// </summary>
public static double RY_Base = 0;
/// <summary>
/// 当前的Web_Base模型位置RZ
/// </summary>
public static double RZ_Base = 0;
/// <summary>
/// 当前的Web_Base模型位置QX
/// </summary>
public static double QX_Base = 0;
/// <summary>
/// 当前的Web_Base模型位置QY
/// </summary>
public static double QY_Base = 0;
/// <summary>
/// 当前的Web_Base模型位置QZ
/// </summary>
public static double QZ_Base = 0;
/// <summary>
/// 当前的Web_Base模型位置QW
/// </summary>
public static double QW_Base = 0;
/// <summary>
/// 当前的Web_Tool模型位置X
/// </summary>
public static double TX_Tool = 0;
/// <summary>
/// 当前的Web_Tool模型位置Y
/// </summary>
public static double TY_Tool = 0;
/// <summary>
/// 当前的Web_Tool模型位置Z
/// </summary>
public static double TZ_Tool = 0;
/// <summary>
/// 当前的Web_Tool模型位置RX
/// </summary>
public static double RX_Tool = 0;
/// <summary>
/// 当前的Web_Tool模型位置RY
/// </summary>
public static double RY_Tool = 0;
/// <summary>
/// 当前的Web_Tool模型位置RZ
/// </summary>
public static double RZ_Tool = 0;
/// <summary>
/// 当前的Web_Tool模型位置QX
/// </summary>
public static double QX_Tool = 0;
/// <summary>
/// 当前的Web_Tool模型位置QY
/// </summary>
public static double QY_Tool = 0;
/// <summary>
/// 当前的Web_Tool模型位置QZ
/// </summary>
public static double QZ_Tool = 0;
/// <summary>
/// 当前的Web_Tool模型位置QW
/// </summary>
public static double QW_Tool = 0;
/// <summary>
/// 当前的Web_Tcp模型位置X
/// </summary>
public static double TX_Tcp = 0;
/// <summary>
/// 当前的Web_Tcp模型位置Y
/// </summary>
public static double TY_Tcp = 0;
/// <summary>
/// 当前的Web_Tcp模型位置Z
/// </summary>
public static double TZ_Tcp = 0;
/// <summary>
/// 当前的Web_Tcp模型位置RX
/// </summary>
public static double RX_Tcp = 0;
/// <summary>
/// 当前的Web_Tcp模型位置RY
/// </summary>
public static double RY_Tcp = 0;
/// <summary>
/// 当前的Web_Tcp模型位置RZ
/// </summary>
public static double RZ_Tcp = 0;
/// <summary>
/// 当前的Web_Tcp模型位置QX
/// </summary>
public static double QX_Tcp = 0;
/// <summary>
/// 当前的Web_Tcp模型位置QY
/// </summary>
public static double QY_Tcp = 0;
/// <summary>
/// 当前的Web_Tcp模型位置QZ
/// </summary>
public static double QZ_Tcp = 0;
/// <summary>
/// 当前的Web_Tcp模型位置QW
/// </summary>
public static double QW_Tcp = 0;
#endregion
#region Param
public static bool ReLoadPara_IsCompleted
{
get;
set;
} = false;
/// <summary>
/// 项目配置参数
/// 2021.10.17.LLX
/// </summary>
public static PCP_Json PCP
{
get;
set;
}
/// <summary>
/// 数据库链接
/// </summary>
public static string ConnectionStr
{
get;
set;
} = "-1";
public static string Url_WebApi
{
get;
set;
} = "http://localhost:41181";
public static string Url_WebApi2
{
get;
set;
} = "http://localhost:41182";
/// <summary>
/// 项目代码
/// </summary>
public static string ProjectCode
{
get;
set;
} = "-1";
public static string IsWebApp
{
get;
set;
} = System.Configuration.ConfigurationManager.AppSettings["IsWebApp"];
/// <summary>
/// 项目名称
/// </summary>
public static string ProjectName
{
get;
set;
} = "-1";
/// <summary>
/// 程序的运行模式
/// 2021.12.3.LLX
/// </summary>
public static Mode_Run RunMode
{
get;
set;
} = Mode_Run.Simulation;
/// <summary>
///
/// </summary>
public static string currCefDownLoadPath
{
get;
set;
} = "";
/// <summary>
/// 允许机器人计算
/// </summary>
public static bool AllowRobotCalculation
{
get;
set;
} = true;
/// <summary>
/// 生成工艺序列的全局帧值
/// 2021.5.24
/// </summary>
public static int gFrameValue
{
get;
set;
} = 0;
#endregion
#region Collections Generic
/// <summary>
/// 模型列表
/// </summary>
public static System.Data.DataTable gDT_ModelTree
{
get;
set;
} = null;
/// <summary>
/// 模型代码对应的模型属性
/// </summary>
public static Dictionary<String, ModelAttribute> DC_ModelCode_ModelAttribute
{
get;
set;
} = null;
/// <summary>
/// 工艺执行任务
/// </summary>
public static Dictionary<String, Thread> dc_Craft_ExecTask
{
get;
set;
} = new Dictionary<String, Thread>();
public static System.Collections.Generic.Dictionary<System.String, System.String> DC_TagID_CurrValue
{
get;
set;
} = null;
/// <summary>
/// TagID触发时候的内容
/// 2021.12.21.LLX
/// </summary>
public static Dictionary<String, List<OperationResult<String, String, String, String, String, String, String>>> dc_TagID_Content
{
get;
set;
} = null;
/// <summary>
/// 当前的微分点记录
/// 2021.3.29
/// </summary>
public static System.Collections.Generic.List<double[]> pList_g
{
get;
set;
} = null;
/// <summary>
/// 当前逆解的的记录
/// 2021.3.29
/// </summary>
public static System.Collections.Generic.List<System.Collections.Generic.List<double>> jList_g
{
get;
set;
} = null;
/// <summary>
///
/// </summary>
public static Dictionary<String, LogicalBlock.LogicalBlockBasic> DC_ResourcesCode_LogicalBlockBasic = new Dictionary<String, LogicalBlock.LogicalBlockBasic>();
#endregion
#region DebugOption
/// <summary>
/// 允许外部查看模型
/// 2021.5.11
/// </summary>
public static bool g_AllowSelectModel = false;
/// <summary>
/// 允许外部查看工艺
/// 2021.5.11
/// </summary>
public static bool g_AllowSelectCraft = false;
/// <summary>
/// 允许外部查看TagID绑定的信号
/// 2021.5.11
/// </summary>
public static bool g_AllowSelectTagIDSignal = false;
/// <summary>
/// 允许控制工艺
/// </summary>
public static bool g_AllowControlCraft = true;
/// <summary>
/// 允许控制信号
/// </summary>
public static bool g_AllowControlSignal = true;
/// <summary>
/// 允许控制显隐
/// </summary>
public static bool g_AllowControlVisible = true;
/// <summary>
/// 允许控制自转
/// </summary>
public static bool g_AllowControlRotation = true;
/// <summary>
/// 允许控制等待
/// 2021.11.04.1652.LLX
/// </summary>
public static bool g_AllowControlWait = true;
#endregion
#region Messy
/// <summary>
/// 全球变量的接口
/// </summary>
public static IGlobalVar iGlobalVar = null;
/// <summary>
/// 允许执行关闭窗体
/// </summary>
public static bool isCanClose = false;
/// <summary>
/// 加载完成
/// </summary>
public static bool LoadFinish = false;
/// <summary>
/// 是同步顺序,或起始时间排序
/// </summary>
public static bool ActGantt_Is_SyncOrder_Or_StartTime = true;
/// <summary>
/// 当前执行的路径
/// </summary>
public static string currExecPath = "";
#endregion
#region CraftTree
/// <summary>
/// 当前选中的工艺代码
/// </summary>
public static string currTreeCraftCode = "-1";
/// <summary>
/// 当前选中的工艺名称
/// </summary>
public static string currTreeCraftName = "-1";
/// <summary>
/// 当前选中的工艺父节点
/// </summary>
public static string currTreeCraftTypeCode = "-1";
/// <summary>
/// 当前选中的工艺驱动类型
/// </summary>
public static Type_Craft currTreeCraftDeviceTypeCode = Type_Craft.LinearFlow;
/// <summary>
/// 当前选中的工艺的模型代码
/// </summary>
public static string currCraftTree_ModelCode = "-1";
/// <summary>
/// 当前选中的工艺的模型名称
/// </summary>
public static string currCraftTree_ModelName = "-1";
#endregion
#region DeviceSignalSimTree
/// <summary>
/// 当前选中的设备信号仿真代码
/// </summary>
public static string currTreeDeviceSignalSimCode = "-1";
/// <summary>
/// 当前选中的设备信号仿真名称
/// </summary>
public static string currTreeDeviceSignalSimName = "-1";
#endregion
#region MesWork
public static string BasicDataTableFile = "";
public static int IsDemoMesServer = 0;
public static int IsWriteMonitorLog = 1;
#endregion
#region P_KinematicsEditorDevice PoseCreator
public static int PoseCreatorStepLength = 1;
#endregion
#region Func
/// <summary>
/// 模型代码找到模型属性
/// 2021.12.22.LLX
/// </summary>
/// <param name="modelCode"></param>
/// <returns></returns>
public static ModelAttribute ModelCodeFindModelAttribute(string modelCode)
{
ModelAttribute ma = new ModelAttribute() { ModelName = "不存在这个模型" };
if (PP.DC_ModelCode_ModelAttribute == null)
{
return ma;
}
if (PP.DC_ModelCode_ModelAttribute.ContainsKey(modelCode))
{
ma = PP.DC_ModelCode_ModelAttribute[modelCode];
}
return ma;
}
public static List<Kinematics> ReturnKinematicsList()
{
var kL = new List<Kinematics>();
if (PP.DC_ModelCode_ModelAttribute == null)
{
return kL;
}
foreach (ModelAttribute item in DC_ModelCode_ModelAttribute.Values)
{
if (item != null)
{
if (item.KinematicsData != null)
{
kL.Add(item.KinematicsData);
}
}
}
return kL;
}
public static Kinematics ReturnKinematics(string modelCode)
{
Kinematics k = null;
if (PP.DC_ModelCode_ModelAttribute == null)
{
return k;
}
if (DC_ModelCode_ModelAttribute.ContainsKey(modelCode))
{
k = new Kinematics();
k = DC_ModelCode_ModelAttribute[modelCode].KinematicsData;
}
return k;
}
#endregion
}
///// <summary>
///// 项目配置参数
///// 2021.10.17.LLX
///// </summary>
//public class PCP
//{
// /// <summary>
// /// 导出序列的帧值
// /// </summary>
// public static int FrameValue
// {
// get;
// set;
// } = -1;
// /// <summary>
// /// 发送数据时间间隔
// /// </summary>
// public static int SendInterval
// {
// get;
// set;
// } = -1;
// /// <summary>
// /// 通讯服务URLCS
// /// </summary>
// public static string ConnSvrURL
// {
// get;
// set;
// } = "-1";
// /// <summary>
// /// 通讯标头CS
// /// </summary>
// public static string Prefix
// {
// get;
// set;
// } = "-1";
// /// <summary>
// /// 通讯项目标头CS
// /// </summary>
// public static string ObjectHeader
// {
// get;
// set;
// } = "-1";
// /// <summary>
// /// 通讯服务URLBS
// /// </summary>
// public static string ConnSvrURLBS
// {
// get;
// set;
// } = "-1";
// /// <summary>
// /// 通讯标头BS
// /// </summary>
// public static string PrefixBS
// {
// get;
// set;
// } = "-1";
// /// <summary>
// /// 通讯项目标头BS
// /// </summary>
// public static string ObjectHeaderBS
// {
// get;
// set;
// } = "-1";
// /// <summary>
// /// OPC连接的URL
// /// </summary>
// public static string OpcUrl
// {
// get;
// set;
// } = "-1";
// /// <summary>
// /// 三维网页的URL
// /// </summary>
// public static string WebUrl
// {
// get;
// set;
// } = "-1";
// /// <summary>
// /// 三维网页文件的路径
// /// </summary>
// public static string WebFilePath
// {
// get;
// set;
// } = "-1";
// /// <summary>
// /// 程序启用Chrome浏览器
// /// </summary>
// public static bool IsStartChrome
// {
// get;
// set;
// } = true;
// /// <summary>
// /// 使用服务器通讯方式
// /// </summary>
// public static string ConnMode
// {
// get;
// set;
// } = "1";
// /// <summary>
// /// 是允许修改模型可见性
// /// </summary>
// public static bool IsAllowVisible
// {
// get;
// set;
// } = true;
// /// <summary>
// /// 是修改数据库模型可见性
// /// </summary>
// public static bool IsUpdateSqlVisible
// {
// get;
// set;
// } = false;
// /// <summary>
// /// 是记录现场真实数据
// /// </summary>
// public static bool IsRecordData
// {
// get;
// set;
// } = false;
// /// <summary>
// /// 行为附加状态数据
// /// </summary>
// public static bool ActAttachStateData
// {
// get;
// set;
// } = true;
// /// <summary>
// /// 模型文件路径
// /// </summary>
// public static string ModelFilePath
// {
// get;
// set;
// } = "";
//}
/// <summary>
/// 项目配置参数
/// 2021.10.17.LLX
/// </summary>
public class PCP_Json
{
/// <summary>
///
/// </summary>
public PCP_Json()
{
WebUrl = System.Configuration.ConfigurationManager.AppSettings["WebUrl"];
ConnSvrURL = System.Configuration.ConfigurationManager.AppSettings["ConnSvrURL"];
ConnSvrURLBS = System.Configuration.ConfigurationManager.AppSettings["ConnSvrURLBS"];
PrefixBS = System.Configuration.ConfigurationManager.AppSettings["PrefixBS"];
WebFilePath = System.Configuration.ConfigurationManager.AppSettings["WebFilePath"];
SqlBakPath = System.Configuration.ConfigurationManager.AppSettings["SqlBakPath"];
}
/// <summary>
/// 导出序列的帧值
/// </summary>
public int FrameValue
{
get;
set;
} = 20;
/// <summary>
/// 发送数据时间间隔
/// </summary>
public int SendInterval
{
get;
set;
} = 20;
/// <summary>
/// 通讯服务URLCS
/// </summary>
public string ConnSvrURL
{
get;
set;
} = "127.0.0.1:41102,OP1010";
/// <summary>
/// 通讯标头CS
/// </summary>
public string Prefix
{
get;
set;
} = "TOBS??SCADAMain?";
/// <summary>
/// 通讯项目标头CS
/// </summary>
public string ObjectHeader
{
get;
set;
} = "DT";
/// <summary>
/// 通讯服务URLBS
/// </summary>
public string ConnSvrURLBS
{
get;
set;
} = "127.0.0.1:61101,SCADAMain";
/// <summary>
/// 通讯标头BS
/// </summary>
public string PrefixBS
{
get;
set;
} = "TOCS??OP1010?";
/// <summary>
/// 通讯项目标头BS
/// </summary>
public string ObjectHeaderBS
{
get;
set;
} = "DT";
///// <summary>
///// OPC连接的URL
///// </summary>
//public string OpcUrl
//{
// get;
// set;
//} = "127.0.0.1:41102,OP1020";
/// <summary>
/// 三维网页的URL
/// </summary>
public string WebUrl
{
get;
set;
} = "http://192.168.1.188:1257/editor/index_RobotPlan.html";
/// <summary>
/// 三维网页文件的路径
/// </summary>
public string WebFilePath
{
get;
set;
} = @"C:\00-资料夹\DT_WebFile\00-DT_";
/// <summary>
/// 程序启用Chrome浏览器
/// </summary>
public bool IsStartChrome
{
get;
set;
} = true;
/// <summary>
/// 使用服务器通讯方式
/// </summary>
public bool ConnMode
{
get;
set;
} = true;
/// <summary>
/// 是允许修改模型可见性
/// </summary>
public bool IsAllowVisible
{
get;
set;
} = true;
/// <summary>
/// 是记录现场真实数据
/// </summary>
public bool IsRecordData
{
get;
set;
} = false;
///// <summary>
///// 行为附加状态数据
///// </summary>
//public bool ActAttachStateData
//{
// get;
// set;
//} = true;
/// <summary>
/// 模型文件路径
/// </summary>
public string ModelFilePath
{
get;
set;
} = "";
/// <summary>
/// 数据库备份的路径
/// 2021.12.3.LLX
/// </summary>
public string SqlBakPath
{
get;
set;
} = @"C:\mwdf_bak";
/// <summary>
/// 是虚拟的PLC模式
/// 2021.12.3.LLX
/// </summary>
public bool IsPlcSim
{
get;
set;
} = true;
}

View File

@@ -0,0 +1,523 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
namespace KinematicsBase
{
#region BaseClass
[Serializable]
public enum UnitType
{
mm,
cm,
m
}
[Serializable]
public enum LimitType
{
Constant,
NoLimits
//,Variable
}
public enum JointType
{
/// <summary>
/// 旋转
/// </summary>
Revolute,
/// <summary>
/// 滑移
/// </summary>
Prismatic
}
[Serializable]
public class JointMaxValues
{
public JointMaxValues()
{
}
public JointMaxValues(double speed, double acceleration)
{
Speed = speed;
Acceleration = acceleration;
}
public double SpeedFromJointLimit(JointLimit jointLimit)
{
if (jointLimit.Interval <= 0.000000001)
{
Speed = 0;
}
else
{
Speed = (jointLimit.HighLimit - jointLimit.LowLimit) / (jointLimit.Interval / 1000f);
}
return Speed;
}
public double Speed { get; set; }
public double Acceleration { get; set; }
}
[Serializable]
public class JointLimit
{
public JointLimit()
{
}
/// <summary>
/// 创建JointLimit类构造方法
/// </summary>
/// <param name="limitType">LimitType. </param>
/// <param name="lowLimit">最小极限 double </param>
/// <param name="highLimit">最大极限 double</param>
public JointLimit(LimitType limitType, double lowLimit, double highLimit)
{
this.LimitType = limitType;
this.LowLimit = lowLimit;
this.HighLimit = highLimit;
}
public JointLimit(LimitType limitType, double lowLimit, double highLimit, int interval)
{
this.LimitType = limitType;
this.LowLimit = lowLimit;
this.HighLimit = highLimit;
this.Interval = interval;
}
public LimitType LimitType { get; set; }
public double LowLimit { get; set; }
public double HighLimit { get; set; }
/// <summary>
/// 时间优先时候的时间,单位毫秒
/// </summary>
public int Interval;
}
[Serializable]
public class Joint
{
/// <summary>
/// ModeId JointId value
/// </summary>
public static event Action<string, string, object> OnDataChange = null;
public static event Action<string, string, bool> OnDataChangeJointIsRun = null;
//public static event Action<Joint> UpdateJoint;
public static void DataChange(string modeId, string id, object val)
{
if (OnDataChange != null)
{
OnDataChange.Invoke(modeId, id, val);
}
}
public static void DataChangeJointIsRun(string modeId, string id, bool val)
{
if (OnDataChangeJointIsRun != null)
{
OnDataChangeJointIsRun.Invoke(modeId, id, val);
}
}
public Joint()
{
GraphPosition = new System.Drawing.Point[2];
}
public Joint(string id, string name, bool isDriving = true)
{
this.Id = id;
this.Name = name;
this.IsDriving = isDriving;
//this.Valuefactor = 1;
}
public System.Drawing.Point[] GraphPosition { set; get; }
public string Id { get; set; }
public string Name { get; set; }
public string ModelId { get; set; }
/// <summary>
/// 驱动轴
/// 联动时的主运动
/// </summary>
public bool IsDriving { get; set; }
public string ParentLinkId { get; set; }
public string ChildLinkId { get; set; }
/// <summary>
/// 父模型代码
/// </summary>
public string PId { get; set; }
/// <summary>
/// 子模型代码
/// </summary>
public string CId { get; set; }
public Axis Axis { get; set; }
public JointType JointType { get; set; }
public bool LockJoint { get; set; }
public JointLimit JointLimit { get; set; }
public JointMaxValues JointMaxValue { get; set; }
/// <summary>
/// 模型初始值
/// </summary>
public double Value { get; set; }
public bool FindJointById(Joint joint)
{
return Id == joint.Id;
}
/// <summary>
/// 输入参数
/// </summary>
public double ValueInput { get; set; }
/// <summary>
/// 倍率 1
/// </summary>
public double ValueFactor { get; set; } = 1;
/// <summary>
/// 模型当前值
/// </summary>
public double ValueCurrent { get; set; }
public string Script;
public bool IsScript;
public bool IsOnlyHomePose;
public static double GetJointPosition(Joint joint)
{
double val = -1;
switch (joint.JointType)
{
case JointType.Prismatic:
switch (joint.Axis.AxisFlag)
{
case AxisFlag.X:
val = Convert.ToSingle(joint.Axis.Loaction.Position.X);
break;
case AxisFlag.Y:
val = Convert.ToSingle(joint.Axis.Loaction.Position.Y);
break;
case AxisFlag.Z:
val = Convert.ToSingle(joint.Axis.Loaction.Position.Z);
break;
}
break;
//一、绕定轴X-Y-Z旋转RPY角
//二、绕动轴Z-Y-X旋转Euler角
case JointType.Revolute:
switch (joint.Axis.AxisFlag)
{
case AxisFlag.X:
val = Convert.ToSingle(joint.Axis.Loaction.FixedAngle.R);
break;
case AxisFlag.Y:
val = Convert.ToSingle(joint.Axis.Loaction.FixedAngle.P);
break;
case AxisFlag.Z:
val = Convert.ToSingle(joint.Axis.Loaction.FixedAngle.Y);
break;
}
break;
}
return val;
}
/// <summary>
/// 计算位姿变换
/// </summary>
/// <param name="initCoordinate">初始坐标doule[7]</param>
/// <param name="along">沿着某个轴转X/Y/Z/RX/RY/RZ</param>
/// <param name="step">移动步长,转动单位弧度,移动单位与输入一致</param>
/// <returns>目标坐标doule[7]</returns>
public PositionQuaternion TransformCoordinates(Joint joint, double step)
{
string along = GetJointAlong(joint);
double[] initCoordinate = new double[7];
initCoordinate[0] = joint.Axis.LoactionQuaternion.Position.X;
initCoordinate[1] = joint.Axis.LoactionQuaternion.Position.Y;
initCoordinate[2] = joint.Axis.LoactionQuaternion.Position.Z;
initCoordinate[3] = joint.Axis.LoactionQuaternion.Quaternion.X;
initCoordinate[4] = joint.Axis.LoactionQuaternion.Quaternion.Y;
initCoordinate[5] = joint.Axis.LoactionQuaternion.Quaternion.Z;
initCoordinate[6] = joint.Axis.LoactionQuaternion.Quaternion.W;
return TransformCoordinates(initCoordinate, along, step, joint.JointType);
}
public static string GetJointAlong(Joint joint)
{
string along = "X";
switch (joint.JointType)
{
case JointType.Prismatic:
switch (joint.Axis.AxisFlag)
{
case AxisFlag.X:
along = "X";
break;
case AxisFlag.Y:
along = "Y";
break;
case AxisFlag.Z:
along = "Z";
break;
}
break;
//一、绕定轴X-Y-Z旋转RPY角
//二、绕动轴Z-Y-X旋转Euler角
case JointType.Revolute:
switch (joint.Axis.AxisFlag)
{
case AxisFlag.X:
along = "RX";
break;
case AxisFlag.Y:
along = "RY";
break;
case AxisFlag.Z:
along = "RZ";
break;
}
break;
}
return along;
}
/// <summary>
/// 计算位姿变换
/// </summary>
/// <param name="initCoordinate">初始坐标doule[7]</param>
/// <param name="along">沿着某个轴转X/Y/Z/RX/RY/RZ</param>
/// <param name="step">移动步长,转动单位弧度,移动单位与输入一致</param>
/// <returns>目标坐标doule[7]</returns>
static public PositionQuaternion TransformCoordinates(double[] initCoordinate, string along, double step, JointType jointType)
{
PositionQuaternion PoseLoactionQuaternion = new PositionQuaternion();
// 存储转换结果
//double[] res = new double[7];
if (jointType == JointType.Revolute)
{
step = step * Math.PI / 180;
}
var stepFloat = Convert.ToSingle(step);
// 初始姿态
var initPos = new System.Numerics.Vector3(Convert.ToSingle(initCoordinate[0]), Convert.ToSingle(initCoordinate[1]), Convert.ToSingle(initCoordinate[2]));
var initQua = new System.Numerics.Quaternion(Convert.ToSingle(initCoordinate[3]), Convert.ToSingle(initCoordinate[4]), Convert.ToSingle(initCoordinate[5]), Convert.ToSingle(initCoordinate[6]));
var resPos = new System.Numerics.Vector3();
var resQua = new System.Numerics.Quaternion();
resPos = initPos;
// 转动或移动
switch (along.ToUpper())
{
case "X":
{
resPos.X += stepFloat;
resQua = initQua;
break;
}
case "Y":
{
resPos.Y += stepFloat;
resQua = initQua;
break;
}
case "Z":
{
resPos.Z += stepFloat;
resQua = initQua;
break;
}
case "RX":
{
resPos = initPos;
var quaTrans = System.Numerics.Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), stepFloat);
resQua = System.Numerics.Quaternion.Multiply(initQua, quaTrans);
break;
}
case "RY":
{
resPos = initPos;
var quaTrans = System.Numerics.Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), stepFloat);
resQua = System.Numerics.Quaternion.Multiply(initQua, quaTrans);
break;
}
case "RZ":
{
resPos = initPos;
var quaTrans = System.Numerics.Quaternion.CreateFromAxisAngle(new Vector3(0, 0, 1), stepFloat);
resQua = System.Numerics.Quaternion.Multiply(initQua, quaTrans);
break;
}
}
//res[0] = resPos.X/1000;
//res[1] = resPos.Y/1000;
//res[2] = resPos.Z/1000;
//res[3] = resQua.X;
//res[4] = resQua.Y;
//res[5] = resQua.Z;
//res[6] = resQua.W;
PoseLoactionQuaternion.Position.X = resPos.X / 1000;
PoseLoactionQuaternion.Position.Y = resPos.Y / 1000;
PoseLoactionQuaternion.Position.Z = resPos.Z / 1000;
PoseLoactionQuaternion.Quaternion.X = resQua.X;
PoseLoactionQuaternion.Quaternion.Y = resQua.Y;
PoseLoactionQuaternion.Quaternion.Z = resQua.Z;
PoseLoactionQuaternion.Quaternion.W = resQua.W;
return PoseLoactionQuaternion;
}
#region Method
//public static void JointListRemove(List<Joint> JointList,List<Joint>JointListOld)
//{
// if (JointListOld == null) return;
// foreach(var item in JointListOld)
// {
// int index = JointList.FindIndex(t => t.Id == item.Id);
// if (index >= 0)
// {
// JointList.RemoveAt(index);
// }
// }
//}
///// <summary>
///// 将设备JointList加入系统列表
///// </summary>
///// <param name="JointList"></param>
///// <param name="jointList"></param>
//public static void JointListViewAddAndUpdate(List<Joint> JointList, List<Joint> jointList)
//{
// int index;
// foreach (var item in jointList)
// {
// index = JointList.FindIndex(t => t.Id == item.Id);
// if (index > -1)
// {
// JointList.RemoveAt(index);
// item.ValueCurrent = item.Value;
// JointList.Add(item);
// Joint.DataChange(item.Id, item.Value);
// }
// else
// {
// item.ValueCurrent = item.Value;
// JointList.Add(item);
// Joint.DataChange(item.Id, item.Value);
// }
// }
//}
#endregion
///// <summary>
///// 当前实际位置
///// </summary>
//public PositionFixedAngle PositionCurrent { get; set; }
///// <summary>
///// 根据输入值和倍率计算模型当前位置
///// </summary>
///// <param name="ValueInput"></param>
///// <returns></returns>
//public PositionFixedAngle GetPositionCurrent(double ValueInput)
//{
// Value = Value * ValueFactor;
// this.ValueInput = ValueInput;
// PositionCurrent.Position.X = Axis.Loaction.Position.X + positionNormalMatrix.x * Value;
// PositionCurrent.Position.Y = Axis.Loaction.Position.Y + positionNormalMatrix.y * Value;
// PositionCurrent.Position.Z = Axis.Loaction.Position.Z + positionNormalMatrix.z * Value;
// PositionCurrent.FixedAngle.R = Axis.Loaction.FixedAngle.R + positionNormalMatrix.rx * Value;
// PositionCurrent.FixedAngle.P = Axis.Loaction.FixedAngle.P + positionNormalMatrix.ry * Value;
// PositionCurrent.FixedAngle.Y = Axis.Loaction.FixedAngle.Y + positionNormalMatrix.rz * Value;
// return PositionCurrent;
//}
///// <summary>
///// 根据界面数据,给位置变换标准矩阵赋值
///// </summary>
///// <returns></returns>
//public PositionNormalMatrix SetPositionNormalMatrix()
//{
// positionNormalMatrix.x =0;
// positionNormalMatrix.y =0;
// positionNormalMatrix.z = 0;
// positionNormalMatrix.rx = 0;
// positionNormalMatrix.ry = 0;
// positionNormalMatrix.rz = 0;
// switch (JointType)
// {
// case JointType.Revolute:
// switch (Axis.AxisFlag)
// {
// case AxisFlag.X:
// positionNormalMatrix.rx = 1;
// break;
// case AxisFlag.Y:
// positionNormalMatrix.ry = 1;
// break;
// case AxisFlag.Z:
// positionNormalMatrix.rz = 1;
// break;
// }
// break;
// case JointType.Prismatic:
// switch (Axis.AxisFlag)
// {
// case AxisFlag.X:
// positionNormalMatrix.x = 1;
// break;
// case AxisFlag.Y:
// positionNormalMatrix.y = 1;
// break;
// case AxisFlag.Z:
// positionNormalMatrix.z = 1;
// break;
// }
// break;
// }
// switch (Axis.Flip)
// {
// case 1:
// positionNormalMatrix.x = -positionNormalMatrix.x;
// positionNormalMatrix.y = -positionNormalMatrix.y;
// positionNormalMatrix.z = -positionNormalMatrix.z;
// positionNormalMatrix.rx = -positionNormalMatrix.rx;
// positionNormalMatrix.ry = -positionNormalMatrix.rx;
// positionNormalMatrix.rz = -positionNormalMatrix.rx;
// break;
// }
// return positionNormalMatrix;
//}
}
#endregion
}

View File

@@ -0,0 +1,78 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace KinematicsBase
{
#region BaseClass
[Serializable]
public class JointPose
{
/// <summary>
/// 0
/// </summary>
public string JointId { get; set; }
/// <summary>
/// 1 名称
/// </summary>
public string JointName { get; set; }
public string ModelId { get; set; }
/// <summary>
/// 2 值
/// </summary>
public double Value { get; set; }
/// <summary>
/// 3 速度
/// </summary>
public double Speed { get; set; }
/// <summary>
/// 4 驱动关节
/// </summary>
public bool IsDriving { get; set; }
/// <summary>
/// 5 倍率
/// </summary>
public double ValueFactor { get; set; }
/// <summary>
/// 6 加速
/// </summary>
public double AccelerationStart { get; set; }
/// <summary>
/// 7 减速
/// </summary>
public double AccelerationEnd { get; set; }
/// <summary>
/// 8 最小值
/// </summary>
public double LowLimit { get; set; }
/// <summary>
/// 9 最大值
/// </summary>
public double HighLimit { get; set; }
/// <summary>
/// 10 时间
/// </summary>
public int Interval { get; set; }
public JointPose()
{
}
public JointPose(string JointId, string JointName)
{
this.JointId = JointId;
this.JointName = JointName;
Value = 0;
Speed = 100;
ValueFactor = 1;
}
}
#endregion
}

View File

@@ -0,0 +1,618 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Xml.Linq;
namespace KinematicsBase
{
[Serializable]
public class Kinematics
{
#region Fields
public string Id { get; set; }
public string ModelId { get; set; }
public string ModelName { get; set; }
public string OpName { get; set; }
public DeviceType DeviceType { get; set; }
public PositionQuaternionWithID Base { get; set; }
public PositionQuaternionWithID Flange { get; set; }
public PositionQuaternionWithID Tool { get; set; }
public List<Link> LinkList { get; set; } = new List<Link>();
public List<Joint> JointList { get; set; } = new List<Joint>();
/// <summary>
/// 按父子级排序
/// </summary>
public List<Joint> JointListOrderBy { get; set; } = new List<Joint>();
/// <summary>
/// 创建Joint时,自动创建两个姿态。Joint的最小值作为HOME姿态最大值作为姿态POSE
/// </summary>
public List<Pose> PoseList = new List<Pose>();
public List<Sensor> SensorList = new List<Sensor>();
#endregion
#region Constructor
public Kinematics()
{
}
#endregion
#region Link
/// <summary>
/// 根据Id删除Link
///
/// </summary>
/// <param name="id"></param>
public void RemoveLinkById(string id)
{
Link currentLink = null;
foreach (var link in LinkList)
{
if (link.Id == id)
{
currentLink = link;
break;
}
}
LinkList.Remove(currentLink);
}
/// <summary>
/// 根据Id内部ID非模型Id获取Link name和模型Id
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public string[] GetLinkNameModelIdById(string id)
{
string[] str = new[] { "Nan", "Nan" };
foreach (var link in LinkList)
{
if (link.Id == id)
{
str[0] = link.Name;
str[1] = link.LinkElements[0].Id;
return str;
}
}
return str;
}
/// <summary>
/// 根据ID获取Link
/// </summary>
/// <param name="linkList"></param>
/// <param name="id"></param>
/// <returns></returns>
public Link GetLinkById(string id)
{
foreach (var link in LinkList)
{
if (link.Id == id)
{
return link;
}
}
return null;
}
public List<string> GetLastLinkId()
{
var res = new List<string>();
//var lastLinkId = "";
//var lastLinkName = "";
//foreach (var link in LinkList)
//{
// foreach (var joint in JointList)
// {
// if (link.LinkElements[0].Id == joint.ParentLinkId)
// {
// continue;
// }
// lastLinkId = link.LinkElements[0].Id;
// lastLinkName = link.LinkElements[0].Name;
// }
//}
var link = LinkList.Find(o=>o.Name.Contains("_6"));
var lastLinkId = link.LinkElements[0].Id;
var lastLinkName = link.LinkElements[0].Name;
res.Add(lastLinkId);
res.Add(lastLinkName);
return res;
}
#endregion
#region Clone
public static List<T> Clone<T>(object List)
{
using (Stream objectStream = new MemoryStream())
{
IFormatter formatter = new BinaryFormatter();
formatter.Serialize(objectStream, List);
objectStream.Seek(0, SeekOrigin.Begin);
return formatter.Deserialize(objectStream) as List<T>;
}
}
#endregion
#region SensorSetup
public static void SensorSetup()
{
foreach (var k in PP.ReturnKinematicsList())
{
foreach (var sensor in k.SensorList)
{
sensor.Setup();
}
}
}
#endregion
#region Joint
public static void SetJointValueCurrent(string modelId, string id, double val)
{
// Kinematics k = DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == modelId);
var k = PP.ModelCodeFindModelAttribute(modelId).KinematicsData;
k.JointList.FirstOrDefault(t => t.Id == id).ValueCurrent = val;
Joint.DataChange(k.ModelId, id, val);
}
//public static void SetJointValueCurrentPosition(string modelId, string id, double val,double valePosition)
//{
// Kinematics k = DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == modelId);
// k.JointList.FirstOrDefault(t => t.Id == id).ValueCurrent = val+ valePosition;
// Joint.DataChange(k.ModelId, id, val);
//}
//public void SetJointValueCurrent(string id, double val)
//{
// //Kinematics k = DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == modelId);
// this.JointList.FirstOrDefault(t => t.Id == id).ValueCurrent = val;
//}
public static void SetJointListValueCurrent(string modelId, Pose pose)
{
// Kinematics k = DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == modelId);
var k = PP.ModelCodeFindModelAttribute(modelId).KinematicsData;
foreach (var item in k.JointList)
{
item.ValueCurrent = pose.PoseInfo[item.Id];
Joint.DataChange(k.ModelId, item.Id, Convert.ToSingle(item.ValueCurrent));
}
}
//public void SetJointListValueCurrent(Pose pose)
//{
// foreach (var item in this.JointList)
// {
// item.Value = pose.PoseInfo[item.Id];
// }
//}
public static string GoeModleIdByPoseId(string poseId)
{
foreach (var k in PP.ReturnKinematicsList())
{
var pose = k.PoseList.FirstOrDefault(t => t.Id == poseId);
if (pose != null)
{
return k.ModelId;
}
}
return null;
}
public static double GetJointValueCurrent(string modelId, string id)
{
//Kinematics k = DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == modelId);
var k = PP.ModelCodeFindModelAttribute(modelId).KinematicsData;
return k.JointList.FirstOrDefault(t => t.Id == id).ValueCurrent;
}
public static Pose GetPoseByPoseId(string poseId)
{
List<Pose> PoseListView = new List<Pose>();
foreach (var item in PP.ReturnKinematicsList())
{
PoseListView.AddRange(item.PoseList);
}
return PoseListView.FirstOrDefault(t => t.Id == poseId);
}
public static List<Joint> GetJointListView()
{
List<Joint> JointListView = new List<Joint>();
foreach (var item in PP.ReturnKinematicsList())
{
JointListView.AddRange(item.JointList);
}
return JointListView;
}
public static List<Sensor> GetSensorListView()
{
List<Sensor> SensorListView = new List<Sensor>();
foreach (var item in PP.ReturnKinematicsList())
{
SensorListView.AddRange(item.SensorList);
}
return SensorListView;
}
//SensorListView
//JointListView
public static Pose GetPoseByModeIdAndPoseId(string modelId, string poseId)
{
// return DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == modelId).PoseList.FirstOrDefault(t => t.Id == poseId);
return PP.ModelCodeFindModelAttribute(modelId).KinematicsData.PoseList.FirstOrDefault(t => t.Id == poseId);
}
public static string GetModelNameByModelId(string modelId)
{
// Kinematics k = DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == modelId);
var k = PP.ModelCodeFindModelAttribute(modelId).KinematicsData;
return k.ModelName;
}
public static List<Joint> GetJointListByModelId(string modelId)
{
// return DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == modelId).JointList;
return PP.ModelCodeFindModelAttribute(modelId).KinematicsData.JointList;
}
public static Joint GetJointByModelIdAndJointId(string modelId, string jointId)
{
// return DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == modelId).JointList.FirstOrDefault(t => t.Id == jointId);
return PP.ModelCodeFindModelAttribute(modelId).KinematicsData.JointList.FirstOrDefault(t => t.Id == jointId);
}
public static Kinematics GetKinematicsByModelId(string modelId)
{
// return DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == modelId);
return PP.ModelCodeFindModelAttribute(modelId).KinematicsData;
}
//Kinematics.SetJointValueCurrent(modelId, jId, valuCurrent);
/// <summary>
/// 根据Id删除joint
/// </summary>
/// <param name="id"></param>
public void RemeveJointById(string id)
{
Joint currentJoint = null;
foreach (var joint in JointList)
{
if (joint.Id == id)
{
currentJoint = joint;
break;
}
}
JointList.Remove(currentJoint);
}
///// <summary>
///// 根据ID获取Joint
///// </summary>
///// <param name="jointList"></param>
///// <param name="id"></param>
///// <returns></returns>
//public Joint GetJointById(string id)
//{
// foreach (var joint in JointList)
// {
// if (joint.Id == id)
// {
// return joint;
// }
// }
// return null;
//}
//topId = 0;
// var list = GetSonNode(topId, nodeList);
// foreach (var item in list)
// {
// Console.WriteLine("id = "+item.Id+ "/nParentId="+item.ParentId+ "/nMame = " +item.Name);
// }
/// <summary>
/// Joint 按父节点到子节点递归排序
/// </summary>
/// <param name="id"></param>
/// <param name="nodeList"></param>
/// <returns></returns>
private List<Joint> GetSonNode(string ChildLinkId, List<Joint> nodeList)
{
var query = nodeList.Where(c => c.ParentLinkId == ChildLinkId);
return query.ToList().Concat(query.ToList().SelectMany(t => GetSonNode(t.ChildLinkId, nodeList))).ToList();
}
private string GetParents(string ChildLinkId, List<Joint> list)
{
List<Joint> result = list.Where(x => x.ChildLinkId == ChildLinkId).ToList();
if (result.Count > 0 && result[0].ParentLinkId != "" && result[0].ParentLinkId.ToString() != "")
return GetParents(result[0].ParentLinkId, list);
else
return ChildLinkId;
}
/// <summary>
/// Joint 按父节点到子节点递归排序
/// </summary>
/// <returns></returns>
public List<Joint> GetSonNode()
{
List<Joint> nodeList = JointList;
if (nodeList.Count < 1) return null;
string ChildLinkId_init = nodeList[0].ChildLinkId;
string ChildLinkId = GetParents(ChildLinkId_init, nodeList);
List<Joint> result;
result = GetSonNode(ChildLinkId, nodeList);
return result;
}
/// <summary>
/// 关节联动时
/// 计算每个关节的值
/// </summary>
/// <param name="nodeList"></param>
/// <param name="val"></param>
public string JointListValueCurrent(double val)
{
JointListOrderBy = GetSonNode();
List<Joint> nodeList;
nodeList = JointListOrderBy;
JArray jarrayObj = new JArray();
Dictionary<string, double> dicJointListValueCurrent = new Dictionary<string, double>();
dicJointListValueCurrent.Add(nodeList[0].ParentLinkId, val);
for (int i = 0; i < nodeList.Count; i++)
{
nodeList[i].ValueCurrent = dicJointListValueCurrent[nodeList[i].ParentLinkId] * nodeList[i].ValueFactor;
if (!dicJointListValueCurrent.ContainsKey(nodeList[i].ChildLinkId))
{
dicJointListValueCurrent.Add(nodeList[i].ChildLinkId, nodeList[i].ValueCurrent);
}
}
foreach (var joint in nodeList)
{
var jObj = new JObject();
jObj["jId"] = joint.Id;
jObj["jValue"] = joint.ValueCurrent + Joint.GetJointPosition(joint); ;
jarrayObj.Add(jObj);
SetJointValueCurrent(this.ModelId, joint.Id, joint.ValueCurrent);
//Joint.DataChange(this.ModelId, joint.Id, joint.ValueCurrent);
}
var jsonData = new JObject(
new JProperty("ModelId", this.ModelId),
new JProperty("MotionType", "3"),
new JProperty("MotionInfo", jarrayObj)
);
var jsonStr = jsonData.ToString().Replace("\n", "").Replace("\r", "").Replace(" ", "");
string message = "|SendMotionInfo|" + jsonStr;
return message;
}
public List<C_ObjStates> JointListValueCurrentNew(double val)
{
List<C_ObjStates> ObjStatesList = new List<C_ObjStates>();
List<C_ObjStates> objStates = new List<C_ObjStates>();
JointListOrderBy = GetSonNode();
List<Joint> nodeList;
nodeList = JointListOrderBy;
JArray jarrayObj = new JArray();
Dictionary<string, double> dicJointListValueCurrent = new Dictionary<string, double>();
dicJointListValueCurrent.Add(nodeList[0].ParentLinkId, val);
for (int i = 0; i < nodeList.Count; i++)
{
nodeList[i].ValueCurrent = dicJointListValueCurrent[nodeList[i].ParentLinkId] * nodeList[i].ValueFactor;
if (!dicJointListValueCurrent.ContainsKey(nodeList[i].ChildLinkId))
{
dicJointListValueCurrent.Add(nodeList[i].ChildLinkId, nodeList[i].ValueCurrent);
}
}
foreach (var joint in nodeList)
{
var jObj = new JObject();
jObj["jId"] = joint.Id;
jObj["jValue"] = joint.ValueCurrent + Joint.GetJointPosition(joint); ;
jarrayObj.Add(jObj);
SetJointValueCurrent(this.ModelId, joint.Id, joint.ValueCurrent);
objStates = new OPERATION_FramesList().GetObjStates(this.ModelId, joint.Id, joint.ValueCurrent);
foreach (var item in objStates)
{
ObjStatesList.Add(item);
}
//Joint.DataChange(this.ModelId, joint.Id, joint.ValueCurrent);
}
return ObjStatesList;
}
#endregion
#region KinematicsList
/// <summary>
/// 根据设备代码判断设备是否存在
/// </summary>
/// <param name="modelId"></param>
/// <returns></returns>
public static Kinematics KinematicsListFindByModelId(string modelId)
{
// var k = DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == modelId);
var k = PP.ModelCodeFindModelAttribute(modelId).KinematicsData;
return k;
}
/// <summary>
/// 设备存在,更新;不存在增加
/// </summary>
/// <param name="k"></param>
/// <returns></returns>
public static void KinematicsListAddAndUpDate(Kinematics k)
{
// var objK = DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == k.ModelId);
var objK = PP.ModelCodeFindModelAttribute(k.ModelId).KinematicsData;
if (objK == null)
{
// DataBaseJson.dataBaseJson.KinematicsList.Add(k);
foreach (var item in k.SensorList)
{
switch (item.SensorType)
{
case SensorType.IsRun:
Joint.OnDataChangeJointIsRun -= item.Joint_OnDataChangeJointIsRun;
Joint.OnDataChangeJointIsRun += item.Joint_OnDataChangeJointIsRun;
break;
default:
Joint.OnDataChange -= item.Joint_OnDataChange;
Joint.OnDataChange += item.Joint_OnDataChange;
break;
}
}
}
else
{
foreach (var item in k.SensorList)
{
switch (item.SensorType)
{
case SensorType.IsRun:
Joint.OnDataChangeJointIsRun -= item.Joint_OnDataChangeJointIsRun;
Joint.OnDataChangeJointIsRun += item.Joint_OnDataChangeJointIsRun;
break;
default:
Joint.OnDataChange -= item.Joint_OnDataChange;
Joint.OnDataChange += item.Joint_OnDataChange;
break;
}
}
objK = k;
}
// Event.KinematicsDataChange(k);
}
private double GetJointPosition(Kinematics k, string jointId)
{
double val = -1;
var item = k.JointList.FirstOrDefault(t => t.Id == jointId);
switch (item.JointType)
{
case JointType.Prismatic:
switch (item.Axis.AxisFlag)
{
case AxisFlag.X:
val = Convert.ToSingle(item.Axis.Loaction.Position.X);
break;
case AxisFlag.Y:
val = Convert.ToSingle(item.Axis.Loaction.Position.Y);
break;
case AxisFlag.Z:
val = Convert.ToSingle(item.Axis.Loaction.Position.Z);
break;
}
break;
//一、绕定轴X-Y-Z旋转RPY角
//二、绕动轴Z-Y-X旋转Euler角
case JointType.Revolute:
switch (item.Axis.AxisFlag)
{
case AxisFlag.X:
val = Convert.ToSingle(item.Axis.Loaction.FixedAngle.R);
break;
case AxisFlag.Y:
val = Convert.ToSingle(item.Axis.Loaction.FixedAngle.P);
break;
case AxisFlag.Z:
val = Convert.ToSingle(item.Axis.Loaction.FixedAngle.Y);
break;
}
break;
}
return val;
}
///// <summary>
///// 根据设备代码删除设备信息
///// </summary>
///// <param name="modelId"></param>
///// <returns></returns>
//public static bool KinematicsListRemoveByModelId(string modelId)
//{
// var k = DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == modelId);
// if (k != null)
// {
// DataBaseJson.dataBaseJson.KinematicsList.Remove(k);
// return true;
// }
// return false;
//}
#endregion
}
}

View File

@@ -0,0 +1,58 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace KinematicsBase
{
#region Link
[Serializable]
public class LinkElem
{
public LinkElem()
{
}
public LinkElem(string id, string name)
{
this.Id = id;
this.Name = name;
}
public string Id { get; set; }
public string Name { get; set; }
}
[Serializable]
public class Link
{
public Link()
{
this.GraphPosition = new System.Drawing.Point(0, 0);
}
public Link(string id, string name, bool isFixed = false)
{
this.Id = id;
this.Name = name;
this.IsFixed = isFixed;
}
public System.Drawing.Point GraphPosition { set; get; }
public string Id { get; set; }
public string ModelId { get; set; }
public bool IsFixed { get; set; }
public string Name { get; set; }
public List<LinkElem> LinkElements { get; set; } = new List<LinkElem>();
}
#endregion
}

View File

@@ -0,0 +1,178 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace KinematicsBase
{
public class OPERATION_FramesList
{
public C_OPERATION FramesListCreate(string startPoseId, string endPoseId, int Interval)
{
Pose startPose;
Pose endPose;
startPose = Kinematics.GetPoseByPoseId(startPoseId);
endPose = Kinematics.GetPoseByPoseId(endPoseId);
if(startPose != null && endPose != null)
{
return FramesListCreate(startPose, endPose, Interval);
}
else
{
MessageBox.Show("姿态不存在", "提示");
throw new Exception("Pose不存在");
}
}
public C_OPERATION FramesListCreate(Pose startPose, Pose endPose, int Interval)
{
// int framStep = 10;
int framStep = PP.PCP.FrameValue;
List<Pose> PoseList;
PoseList = OPERATION_GetDifferencePoseList(startPose, endPose, Interval, framStep);
return FramesCreate(PoseList);
}
public C_OPERATION FramesCreate(List<Pose> PoseList)
{
List<C_ObjStates> objStates;
double timeIndex;
int framStep = 10;
C_Frames frames;
C_OPERATION m_OPERATION_Frames = new C_OPERATION();
for (int i = 0; i < PoseList.Count; i++)
{
Pose pose = PoseList[i];
timeIndex = (double)(framStep * i) / 1000;
objStates = GetObjStates(pose);
frames = new C_Frames();
frames.time = timeIndex.ToString("0.00");
frames.objStates = objStates;
m_OPERATION_Frames.frames.Add(frames);
}
return m_OPERATION_Frames;
}
#region Method
/// <summary>
///
/// </summary>
/// <param name="startPose"></param>
/// <param name="endPose"></param>
/// <param name="Interval">单位毫秒</param>
public List<Pose> OPERATION_GetDifferencePoseList(Pose startPose, Pose endPose, int Interval, int framStep)
{
List<Pose> PoseList = new List<Pose>();
Pose pose;
Dictionary<string, double> jointStep = new Dictionary<string, double>();
int frameCount;
frameCount = Interval / framStep;
//计算Joint的步长
foreach (var item in endPose.PoseInfo)
{
double value = (endPose.PoseInfo[item.Key] - startPose.PoseInfo[item.Key]) / frameCount;
jointStep.Add(item.Key, value);
}
for (int i = 0; i < frameCount; i++)
{
if (i == 0)
{
pose = new Pose();
pose.ModelId = endPose.ModelId;
pose.PoseInfo = new Dictionary<string, double>();
foreach (var item in endPose.PoseInfo)
{
pose.PoseInfo.Add(item.Key, startPose.PoseInfo[item.Key]);
}
PoseList.Add(pose);
}
else if (i == frameCount - 1)
{
pose = new Pose();
pose.ModelId = endPose.ModelId;
pose.PoseInfo = new Dictionary<string, double>();
foreach (var item in endPose.PoseInfo)
{
pose.PoseInfo.Add(item.Key, endPose.PoseInfo[item.Key]);
}
PoseList.Add(pose);
}
else
{
pose = new Pose();
pose.ModelId = endPose.ModelId;
pose.PoseInfo = new Dictionary<string, double>();
foreach (var item in endPose.PoseInfo)
{
pose.PoseInfo.Add(item.Key, startPose.PoseInfo[item.Key] + i * jointStep[item.Key]);
}
PoseList.Add(pose);
}
}
return PoseList;
}
#endregion
public List<C_ObjStates> GetObjStates(Pose pose)
{
List<Joint> JointList = Kinematics.GetJointListByModelId(pose.ModelId);
List<C_ObjStates> objStates = new List<C_ObjStates>();
foreach (var item in pose.PoseInfo)
{
var joint = JointList.FirstOrDefault(t => t.Id == item.Key);
var objStateSubList = GetObjStates(pose.ModelId, joint.Id, item.Value);
foreach (var objState in objStateSubList)
{
objStates.Add(objState);
}
}
return objStates;
}
public List<C_ObjStates> GetObjStates(string modelId, string jId, double jValue)
{
List<Joint> JointList = Kinematics.GetJointListByModelId(modelId);
List<C_ObjStates> objStates = new List<C_ObjStates>();
//foreach (var item in pose.PoseInfo)
var joint = JointList.FirstOrDefault(t => t.Id == jId);
//1.反向0.正常
if (joint.Axis.Flip == 1)
{
jValue = -jValue;
}
//值按比例和初始值变换
jValue = jValue * joint.ValueFactor + joint.Value;
//var value = ChangeToModelValue(JointList, jId, jValue);
PositionQuaternion positionQuaternion = new Joint().TransformCoordinates(joint, jValue);
C_ObjStates objState = new C_ObjStates();
objState.i = joint.CId;
objState.tx = positionQuaternion.Position.X.ToString("0.000000");
objState.ty = positionQuaternion.Position.Y.ToString("0.000000");
objState.tz = positionQuaternion.Position.Z.ToString("0.000000");
objState.qx = positionQuaternion.Quaternion.X.ToString("0.000000");
objState.qy = positionQuaternion.Quaternion.Y.ToString("0.000000");
objState.qz = positionQuaternion.Quaternion.Z.ToString("0.000000");
objState.qw = positionQuaternion.Quaternion.W.ToString("0.000000");
objStates.Add(objState);
return objStates;
}
}
}

View File

@@ -0,0 +1,360 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace KinematicsBase
{
[Serializable]
public class HomeOpen
{
public static string HOME = "HOME";
public static string OPEN = "OPEN";
public static string Position = "Position";
public static string Current = "Current";
}
[Serializable]
public class Pose
{
public static event Action<string, Pose> OnDataChange = null;
public Pose()
{
this.Id = Guid.NewGuid().ToString("D").ToUpper();
}
public Pose(Kinematics k)
{
this.Id = Guid.NewGuid().ToString("D").ToUpper();
JointPoseListCreate(k);
}
public Pose(string id, string name)
{
this.Id = id;
this.Name = name;
}
public string Id { get; set; }
public string Name { get; set; }
public string ModelId { get; set; }
/// <summary>
/// ture 独立运行
/// </summary>
public bool IsJointByself { get; set; }
public List<JointPose> JointPoseList { get; set; }
/// <summary>
/// 关节是否联动
/// </summary>
public bool JointGearing { get; set; }
/// <summary>
/// 时间优先时候的时间,单位毫秒
/// </summary>
public int Interval { get; set; }
/// <summary>
/// 时间优先或速度优先
/// </summary>
public MoveToPosePriorType m_MoveToPosePriorType { get; set; }
/// <summary>
/// string JointId double value
/// </summary>
public Dictionary<string, double> PoseInfo { get; set; } = new Dictionary<string, double>();
#region Method
public static void DataChange(string ModelId, Pose pose)
{
if (OnDataChange != null)
{
OnDataChange.Invoke(ModelId, pose);
}
}
private void JointPoseListCreate(Kinematics k)
{
this.JointPoseList = new List<JointPose>();
var JointListOrderByName = k.JointList.OrderBy(o => o.Name).ToList();
foreach (var item in JointListOrderByName)
{
this.JointPoseList.Add(new JointPose(item.Id, item.Name));
}
}
//public static void PoseListViewCreate(List<Pose> PoseViewList, List<Joint> joints)
//{
// Pose pose;
// double val=-1;
// pose = new Pose();
// pose.Name = "JointPosition";
// pose.Id = Guid.NewGuid().ToString("D").ToUpper();
// pose.Interval = 3000;
// //删除相同的JointList
// PoseListViewRemove(PoseViewList, joints);
// foreach (var item in joints)
// {
// switch (item.JointType)
// {
// case JointType.Prismatic:
// switch (item.Axis.AxisFlag)
// {
// case AxisFlag.X:
// val = Convert.ToSingle( item.Axis.Loaction.Position.X);
// break;
// case AxisFlag.Y:
// val = Convert.ToSingle( item.Axis.Loaction.Position.Y);
// break;
// case AxisFlag.Z:
// val = Convert.ToSingle( item.Axis.Loaction.Position.Z);
// break;
// }
// break;
// //一、绕定轴X-Y-Z旋转RPY角
// //二、绕动轴Z-Y-X旋转Euler角
// case JointType.Revolute:
// switch (item.Axis.AxisFlag)
// {
// case AxisFlag.X:
// val = Convert.ToSingle( item.Axis.Loaction.FixedAngle.R);
// break;
// case AxisFlag.Y:
// val = Convert.ToSingle( item.Axis.Loaction.FixedAngle.P);
// break;
// case AxisFlag.Z:
// val = Convert.ToSingle( item.Axis.Loaction.FixedAngle.Y);
// break;
// }
// break;
// }
// pose.PoseInfo.Add(item.Id, val);
// }
// PoseViewList.Add(pose);
//}
//public static void PoseListViewRemove(List<Pose> PoseViewList, List<Joint> joints)
//{
// Pose pose=null;
// foreach(var joint in joints)
// {
// foreach (var item in PoseViewList)
// {
// if (item.PoseInfo.ContainsKey(joint.Id))
// {
// pose = item;
// break;
// }
// }
// }
// if(pose != null)
// {
// PoseViewList.Remove(pose);
// }
//}
//public static void PoseCurrentViewListSetValue(List<Pose> PoseList, string id,double val)
//{
// foreach(var poseItem in PoseList)
// {
// if (poseItem.PoseInfo.ContainsKey(id))
// {
// poseItem.PoseInfo[id] = val;
// break;
// }
// }
//}
public static void HomeAndOpenPositionCreate(Kinematics k)
{
Pose pose;
//HOME
pose = Pose.CreatePoseHome(k);
Pose.PoseListAddAndUpdateByName(k.PoseList, pose);
//OPEN
pose = Pose.CreatePoseOpen(k);
Pose.PoseListAddAndUpdateByName(k.PoseList, pose);
////Position
//pose = Pose.PosePositionCreator(k);
//Pose.PoseListAddAndUpdateByName( k.PoseList, pose);
}
public static Pose PosePositionCreator(Kinematics k)
{
Pose pose;
double val = -1;
pose = new Pose(k);
pose.Name = "Position";
pose.ModelId = k.ModelId;
pose.Interval = 3000;
pose.PoseInfo = new Dictionary<string, double>();
foreach (var item in k.JointList)
{
var joint = k.JointList.FirstOrDefault(t => t.Id == item.Id);
val = Joint.GetJointPosition(joint);
pose.PoseInfo.Add(item.Id, val);
}
return pose;
}
//public static Pose PoseCurrentCreator(List<Joint> joints)
//{
// Pose pose;
// double val = -1;
// pose = new Pose(k);
// pose.Name = "Current";
// pose.Id = Guid.NewGuid().ToString("D").ToUpper();
// pose.Interval = 3000;
// foreach (var item in joints)
// {
// switch (item.JointType)
// {
// case JointType.Prismatic:
// switch (item.Axis.AxisFlag)
// {
// case AxisFlag.X:
// val = Convert.ToSingle(item.Axis.Loaction.Position.X);
// break;
// case AxisFlag.Y:
// val = Convert.ToSingle(item.Axis.Loaction.Position.Y);
// break;
// case AxisFlag.Z:
// val = Convert.ToSingle(item.Axis.Loaction.Position.Z);
// break;
// }
// break;
// //一、绕定轴X-Y-Z旋转RPY角
// //二、绕动轴Z-Y-X旋转Euler角
// case JointType.Revolute:
// switch (item.Axis.AxisFlag)
// {
// case AxisFlag.X:
// val = Convert.ToSingle(item.Axis.Loaction.FixedAngle.R);
// break;
// case AxisFlag.Y:
// val = Convert.ToSingle(item.Axis.Loaction.FixedAngle.P);
// break;
// case AxisFlag.Z:
// val = Convert.ToSingle(item.Axis.Loaction.FixedAngle.Y);
// break;
// }
// break;
// }
// pose.PoseInfo.Add(item.Id, val);
// }
// return pose;
//}
public static void PoseListAddAndUpdateByName(List<Pose> PoseList, Pose val)
{
var poseIndex = PoseList.FindIndex(t => t.Name == val.Name);
if (poseIndex > -1)
{
PoseList[poseIndex] = val;
}
else
{
PoseList.Add(val);
}
}
//public static void PoseListAddAndUpdate(List<Pose> PoseList, Pose val)
//{
// var obj = PoseList.FirstOrDefault(t => t.Id == val.Id);
// if (obj != null)
// {
// val.Id = obj.Id;
// PoseList.Remove(obj);
// PoseList.Add(val);
// }
// else
// {
// PoseList.Add(val);
// }
//}
//public static void PoseListRemoveById(List<Pose> PoseList, string id)
//{
// var obj = PoseList.FirstOrDefault(t => t.Id == id);
// if (obj != null)
// {
// PoseList.Remove(obj);
// }
//}
public static Pose PoseListFindById(List<Pose> PoseList, string id)
{
return PoseList.FirstOrDefault(t => t.Id == id);
}
//public static void PoseListAddAndUpdate(List<Pose> ObjList, List<Pose> objList)
//{
// List<Pose> objListBak = new List<Pose>(objList);
// foreach (var item in objList)
// {
// var pose = ObjList.FirstOrDefault(t => t.Id == item.Id);
// if (pose!=null)
// {
// Pose pValue = objListBak.FirstOrDefault(t => t.Id == item.Id);
// pValue.Id = pose.Id;
// ObjList.Remove(pose);
// ObjList.Add(pValue);
// }
// else
// {
// ObjList.Add(item);
// }
// }
//}
//public static void PoseListAddAndUpdateHomeAndPose(List<Joint> JointList, List<Pose> PostList)
//{
// Pose pose;
// pose = CreatePoseHome(JointList);
// PoseListAddAndUpdateByName(PostList, pose);
// pose = CreatePoseOpen(JointList);
// PoseListAddAndUpdateByName(PostList, pose);
//}
/// <summary>
/// 用 Joint最小值
/// </summary>
/// <param name="JointList"></param>
/// <returns></returns>
public static Pose CreatePoseHome(Kinematics k)
{
Pose pose;
pose = new Pose(k);
pose.Name = HomeOpen.HOME;
pose.ModelId = k.ModelId;
pose.Interval = 3000;
pose.PoseInfo.Clear();
foreach (Joint joint in k.JointList)
{
var list_Limit = new List<double>();
list_Limit.Add(Math.Abs(joint.JointLimit.LowLimit));
list_Limit.Add(Math.Abs(joint.JointLimit.HighLimit));
pose.PoseInfo.Add(joint.Id, list_Limit.Min());
}
return pose;
}
/// <summary>
/// 用 Joint最大值
/// </summary>
/// <param name="JointList"></param>
/// <returns></returns>
public static Pose CreatePoseOpen(Kinematics k)
{
Pose pose;
pose = new Pose(k);
pose.Name = HomeOpen.OPEN;
pose.ModelId = k.ModelId;
pose.Interval = 3000;
pose.PoseInfo.Clear();
foreach (Joint joint in k.JointList)
{
var list_Limit = new List<double>();
list_Limit.Add(Math.Abs(joint.JointLimit.LowLimit));
list_Limit.Add(Math.Abs(joint.JointLimit.HighLimit));
pose.PoseInfo.Add(joint.Id, list_Limit.Max());
}
return pose;
}
#endregion
}
}

View File

@@ -0,0 +1,553 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace KinematicsBase
{
#region BaseClass
#region Data Define
/// <summary>
/// 传感器类型
/// </summary>
[Serializable]
public enum SensorType
{
/// <summary>
/// 姿态传感器
/// </summary>
Pose,
/// <summary>
/// 关节距离传感器
/// </summary>
Distance,
/// <summary>
/// 关节传感器
/// 判断关节位置
/// </summary>
Joint,
/// <summary>
/// 接近传感器
/// </summary>
Near,
/// <summary>
/// 光电传感器
/// </summary>
PhotoElectric,
/// <summary>
/// 属性传感器
/// </summary>
Attribution,
/// <summary>
/// Joint的值变化 ture
/// 不变化 false
/// </summary>
IsRun
}
/// <summary>
/// 信号触发方式
/// </summary>
/// [Serializable]
public enum TrigerType
{
Pulse,
Limit,
StepBegin,
StepEnd
}
[Serializable]
public enum SensorDataType
{
INT,
DINT,
FLOAT,
DOUBLE
}
#endregion
/// <summary>
/// 姿态传感器
/// </summary>
[Serializable]
public class Sensor
{
///// <summary>
///// 向外部发出传感器信号
///// </summary>
//public static event Action<string, object> OnDataChange = null;
/// <summary>
/// string ModeId, string PoseId, string JointId, string Id, object Value
/// </summary>
public static event Action<string, string, string, string, object> OnDataChange;
//public static event Action<string, string, string, string, bool> OnDataChangeBool;
//public static event Action<string, string, string, string, int> OnDataChangeInt;
//public static event Action<string, string, string, string, double> OnDataChangeFloat;
public string Id { get; set; }
public string Name { get; set; }
public string ModelId { get; set; }
public bool I = false;
public SensorType SensorType { get; set; }
public TrigerType TrigerType { get; set; }
public string PoseId { get; set; } = "";
/// <summary>
/// PoseId =0和姿态距离传感器用
/// </summary>
public string JointId { get; set; } = "";
public UnitType UnitType { get; set; }
public SensorDataType SensorDataType { get; set; }
/// <summary>
/// 传感器是否启用
/// </summary>
public bool IsEnable { get; set; }
///// <summary>
///// PLC 变量代码
///// </summary>
//public string SignalViewer_Id;
/// <summary>
/// 姿态传感器 光电传感器
/// 触发后返回值 01
/// 或伺服值
/// </summary>
public object Tagvalue { get; set; }
/// <summary>
/// 触发值测试误差值上限
/// </summary>
public double LimitUpValue { get; set; } = 2f;
/// <summary>
/// 触发值测试误差值下限
/// </summary>
public double LimitDownValue { get; set; } = -2f;
/// <summary>
/// 光电传感器 检测长度用
/// </summary>
public double Length { get; set; }
public double ValueFactor { get; set; } = 1;
public Sensor()
{
this.Id = Guid.NewGuid().ToString("D").ToUpper();
}
public void Setup()
{
switch (SensorType)
{
case SensorType.Pose:
SetupPose();
break;
case SensorType.Distance:
SetupDistance();
break;
case SensorType.Joint:
SetupJoint();
break;
}
}
private void SetupJoint()
{
bool isTriger = false;
//Kinematics k = DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == ModelId);
var k = PP.ModelCodeFindModelAttribute(ModelId).KinematicsData;
if (k == null) return;
var val = k.JointList.FirstOrDefault(t => t.Id == JointId).ValueCurrent;
var jValue = k.PoseList.FirstOrDefault(t => t.Id == PoseId).PoseInfo[JointId];
if ((val >= jValue + LimitDownValue) && (val <= jValue + LimitDownValue))
{
isTriger = true;
}
else
{
isTriger = false;
}
I = isTriger;
DataChange(ModelId, PoseId, JointId, Id, I);
}
private void SetupDistance()
{
// Kinematics k = DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == ModelId);
var k = PP.ModelCodeFindModelAttribute(ModelId).KinematicsData;
if (k == null) return;
double val = k.JointList.FirstOrDefault(t => t.Id == JointId).ValueCurrent;
object value;
switch (SensorDataType)
{
case SensorDataType.INT:
value = Convert.ToInt32(val);
DataChange(ModelId, PoseId, JointId, Id, value);
break;
case SensorDataType.DINT:
value = (long)val;
DataChange(ModelId, PoseId, JointId, Id, value);
break;
case SensorDataType.FLOAT:
value = (double)val;
DataChange(ModelId, PoseId, JointId, Id, value);
break;
case SensorDataType.DOUBLE:
value = (double)val;
DataChange(ModelId, PoseId, JointId, Id, value);
break;
}
}
private void SetupPose()
{
//double val = (double)vale;
bool isTriger = false;
bool isTrigerJoint;
int index = 0;
//Kinematics k = DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == ModelId);
var k = PP.ModelCodeFindModelAttribute(ModelId).KinematicsData;
if (k == null) return;
//监控POSE的全部姿态
var pose = k.PoseList.FirstOrDefault(t => t.Id == PoseId);
if (pose == null) return;
foreach (var item in pose.PoseInfo)
{
double currentValue = k.JointList.FirstOrDefault(t => t.Id == item.Key).ValueCurrent;
if ((currentValue >= item.Value + LimitDownValue) && (currentValue <= item.Value + LimitUpValue))
{
isTrigerJoint = true;
}
else
{
isTrigerJoint = false;
}
if (!isTrigerJoint)
{
isTriger = false;
break;
}
else
{
if (index == 0)
{
isTriger = isTrigerJoint;
}
else
{
isTriger = isTriger && isTrigerJoint;
}
if (isTriger == false)
{
break;
}
}
index++;
}
I = isTriger;
DataChange(ModelId, PoseId, JointId, Id, I);
}
public Sensor(SensorType SensorType)
{
this.Id = Guid.NewGuid().ToString("D").ToUpper();
Tagvalue = 0;
switch (SensorType)
{
case SensorType.IsRun:
Joint.OnDataChangeJointIsRun -= Joint_OnDataChangeJointIsRun;
Joint.OnDataChangeJointIsRun += Joint_OnDataChangeJointIsRun;
break;
default:
Joint.OnDataChange -= Joint_OnDataChange;
Joint.OnDataChange += Joint_OnDataChange;
break;
}
}
public void Joint_OnDataChangeJointIsRun(string modelId, string jointId, bool val)
{
if (this.ModelId == modelId && this.JointId == jointId)
{
I = val;
DataChange(ModelId, PoseId, JointId, Id, I);
}
}
public string CreateSensorPose(string modelId, string poseId)
{
this.Id = Guid.NewGuid().ToString("D").ToUpper();
Joint.OnDataChange -= Joint_OnDataChange;
Joint.OnDataChange += Joint_OnDataChange;
Tagvalue = 0;
this.IsEnable = true;
this.PoseId = poseId;
var kTemp = Kinematics.GetKinematicsByModelId(modelId);
{
this.Name = kTemp.ModelName + "_PS_Logical_1";
this.SensorType = SensorType.Pose;
}
this.ModelId = modelId;
this.LimitUpValue = 2;
this.LimitDownValue = -2;
kTemp.SensorList.Add(this);
// Kinematics.SaveToModel(kTemp);
if (GlobalEventInterface.E_Transmit_SaveToModel != null)
{
GlobalEventInterface.E_Transmit_SaveToModel(kTemp);
}
return Id;
}
public string CreateSensorJoint(string modelId, string poseId, string jointId)
{
this.Id = Guid.NewGuid().ToString("D").ToUpper();
Joint.OnDataChange -= Joint_OnDataChange;
Joint.OnDataChange += Joint_OnDataChange;
Tagvalue = 0;
this.IsEnable = true;
this.PoseId = poseId;
this.JointId = jointId;
var kTemp = Kinematics.GetKinematicsByModelId(modelId);
this.Name = kTemp.ModelName + "_PJ_Logical_1";
this.SensorType = SensorType.Joint;
this.ModelId = modelId;
this.LimitUpValue = 2;
this.LimitDownValue = -2;
kTemp.SensorList.Add(this);
// Kinematics.SaveToModel(kTemp);
if (GlobalEventInterface.E_Transmit_SaveToModel != null)
{
GlobalEventInterface.E_Transmit_SaveToModel(kTemp);
}
return Id;
}
public string CreateSensorJointIsRun(string modelId, string jointId)
{
this.Id = Guid.NewGuid().ToString("D").ToUpper();
Joint.OnDataChangeJointIsRun -= Joint_OnDataChangeJointIsRun;
Joint.OnDataChangeJointIsRun += Joint_OnDataChangeJointIsRun;
Tagvalue = 0;
this.IsEnable = true;
this.JointId = jointId;
var kTemp = Kinematics.GetKinematicsByModelId(modelId);
this.Name = kTemp.ModelName + "_Run_Logical_1";
this.SensorType = SensorType.IsRun;
this.ModelId = modelId;
kTemp.SensorList.Add(this);
// Kinematics.SaveToModel(kTemp);
if (GlobalEventInterface.E_Transmit_SaveToModel != null)
{
GlobalEventInterface.E_Transmit_SaveToModel(kTemp);
}
return Id;
}
public string CreateSensorPoseDistance(string modelId, string jointId, SensorDataType sensorDataType)
{
this.Id = Guid.NewGuid().ToString("D").ToUpper();
Joint.OnDataChange -= Joint_OnDataChange;
Joint.OnDataChange += Joint_OnDataChange;
Tagvalue = 0;
var kTemp = Kinematics.GetKinematicsByModelId(modelId);
this.IsEnable = true;
this.JointId = jointId;
this.SensorType = SensorType.Distance;
this.Name = kTemp.ModelName + "_JD_Logical_1";
this.ModelId = modelId;
this.SensorDataType = sensorDataType;
this.LimitUpValue = 2;
this.LimitDownValue = -2;
kTemp.SensorList.Add(this);
// Kinematics.SaveToModel(kTemp);
if (GlobalEventInterface.E_Transmit_SaveToModel != null)
{
GlobalEventInterface.E_Transmit_SaveToModel(kTemp);
}
return Id;
}
public static void DataChange(string ModeId, string PoseId, string JointId, string Id, object Value)
{
if (OnDataChange != null)
{
OnDataChange.Invoke(ModeId, PoseId, JointId, Id, Value);
}
}
public void Joint_OnDataChange(string modeId, string jointID, object val)
{
//if (this.Id == null) return;
if (this.ModelId == modeId)
{
Triger(jointID, val);
}
}
/// <summary>
/// 根据Joint姿态的值触发传感器信号
/// </summary>
/// <param name="val"></param>
public void Triger(string jointID, object val)
{
switch (SensorType)
{
case SensorType.Pose:
TrigerPose(val);
break;
case SensorType.Distance:
TrigerDistance(jointID, val);
break;
case SensorType.Joint:
TrigerJoint(jointID, val);
break;
case SensorType.PhotoElectric:
break;
case SensorType.Near:
break;
case SensorType.Attribution:
break;
}
}
/// <summary>
/// 回写关节当前值(距离)
/// 可以订阅SensorDistanceDataChange事件
/// </summary>
/// <param name="val"></param>
public void TrigerDistance(string jointID, object val)
{
if (this.JointId != jointID) return;
object value;
switch (SensorDataType)
{
case SensorDataType.INT:
value = Convert.ToInt32(val);
DataChange(ModelId, PoseId, JointId, Id, value);
break;
case SensorDataType.DINT:
value = (long)val;
DataChange(ModelId, PoseId, JointId, Id, value);
break;
case SensorDataType.FLOAT:
value = (double)val;
DataChange(ModelId, PoseId, JointId, Id, value);
break;
case SensorDataType.DOUBLE:
value = (double)val;
DataChange(ModelId, PoseId, JointId, Id, value);
break;
}
}
/// <summary>
/// 判断姿态位置
/// </summary>
/// <param name="val"></param>
public void TrigerPose(object vale)
{
double val = (double)vale;
bool isTriger = false;
bool isTrigerJoint;
int index = 0;
//Kinematics k = DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == ModelId);
var k = PP.ModelCodeFindModelAttribute(ModelId).KinematicsData;
if (k == null) return;
//监控POSE的全部姿态
var pose = k.PoseList.FirstOrDefault(t => t.Id == PoseId);
if (pose == null) return;
foreach (var item in pose.PoseInfo)
{
double currentValue = k.JointList.FirstOrDefault(t => t.Id == item.Key).ValueCurrent;
if ((currentValue >= item.Value + LimitDownValue) && (currentValue <= item.Value + LimitUpValue))
{
isTrigerJoint = true;
}
else
{
isTrigerJoint = false;
}
if (!isTrigerJoint)
{
isTriger = false;
break;
}
else
{
if (index == 0)
{
isTriger = isTrigerJoint;
}
else
{
isTriger = isTriger && isTrigerJoint;
}
if (isTriger == false)
{
break;
}
}
index++;
}
if (I != isTriger)
{
I = isTriger;
DataChange(ModelId, PoseId, JointId, Id, I);
//DataChangeBool(ModelId, PoseId, JointId, Id, I);
}
}
/// <summary>
/// 关节传感器
/// 判断关节位置
/// </summary>
/// <param name="jointID"></param>
/// <param name="val"></param>
public void TrigerJoint(string jointID, object vale)
{
if (this.JointId != jointID) return;
double val = (double)vale;
bool isTriger = false;
// Kinematics k = DataBaseJson.dataBaseJson.KinematicsList.FirstOrDefault(t => t.ModelId == ModelId);
var k = PP.ModelCodeFindModelAttribute(ModelId).KinematicsData;
if (k == null) return;
var jValue = k.PoseList.FirstOrDefault(t => t.Id == PoseId).PoseInfo[jointID];
if ((val >= jValue + LimitDownValue) && (val <= jValue + LimitDownValue))
{
isTriger = true;
}
else
{
isTriger = false;
}
if (I != isTriger)
{
I = isTriger;
DataChange(ModelId, PoseId, JointId, Id, I);
//DataChangeBool(ModelId, PoseId, JointId, Id, I);
}
}
}
//
#endregion
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
///
/// </summary>
public class CallbackBsae
{
/// <summary>
///
/// </summary>
private event Action<String> execmsg;
/// <summary>
///
/// </summary>
/// <param name="msg"></param>
public void invoke(string msg)
{
Action<String> ExecMsgT = execmsg;
if (ExecMsgT != null)
{
ExecMsgT(msg);
}
else
{
}
}
}

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
public class CallbackObjectFromJs : CallbackBsae
{
public event Action<String> ExecMsg;
public CallbackObjectFromJs()
{
}
/// <summary>
/// 必须小写
/// </summary>
/// <param name="msg"></param>
public void receivemsg(string msg)
{
this.Invoke(msg);
}
private void Invoke(string msg)
{
Action<String> ExecMsgT = ExecMsg;
if (ExecMsgT != null)
{
ExecMsgT(msg);
}
else
{
}
}
~CallbackObjectFromJs()
{
}
}

View File

@@ -0,0 +1,511 @@
using Global;
using LogNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/// <summary>
///
/// </summary>
namespace ModelBasic
{
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
public class ErrHandler<T> : Error<T>, IErrHandler<T>
{
/// <summary>
/// 工艺树刷新
/// </summary>
public Action refreshCraftTree
{
get;
set;
} = null;
/// <summary>
/// 传递工艺组
/// </summary>
public Func<String, Int32, bool> transmitCraftGroup
{
get;
set;
} = null;
/// <summary>
/// 传递模型名
/// </summary>
public Func<String, Int32, bool> transmitModelName
{
get;
set;
} = null;
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递
/// </summary>
public Func<String, Int32, bool> transmitCraftGroup_UnSim
{
get;
set;
} = null;
/// <summary>
/// (位置控制器)关闭
/// </summary>
public Func<bool> closeSeatOperationForm
{
get;
set;
} = null;
/// <summary>
/// (位置控制器)选择模型发送消息
/// </summary>
public Func<Int32, String, bool> currTreeSelectModelHandler_SeatOperation
{
get;
set;
} = null;
/// <summary>
/// 传递逻辑脚本名称
/// </summary>
public static Func<Int32, String, bool> transitionEditorPageScriptNameUpdate
{
get;
set;
} = null;
/// <summary>
/// 浏览器发送
/// 20200916
/// </summary>
private static Action<String> cefSend
{
get;
set;
} = null;
/// <summary>
/// 浏览器接收
/// 20200916
/// </summary>
private static Action<String> cefRec
{
get;
set;
} = null;
/// <summary>
/// 传递项目名称
/// 2020.11.2
/// </summary>
public static Func<String, Boolean> projectNameFunc
{
get;
set;
} = null;
/// <summary>
/// 工艺树刷新
/// </summary>
public void RefreshCraftTree()
{
if (refreshCraftTree != null)
{
refreshCraftTree();
}
}
/// <summary>
/// 传递工艺组
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
public void TransmitCraftGroup(string craftName, int craftCode)
{
if (transmitCraftGroup != null)
{
transmitCraftGroup.Invoke(craftName, craftCode);
}
}
/// <summary>
/// 传递模型名
/// </summary>
/// <param name="modelName"></param>
/// <param name="modelCode"></param>
public void TransmitModelName(string modelName, int modelCode)
{
if (transmitModelName != null)
{
transmitModelName.Invoke(modelName, modelCode);
}
}
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
public void TransmitCraftGroup_UnSim(string craftName, int craftCode)
{
if (transmitCraftGroup_UnSim != null)
{
transmitCraftGroup_UnSim.Invoke(craftName, craftCode);
}
}
/// <summary>
/// ErrInfoTransmit
/// </summary>
/// <param name="s"></param>
public void ErrInfoTransmit(string s)
{
if (errInfoTransmit != null)
{
LogisTrac.WriteLog("", s);
errInfoTransmit.Invoke(s);
}
}
/// <summary>
/// (位置控制器)关闭
/// </summary>
public void CloseSeatOperationForm()
{
if (closeSeatOperationForm != null)
{
closeSeatOperationForm.Invoke();
}
}
/// <summary>
/// (位置控制器)选择模型发送消息
/// </summary>
/// <param name="modelName"></param>
public void CurrTreeSelectModelHandler_SeatOperation(int modelCode, string modelName)
{
if (currTreeSelectModelHandler_SeatOperation != null)
{
currTreeSelectModelHandler_SeatOperation.Invoke(modelCode, modelName);
}
}
/// <summary>
/// 传递逻辑脚本名称
/// </summary>
/// <param name="modelName"></param>
public void TransitionEditorPageScriptNameUpdate(int internalVarCode, string internalVarName)
{
if (transitionEditorPageScriptNameUpdate != null)
{
transitionEditorPageScriptNameUpdate.Invoke(internalVarCode, internalVarName);
}
}
/// <summary>
/// 发送到浏览器
/// 20200916
/// </summary>
/// <param name="str"></param>
public static void CefSend(string str)
{
if (cefSend != null)
{
cefSend.Invoke(str);
}
}
/// <summary>
/// 浏览器接收
/// 20200916
/// </summary>
/// <param name="str"></param>
public static void CefRec(string str)
{
if (cefRec != null)
{
cefRec.Invoke(str);
}
}
/// <summary>
/// 传递项目名称 执行
/// 2020.11.2
/// </summary>
/// <returns></returns>
public static void ProjectNameFunc(string projectName)
{
if (projectNameFunc != null)
projectNameFunc.Invoke(projectName);
}
/// <summary>
/// 工艺树刷新 赋予
/// </summary>
public void RefreshCraftTree_Give(Action f)
{
refreshCraftTree = f;
}
/// <summary>
/// 传递工艺组 赋予
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
public void TransmitCraftGroup_Give(Func<String, Int32, bool> f)
{
transmitCraftGroup = f;
}
/// <summary>
/// ErrInfoTransmit_Give
/// </summary>
/// <param name="f"></param>
public void ErrInfoTransmit_Give(ErrInfoHandler<String> f)
{
ErrInfoHandler<String> func = f;
if (errInfoTransmit == null)
{
errInfoTransmit = func;
}
else
{
errInfoTransmit = f;
}
}
/// <summary>
/// 传递模型名 赋予
/// </summary>
/// <param name="modelName"></param>
/// <param name="modelCode"></param>
public void TransmitModelName_Give(Func<String, Int32, bool> f)
{
transmitModelName = f;
}
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递 赋予
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
public void TransmitCraftGroup_UnSim_Give(Func<String, Int32, bool> f)
{
transmitCraftGroup_UnSim = f;
}
/// <summary>
/// (位置控制器)关闭 赋予
/// </summary>
public void CloseSeatOperationForm_Give(Func<bool> f)
{
closeSeatOperationForm = f;
}
/// <summary>
/// (位置控制器)选择模型发送消息 赋予
/// </summary>
/// <param name="modelName"></param>
public void CurrTreeSelectModelHandler_SeatOperation_Give(Func<Int32, String, bool> f)
{
currTreeSelectModelHandler_SeatOperation = f;
}
/// <summary>
/// 传递逻辑脚本名称 赋予
/// </summary>
/// <param name="f"></param>
public void TransitionEditorPageScriptNameUpdate_Give(Func<Int32, String, bool> f)
{
transitionEditorPageScriptNameUpdate = f;
}
/// <summary>
/// 发送到浏览器 赋予
/// 20200916
/// </summary>
/// <param name="str"></param>
public static void CefSend_Give(Action<String> f)
{
cefSend = f;
}
/// <summary>
/// 浏览器接收 赋予
/// 20200916
/// </summary>
/// <param name="str"></param>
public static void CefRec_Give(Action<String> f)
{
cefRec = f;
}
/// <summary>
/// 传递项目名称 赋予
/// 2020.11.2
/// </summary>
/// <param name="f"></param>
public static void ProjectNameFunc_Give(Func<String, Boolean> f)
{
projectNameFunc = f;
}
/// <summary>
/// 工艺树刷新 判断
/// </summary>
public bool RefreshCraftTree_IsNull()
{
if (refreshCraftTree == null)
return true;
else
return false;
}
/// <summary>
/// 传递工艺组 判断
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
public bool TransmitCraftGroup_IsNull()
{
if (transmitCraftGroup == null)
return true;
else
return false;
}
/// <summary>
/// 传递模型名 判断
/// </summary>
/// <param name="modelName"></param>
/// <param name="modelCode"></param>
public bool TransmitModelName_IsNull()
{
if (transmitModelName == null)
return true;
else
return false;
}
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递 判断
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
public bool TransmitCraftGroup_UnSim_IsNull()
{
if (transmitCraftGroup_UnSim == null)
return true;
else
return false;
}
/// <summary>
/// (位置控制器)关闭 判断
/// </summary>
public bool CloseSeatOperationForm_IsNull()
{
if (closeSeatOperationForm == null)
return true;
else
return false;
}
/// <summary>
/// (位置控制器)选择模型发送消息 判断
/// </summary>
/// <param name="modelName"></param>
public bool CurrTreeSelectModelHandler_SeatOperation_IsNull()
{
if (currTreeSelectModelHandler_SeatOperation == null)
return true;
else
return false;
}
/// <summary>
/// 传递逻辑脚本名称 判断
/// </summary>
/// <returns></returns>
public bool TransitionEditorPageScriptNameUpdate_IsNull()
{
if (transitionEditorPageScriptNameUpdate == null)
return true;
else
return false;
}
/// <summary>
/// 发送到浏览器 判断
/// 20200916
/// </summary>
/// <param name="str"></param>
public static bool CefSend_IsNull()
{
if (cefSend == null)
return true;
else
return false;
}
/// <summary>
/// 浏览器接收 判断
/// 20200916
/// </summary>
/// <param name="str"></param>
public static bool CefRec_IsNull()
{
if (cefRec == null)
return true;
else
return false;
}
/// <summary>
/// 传递项目名称 判断
/// 2020.11.2
/// </summary>
/// <param name="f"></param>
public static bool ProjectNameFunc_IsNull()
{
if (projectNameFunc == null)
return true;
else
return false;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public bool ErrInfoTransmit_IsNull()
{
bool b = false;
if (errInfoTransmit == null)
{
b = true;
}
else
{
b = false;
}
return b;
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ModelBasic
{
public class Error<T>
{
/// <summary>
///
/// </summary>
// T t = default;
/// <summary>
///
/// </summary>
public ErrInfoHandler<String> errInfoTransmit = null;
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ModelBasic
{
public class ErrDef
{
/// <summary>
/// 错误消息列表的接口
/// </summary>
public static IErrHandler<String> iErrHandler = null;
}
}

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,12 @@
using Global;
/// <summary>
/// InitVar
/// </summary>
public class InitVar
{
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ModelBasic
{
/// <summary>
///
/// </summary>
public class NewIProjectVar
{
}
}

View File

@@ -0,0 +1,480 @@
using ModelBasic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Global
{
/// <summary>
///
/// </summary>
public class ProjectVar : TheVar
{
/// <summary>
/// 浏览器发送
/// 20200916
/// </summary>
private static Action<String> cefSend
{
get;
set;
} = null;
/// <summary>
/// 浏览器接收
/// 20200916
/// </summary>
private static Action<String> cefRec
{
get;
set;
} = null;
/// <summary>
/// 工艺树刷新
/// </summary>
public void RefreshCraftTree()
{
if (refreshCraftTree != null)
{
refreshCraftTree();
}
}
/// <summary>
/// 传递工艺组
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
public void TransmitCraftGroup(string craftName, string craftCode)
{
if (transmitCraftGroup != null)
{
transmitCraftGroup.Invoke(craftName, craftCode);
}
}
/// <summary>
/// 传递模型名
/// </summary>
/// <param name="modelName"></param>
/// <param name="modelCode"></param>
public void TransmitModelName(string modelName, string modelCode)
{
if (transmitModelName != null)
{
transmitModelName.Invoke(modelName, modelCode);
}
}
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
public void TransmitCraftGroup_UnSim(string craftName, string craftCode)
{
if (transmitCraftGroup_UnSim != null)
{
transmitCraftGroup_UnSim.Invoke(craftName, craftCode);
}
}
/// <summary>
/// (位置控制器)关闭
/// </summary>
public void CloseSeatOperationForm()
{
if (closeSeatOperationForm != null)
{
closeSeatOperationForm.Invoke();
}
}
/// <summary>
/// (位置控制器)选择模型发送消息
/// </summary>
/// <param name="modelName"></param>
public void CurrTreeSelectModelHandler_SeatOperation(string modelCode, string modelName)
{
if (currTreeSelectModelHandler_SeatOperation != null)
{
currTreeSelectModelHandler_SeatOperation.Invoke(modelCode, modelName);
}
}
/// <summary>
/// 传递逻辑脚本名称
/// </summary>
/// <param name="modelName"></param>
public void TransitionEditorPageScriptNameUpdate(string internalVarCode, string internalVarName)
{
if (transitionEditorPageScriptNameUpdate != null)
{
transitionEditorPageScriptNameUpdate.Invoke(internalVarCode, internalVarName);
}
}
/// <summary>
/// 发送到浏览器
/// 20200916
/// </summary>
/// <param name="str"></param>
public static void CefSend(string str)
{
if (cefSend != null)
{
cefSend.Invoke(str);
}
}
/// <summary>
/// 浏览器接收
/// 20200916
/// </summary>
/// <param name="str"></param>
public static void CefRec(string str)
{
if (cefRec != null)
{
cefRec.Invoke(str);
}
}
/// <summary>
/// 工艺树刷新 赋予
/// </summary>
public void RefreshCraftTree_Give(Action f)
{
refreshCraftTree = f;
}
/// <summary>
/// 传递工艺组 赋予
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
public void TransmitCraftGroup_Give(Func<String, String, bool> f)
{
transmitCraftGroup = f;
}
/// <summary>
/// 传递模型名 赋予
/// </summary>
/// <param name="modelName"></param>
/// <param name="modelCode"></param>
public void TransmitModelName_Give(Func<String, String, bool> f)
{
transmitModelName = f;
}
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递 赋予
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
public void TransmitCraftGroup_UnSim_Give(Func<String, String, bool> f)
{
transmitCraftGroup_UnSim = f;
}
/// <summary>
/// (位置控制器)关闭 赋予
/// </summary>
public void CloseSeatOperationForm_Give(Func<bool> f)
{
closeSeatOperationForm = f;
}
/// <summary>
/// (位置控制器)选择模型发送消息 赋予
/// </summary>
/// <param name="modelName"></param>
public void CurrTreeSelectModelHandler_SeatOperation_Give(Func<String, String, bool> f)
{
currTreeSelectModelHandler_SeatOperation = f;
}
/// <summary>
/// 传递逻辑脚本名称 赋予
/// </summary>
/// <param name="f"></param>
public void TransitionEditorPageScriptNameUpdate_Give(Func<String, String, bool> f)
{
transitionEditorPageScriptNameUpdate = f;
}
/// <summary>
/// 发送到浏览器 赋予
/// 20200916
/// </summary>
/// <param name="str"></param>
public static void CefSend_Give(Action<String> f)
{
cefSend = f;
}
/// <summary>
/// 浏览器接收 赋予
/// 20200916
/// </summary>
/// <param name="str"></param>
public static void CefRec_Give(Action<String> f)
{
cefRec = f;
}
/// <summary>
/// 工艺树刷新 判断
/// </summary>
public bool RefreshCraftTree_IsNull()
{
if (refreshCraftTree == null)
return true;
else
return false;
}
/// <summary>
/// 传递工艺组 判断
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
public bool TransmitCraftGroup_IsNull()
{
if (transmitCraftGroup == null)
return true;
else
return false;
}
/// <summary>
/// 传递模型名 判断
/// </summary>
/// <param name="modelName"></param>
/// <param name="modelCode"></param>
public bool TransmitModelName_IsNull()
{
if (transmitModelName == null)
return true;
else
return false;
}
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递 判断
/// </summary>
/// <param name="craftName"></param>
/// <param name="craftCode"></param>
public bool TransmitCraftGroup_UnSim_IsNull()
{
if (transmitCraftGroup_UnSim == null)
return true;
else
return false;
}
/// <summary>
/// (位置控制器)关闭 判断
/// </summary>
public bool CloseSeatOperationForm_IsNull()
{
if (closeSeatOperationForm == null)
return true;
else
return false;
}
/// <summary>
/// (位置控制器)选择模型发送消息 判断
/// </summary>
/// <param name="modelName"></param>
public bool CurrTreeSelectModelHandler_SeatOperation_IsNull()
{
if (currTreeSelectModelHandler_SeatOperation == null)
return true;
else
return false;
}
/// <summary>
/// 传递逻辑脚本名称 判断
/// </summary>
/// <returns></returns>
public bool TransitionEditorPageScriptNameUpdate_IsNull()
{
if (transitionEditorPageScriptNameUpdate == null)
return true;
else
return false;
}
/// <summary>
/// 发送到浏览器 判断
/// 20200916
/// </summary>
/// <param name="str"></param>
public static bool CefSend_IsNull()
{
if (cefSend == null)
return true;
else
return false;
}
/// <summary>
/// 浏览器接收 判断
/// 20200916
/// </summary>
/// <param name="str"></param>
public static bool CefRec_IsNull()
{
if (cefRec == null)
return true;
else
return false;
}
/// <summary>
/// 传递项目名称
/// 2020.11.2
/// </summary>
public Func<String, Boolean> projectNameFunc
{
get;
set;
} = null;
/// <summary>
/// 传递项目名称
/// 2020.11.2
/// </summary>
/// <returns></returns>
public void ProjectNameFunc(string projectName)
{
if (projectNameFunc != null)
{
projectNameFunc.Invoke(projectName);
}
}
/// <summary>
/// 传递项目名称 赋予
/// 2020.11.2
/// </summary>
/// <param name="f"></param>
public void ProjectNameFunc_Give(Func<String, Boolean> f)
{
projectNameFunc = f;
}
/// <summary>
/// 传递项目名称 判断
/// 2020.11.2
/// </summary>
/// <param name="f"></param>
public bool ProjectNameFunc_IsNull()
{
if (projectNameFunc == null)
return true;
else
return false;
}
public ShowMainProgressSet showMainProgressSet
{
get;
set;
} = null;
public ShowMainProgress showMainProgress
{
get;
set;
} = null;
public ShowMainProgressCountPer showMainProgressCountPer
{
get;
set;
}
public bool ShowMainProgressSet_IsNull(string n, int m)
{
bool b = false;
if (showMainProgressSet == null)
{
b = true;
}
else
{
b = false;
}
return b;
}
public bool ShowMainProgress_IsNull(int c)
{
bool b = false;
if (showMainProgress == null)
{
b = true;
}
else
{
b = false;
}
return b;
}
public void ShowMainProgressSet_Give(ShowMainProgressSet f)
{
showMainProgressSet = f;
}
public void ShowMainProgress_Give(ShowMainProgress f)
{
showMainProgress = f;
}
public void ShowMainProgress_Give_CountPer(ShowMainProgressCountPer f)
{
showMainProgressCountPer = f;
}
public void ShowMainProgressSet(string n, int m)
{
if(showMainProgressSet!=null)
{
}
showMainProgressSet.Invoke(n, m);
}
public void ShowMainProgress(int c)
{
showMainProgress.Invoke(c);
}
public void ShowMainProgressCountPer(string msg,int c)
{
showMainProgressCountPer.Invoke(msg,c);
}
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/// <summary>
///
/// </summary>
namespace ModelBasic
{
/// <summary>
///
/// </summary>
public class ProjectVarDef
{
/// <summary>
/// IProjectVar
/// </summary>
public static Global.IProjectVar iProjectVar = null;
}
}

View File

@@ -0,0 +1,85 @@
using Global;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
/// <summary>
///
/// </summary>
namespace ModelBasic
{
/// <summary>
///
/// </summary>
public class TheVar
{
/// <summary>
/// 工艺树刷新
/// </summary>
public Action refreshCraftTree
{
get;
set;
} = null;
/// <summary>
/// 传递工艺组
/// </summary>
public Func<String, String, bool> transmitCraftGroup
{
get;
set;
} = null;
/// <summary>
/// 传递模型名
/// </summary>
public Func<String, String, bool> transmitModelName
{
get;
set;
} = null;
/// <summary>
/// 非仿真工艺(空工艺),工艺组的传递
/// </summary>
public Func<String, String, bool> transmitCraftGroup_UnSim
{
get;
set;
} = null;
/// <summary>
/// (位置控制器)关闭
/// </summary>
public Func<bool> closeSeatOperationForm
{
get;
set;
} = null;
/// <summary>
/// (位置控制器)选择模型发送消息
/// </summary>
public Func<String, String, bool> currTreeSelectModelHandler_SeatOperation
{
get;
set;
} = null;
/// <summary>
/// 传递逻辑脚本名称
/// </summary>
public static Func<String, String, bool> transitionEditorPageScriptNameUpdate
{
get;
set;
} = null;
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Foundation")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Foundation")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("7a8cc5ec-9795-4fcd-a85f-bb01da377225")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
</packages>