加入图形功能。

This commit is contained in:
facat 2020-05-20 21:47:15 +08:00
parent c527abf326
commit a109aa6836
6 changed files with 277 additions and 10 deletions

96
PutTowerPosition/Gui.Designer.cs generated Normal file
View File

@ -0,0 +1,96 @@
namespace PutTowerPosition
{
partial class Gui
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.LB_SFilePath = new System.Windows.Forms.Label();
this.TB_SFilePATH = new System.Windows.Forms.TextBox();
this.BT_SelectSFile = new System.Windows.Forms.Button();
this.BT_REFRESH = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// LB_SFilePath
//
this.LB_SFilePath.AutoSize = true;
this.LB_SFilePath.Location = new System.Drawing.Point(26, 27);
this.LB_SFilePath.Name = "LB_SFilePath";
this.LB_SFilePath.Size = new System.Drawing.Size(65, 12);
this.LB_SFilePath.TabIndex = 0;
this.LB_SFilePath.Text = "S文件路径:";
//
// TB_SFilePATH
//
this.TB_SFilePATH.Location = new System.Drawing.Point(97, 24);
this.TB_SFilePATH.Name = "TB_SFilePATH";
this.TB_SFilePATH.Size = new System.Drawing.Size(354, 21);
this.TB_SFilePATH.TabIndex = 1;
//
// BT_SelectSFile
//
this.BT_SelectSFile.Location = new System.Drawing.Point(472, 24);
this.BT_SelectSFile.Name = "BT_SelectSFile";
this.BT_SelectSFile.Size = new System.Drawing.Size(75, 23);
this.BT_SelectSFile.TabIndex = 2;
this.BT_SelectSFile.Text = "选择S文件";
this.BT_SelectSFile.UseVisualStyleBackColor = true;
this.BT_SelectSFile.Click += new System.EventHandler(this.BT_SelectSFile_Click);
//
// BT_REFRESH
//
this.BT_REFRESH.Location = new System.Drawing.Point(78, 66);
this.BT_REFRESH.Name = "BT_REFRESH";
this.BT_REFRESH.Size = new System.Drawing.Size(425, 74);
this.BT_REFRESH.TabIndex = 3;
this.BT_REFRESH.Text = "刷新";
this.BT_REFRESH.UseVisualStyleBackColor = true;
this.BT_REFRESH.Click += new System.EventHandler(this.BT_REFRESH_Click);
//
// Gui
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(577, 152);
this.Controls.Add(this.BT_REFRESH);
this.Controls.Add(this.BT_SelectSFile);
this.Controls.Add(this.TB_SFilePATH);
this.Controls.Add(this.LB_SFilePath);
this.Name = "Gui";
this.Text = "Gui";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label LB_SFilePath;
private System.Windows.Forms.TextBox TB_SFilePATH;
private System.Windows.Forms.Button BT_SelectSFile;
private System.Windows.Forms.Button BT_REFRESH;
}
}

40
PutTowerPosition/Gui.cs Normal file
View File

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace PutTowerPosition
{
public partial class Gui : Form
{
public Gui()
{
InitializeComponent();
}
private void BT_SelectSFile_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "S files (*.dat)|*.dat";
openFileDialog.Multiselect = false;
openFileDialog.RestoreDirectory = true;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
this.TB_SFilePATH.Text = openFileDialog.FileName;
}
}
private void BT_REFRESH_Click(object sender, EventArgs e)
{
if (this.TB_SFilePATH.Text.Trim() != "")
{
PutTowerPosition.Cmd.PutTowerPosition(this.TB_SFilePATH.Text);
}
}
}
}

120
PutTowerPosition/Gui.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace PutTowerPostion.Properties {
namespace PutTowerPosition.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]

View File

@ -8,7 +8,7 @@
<ProjectGuid>{CA8FB7A3-CEB6-471C-BB97-76CBFA17293C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PutTowerPostion</RootNamespace>
<RootNamespace>PutTowerPosition</RootNamespace>
<AssemblyName>PutTowerPostion</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
@ -70,7 +70,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="cmd.cs" />
<Compile Include="Config.cs" />
<Compile Include="Gui.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Gui.Designer.cs">
<DependentUpon>Gui.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
@ -85,6 +90,11 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Gui.resx">
<DependentUpon>Gui.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -33,18 +33,19 @@ namespace PutTowerPosition
public double X;
public double Y;
};
public void PutTowerPositionCmd()
[CommandMethod("ptp", CommandFlags.Session)]
public static void PutTowerPositionCmd()
{
Gui gui = new Gui();
gui.Show();
}
[CommandMethod("ptp", CommandFlags.Session)]
public static void PutTowerPosition()
public static void PutTowerPosition(string SFilePath)
{
string excelFile = findCordinationExcel(@"d:\code\PutTowerPosition\example\S000.DAT");
string excelFile = findCordinationExcel(SFilePath);
Dictionary<string, double[]> cordDic = readCordExcel(excelFile);
List<spanStruct> spanList = readSSpan(@"d:\code\PutTowerPosition\example\S000.DAT");
List<spanStruct> spanList = readSSpan(SFilePath);
Document acDoc;
Database acCurDb;
//acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.Open(filePath, true);