개정판 b8562da7
issue #000: autocad
Change-Id: I4d354b677a311e233f8c5b7fff445e59f2b514e3
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/AutoCAD_Utility.sln | ||
---|---|---|
1 |
|
|
2 |
Microsoft Visual Studio Solution File, Format Version 12.00 |
|
3 |
# Visual Studio 15 |
|
4 |
VisualStudioVersion = 15.0.28307.852 |
|
5 |
MinimumVisualStudioVersion = 10.0.40219.1 |
|
6 |
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoCAD_Utility", "AutoCAD_Utility\AutoCAD_Utility.csproj", "{FB5E8D4B-1F72-4F7A-8FDD-0A088FBB72EB}" |
|
7 |
EndProject |
|
8 |
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CAD_Util", "CAD_Util\CAD_Util.csproj", "{E8B1149D-ADFF-4C33-82E0-C07CC0DFF6C0}" |
|
9 |
EndProject |
|
10 |
Global |
|
11 |
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|
12 |
Debug|Any CPU = Debug|Any CPU |
|
13 |
Release|Any CPU = Release|Any CPU |
|
14 |
EndGlobalSection |
|
15 |
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|
16 |
{FB5E8D4B-1F72-4F7A-8FDD-0A088FBB72EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
17 |
{FB5E8D4B-1F72-4F7A-8FDD-0A088FBB72EB}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
18 |
{FB5E8D4B-1F72-4F7A-8FDD-0A088FBB72EB}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
19 |
{FB5E8D4B-1F72-4F7A-8FDD-0A088FBB72EB}.Release|Any CPU.Build.0 = Release|Any CPU |
|
20 |
{E8B1149D-ADFF-4C33-82E0-C07CC0DFF6C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
21 |
{E8B1149D-ADFF-4C33-82E0-C07CC0DFF6C0}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
22 |
{E8B1149D-ADFF-4C33-82E0-C07CC0DFF6C0}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
23 |
{E8B1149D-ADFF-4C33-82E0-C07CC0DFF6C0}.Release|Any CPU.Build.0 = Release|Any CPU |
|
24 |
EndGlobalSection |
|
25 |
GlobalSection(SolutionProperties) = preSolution |
|
26 |
HideSolutionNode = FALSE |
|
27 |
EndGlobalSection |
|
28 |
GlobalSection(ExtensibilityGlobals) = postSolution |
|
29 |
SolutionGuid = {463773FF-BD7B-4266-8E7E-E75474767816} |
|
30 |
EndGlobalSection |
|
31 |
EndGlobal |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/AutoCAD_Utility/App.config | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8" ?> |
|
2 |
<configuration> |
|
3 |
<startup> |
|
4 |
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /> |
|
5 |
</startup> |
|
6 |
</configuration> |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/AutoCAD_Utility/AutoCAD_Utility.csproj | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
3 |
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
|
4 |
<PropertyGroup> |
|
5 |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|
6 |
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|
7 |
<ProjectGuid>{FB5E8D4B-1F72-4F7A-8FDD-0A088FBB72EB}</ProjectGuid> |
|
8 |
<OutputType>WinExe</OutputType> |
|
9 |
<RootNamespace>AutoCAD_Utility</RootNamespace> |
|
10 |
<AssemblyName>AutoCAD_Utility</AssemblyName> |
|
11 |
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> |
|
12 |
<FileAlignment>512</FileAlignment> |
|
13 |
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|
14 |
<Deterministic>true</Deterministic> |
|
15 |
</PropertyGroup> |
|
16 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
17 |
<PlatformTarget>AnyCPU</PlatformTarget> |
|
18 |
<DebugSymbols>true</DebugSymbols> |
|
19 |
<DebugType>full</DebugType> |
|
20 |
<Optimize>false</Optimize> |
|
21 |
<OutputPath>..\Setup\</OutputPath> |
|
22 |
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
23 |
<ErrorReport>prompt</ErrorReport> |
|
24 |
<WarningLevel>4</WarningLevel> |
|
25 |
</PropertyGroup> |
|
26 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
27 |
<PlatformTarget>AnyCPU</PlatformTarget> |
|
28 |
<DebugType>pdbonly</DebugType> |
|
29 |
<Optimize>true</Optimize> |
|
30 |
<OutputPath>bin\Release\</OutputPath> |
|
31 |
<DefineConstants>TRACE</DefineConstants> |
|
32 |
<ErrorReport>prompt</ErrorReport> |
|
33 |
<WarningLevel>4</WarningLevel> |
|
34 |
</PropertyGroup> |
|
35 |
<ItemGroup> |
|
36 |
<Reference Include="System" /> |
|
37 |
<Reference Include="System.Core" /> |
|
38 |
<Reference Include="System.Xml.Linq" /> |
|
39 |
<Reference Include="System.Data.DataSetExtensions" /> |
|
40 |
<Reference Include="Microsoft.CSharp" /> |
|
41 |
<Reference Include="System.Data" /> |
|
42 |
<Reference Include="System.Deployment" /> |
|
43 |
<Reference Include="System.Drawing" /> |
|
44 |
<Reference Include="System.Net.Http" /> |
|
45 |
<Reference Include="System.Windows.Forms" /> |
|
46 |
<Reference Include="System.Xml" /> |
|
47 |
</ItemGroup> |
|
48 |
<ItemGroup> |
|
49 |
<Compile Include="Form1.cs"> |
|
50 |
<SubType>Form</SubType> |
|
51 |
</Compile> |
|
52 |
<Compile Include="Form1.Designer.cs"> |
|
53 |
<DependentUpon>Form1.cs</DependentUpon> |
|
54 |
</Compile> |
|
55 |
<Compile Include="Program.cs" /> |
|
56 |
<Compile Include="Properties\AssemblyInfo.cs" /> |
|
57 |
<EmbeddedResource Include="Form1.resx"> |
|
58 |
<DependentUpon>Form1.cs</DependentUpon> |
|
59 |
</EmbeddedResource> |
|
60 |
<EmbeddedResource Include="Properties\Resources.resx"> |
|
61 |
<Generator>ResXFileCodeGenerator</Generator> |
|
62 |
<LastGenOutput>Resources.Designer.cs</LastGenOutput> |
|
63 |
<SubType>Designer</SubType> |
|
64 |
</EmbeddedResource> |
|
65 |
<Compile Include="Properties\Resources.Designer.cs"> |
|
66 |
<AutoGen>True</AutoGen> |
|
67 |
<DependentUpon>Resources.resx</DependentUpon> |
|
68 |
</Compile> |
|
69 |
<None Include="Properties\Settings.settings"> |
|
70 |
<Generator>SettingsSingleFileGenerator</Generator> |
|
71 |
<LastGenOutput>Settings.Designer.cs</LastGenOutput> |
|
72 |
</None> |
|
73 |
<Compile Include="Properties\Settings.Designer.cs"> |
|
74 |
<AutoGen>True</AutoGen> |
|
75 |
<DependentUpon>Settings.settings</DependentUpon> |
|
76 |
<DesignTimeSharedInput>True</DesignTimeSharedInput> |
|
77 |
</Compile> |
|
78 |
</ItemGroup> |
|
79 |
<ItemGroup> |
|
80 |
<None Include="App.config" /> |
|
81 |
</ItemGroup> |
|
82 |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|
83 |
</Project> |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/AutoCAD_Utility/Form1.Designer.cs | ||
---|---|---|
1 |
namespace AutoCAD_Utility |
|
2 |
{ |
|
3 |
partial class Form1 |
|
4 |
{ |
|
5 |
/// <summary> |
|
6 |
/// 필수 디자이너 변수입니다. |
|
7 |
/// </summary> |
|
8 |
private System.ComponentModel.IContainer components = null; |
|
9 |
|
|
10 |
/// <summary> |
|
11 |
/// 사용 중인 모든 리소스를 정리합니다. |
|
12 |
/// </summary> |
|
13 |
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param> |
|
14 |
protected override void Dispose(bool disposing) |
|
15 |
{ |
|
16 |
if (disposing && (components != null)) |
|
17 |
{ |
|
18 |
components.Dispose(); |
|
19 |
} |
|
20 |
base.Dispose(disposing); |
|
21 |
} |
|
22 |
|
|
23 |
#region Windows Form 디자이너에서 생성한 코드 |
|
24 |
|
|
25 |
/// <summary> |
|
26 |
/// 디자이너 지원에 필요한 메서드입니다. |
|
27 |
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요. |
|
28 |
/// </summary> |
|
29 |
private void InitializeComponent() |
|
30 |
{ |
|
31 |
this.panel1 = new System.Windows.Forms.Panel(); |
|
32 |
this.panel2 = new System.Windows.Forms.Panel(); |
|
33 |
this.textBox1 = new System.Windows.Forms.TextBox(); |
|
34 |
this.button1 = new System.Windows.Forms.Button(); |
|
35 |
this.button2 = new System.Windows.Forms.Button(); |
|
36 |
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); |
|
37 |
this.panel1.SuspendLayout(); |
|
38 |
this.panel2.SuspendLayout(); |
|
39 |
this.SuspendLayout(); |
|
40 |
// |
|
41 |
// panel1 |
|
42 |
// |
|
43 |
this.panel1.Controls.Add(this.button1); |
|
44 |
this.panel1.Controls.Add(this.textBox1); |
|
45 |
this.panel1.Dock = System.Windows.Forms.DockStyle.Top; |
|
46 |
this.panel1.Location = new System.Drawing.Point(0, 0); |
|
47 |
this.panel1.Name = "panel1"; |
|
48 |
this.panel1.Size = new System.Drawing.Size(490, 51); |
|
49 |
this.panel1.TabIndex = 0; |
|
50 |
// |
|
51 |
// panel2 |
|
52 |
// |
|
53 |
this.panel2.Controls.Add(this.button2); |
|
54 |
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; |
|
55 |
this.panel2.Location = new System.Drawing.Point(0, 51); |
|
56 |
this.panel2.Name = "panel2"; |
|
57 |
this.panel2.Size = new System.Drawing.Size(490, 87); |
|
58 |
this.panel2.TabIndex = 1; |
|
59 |
// |
|
60 |
// textBox1 |
|
61 |
// |
|
62 |
this.textBox1.Location = new System.Drawing.Point(12, 12); |
|
63 |
this.textBox1.Name = "textBox1"; |
|
64 |
this.textBox1.ReadOnly = true; |
|
65 |
this.textBox1.Size = new System.Drawing.Size(384, 21); |
|
66 |
this.textBox1.TabIndex = 0; |
|
67 |
// |
|
68 |
// button1 |
|
69 |
// |
|
70 |
this.button1.Location = new System.Drawing.Point(403, 11); |
|
71 |
this.button1.Name = "button1"; |
|
72 |
this.button1.Size = new System.Drawing.Size(75, 23); |
|
73 |
this.button1.TabIndex = 1; |
|
74 |
this.button1.Text = "Search"; |
|
75 |
this.button1.UseVisualStyleBackColor = true; |
|
76 |
this.button1.Click += new System.EventHandler(this.button1_Click); |
|
77 |
// |
|
78 |
// button2 |
|
79 |
// |
|
80 |
this.button2.Location = new System.Drawing.Point(403, 52); |
|
81 |
this.button2.Name = "button2"; |
|
82 |
this.button2.Size = new System.Drawing.Size(75, 23); |
|
83 |
this.button2.TabIndex = 2; |
|
84 |
this.button2.Text = "Run"; |
|
85 |
this.button2.UseVisualStyleBackColor = true; |
|
86 |
this.button2.Click += new System.EventHandler(this.button2_Click); |
|
87 |
// |
|
88 |
// openFileDialog1 |
|
89 |
// |
|
90 |
this.openFileDialog1.FileName = "openFileDialog1"; |
|
91 |
// |
|
92 |
// Form1 |
|
93 |
// |
|
94 |
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); |
|
95 |
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
|
96 |
this.ClientSize = new System.Drawing.Size(490, 138); |
|
97 |
this.Controls.Add(this.panel2); |
|
98 |
this.Controls.Add(this.panel1); |
|
99 |
this.Name = "Form1"; |
|
100 |
this.Text = "Form1"; |
|
101 |
this.panel1.ResumeLayout(false); |
|
102 |
this.panel1.PerformLayout(); |
|
103 |
this.panel2.ResumeLayout(false); |
|
104 |
this.ResumeLayout(false); |
|
105 |
|
|
106 |
} |
|
107 |
|
|
108 |
#endregion |
|
109 |
|
|
110 |
private System.Windows.Forms.Panel panel1; |
|
111 |
private System.Windows.Forms.Button button1; |
|
112 |
private System.Windows.Forms.TextBox textBox1; |
|
113 |
private System.Windows.Forms.Panel panel2; |
|
114 |
private System.Windows.Forms.Button button2; |
|
115 |
private System.Windows.Forms.OpenFileDialog openFileDialog1; |
|
116 |
} |
|
117 |
} |
|
118 |
|
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/AutoCAD_Utility/Form1.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.ComponentModel; |
|
4 |
using System.Data; |
|
5 |
using System.Diagnostics; |
|
6 |
using System.Drawing; |
|
7 |
using System.IO; |
|
8 |
using System.Linq; |
|
9 |
using System.Text; |
|
10 |
using System.Threading.Tasks; |
|
11 |
using System.Windows.Forms; |
|
12 |
|
|
13 |
namespace AutoCAD_Utility |
|
14 |
{ |
|
15 |
public partial class Form1 : Form |
|
16 |
{ |
|
17 |
public Form1() |
|
18 |
{ |
|
19 |
InitializeComponent(); |
|
20 |
} |
|
21 |
|
|
22 |
private void button2_Click(object sender, EventArgs e) |
|
23 |
{ |
|
24 |
string sAutoCADPath = string.Empty; |
|
25 |
sAutoCADPath = textBox1.Text; |
|
26 |
|
|
27 |
if (!string.IsNullOrEmpty(sAutoCADPath)) |
|
28 |
{ |
|
29 |
System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly(); |
|
30 |
string strAppRoot = Path.GetDirectoryName(asm.Location); |
|
31 |
string strStartUpFileName = Path.Combine(strAppRoot, "StartUp.scr"); |
|
32 |
File.Delete(strStartUpFileName); |
|
33 |
|
|
34 |
using (StreamWriter sw = File.CreateText(strStartUpFileName)) |
|
35 |
{ |
|
36 |
sw.WriteLine("(defun AddToTrustedPaths (path / DELIMETER t_paths len i t_path found ch)"); |
|
37 |
sw.WriteLine(" (setq DELIMETER \";\")"); |
|
38 |
sw.WriteLine(" (setq t_paths (vl-string-trim (strcat \" \" DELIMETER) (getvar \"TRUSTEDPATHS\")))"); |
|
39 |
sw.WriteLine(" (setq len (strlen t_paths) i 1 t_path \"\" found nil)"); |
|
40 |
sw.WriteLine(" (while (and (< i len) (/= found T))"); |
|
41 |
sw.WriteLine(" (setq ch (substr t_paths i 1))"); |
|
42 |
sw.WriteLine(" (if (or (= ch DELIMETER) (= i len))"); |
|
43 |
sw.WriteLine(" (progn (if (= t_path path) (setq found T)) (setq t_path \"\"))"); |
|
44 |
sw.WriteLine(" (progn (setq t_path (strcat t_path ch)))"); |
|
45 |
sw.WriteLine(" )"); |
|
46 |
sw.WriteLine(" (setq i (+ i 1))"); |
|
47 |
sw.WriteLine(" )"); |
|
48 |
sw.WriteLine(" (if (/= found T) (setvar \"TRUSTEDPATHS\" (strcat t_paths DELIMETER path)))"); |
|
49 |
sw.WriteLine(")"); |
|
50 |
sw.WriteLine(string.Format("(AddToTrustedPaths \"{0}\")", strAppRoot.ToUpper().Replace(@"\", @"\\"))); |
|
51 |
sw.WriteLine("(setq AddToTrustedPaths nil)"); |
|
52 |
|
|
53 |
sw.WriteLine(string.Format("(command \"netload\" \"{0}.dll\")", Path.Combine(strAppRoot, "CAD_Util").Replace(@"\", @"\\"))); |
|
54 |
|
|
55 |
} |
|
56 |
|
|
57 |
Process procAutoCAD = new Process(); |
|
58 |
|
|
59 |
procAutoCAD.StartInfo.FileName = sAutoCADPath; |
|
60 |
procAutoCAD.StartInfo.Arguments = string.Format("/b \"{0}\"", strStartUpFileName); |
|
61 |
procAutoCAD.Start(); |
|
62 |
} |
|
63 |
} |
|
64 |
|
|
65 |
|
|
66 |
private void button1_Click(object sender, EventArgs e) |
|
67 |
{ |
|
68 |
if (openFileDialog1.ShowDialog() == DialogResult.OK) |
|
69 |
{ |
|
70 |
textBox1.Text = openFileDialog1.FileName; |
|
71 |
} |
|
72 |
} |
|
73 |
} |
|
74 |
} |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/AutoCAD_Utility/Form1.resx | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<root> |
|
3 |
<!-- |
|
4 |
Microsoft ResX Schema |
|
5 |
|
|
6 |
Version 2.0 |
|
7 |
|
|
8 |
The primary goals of this format is to allow a simple XML format |
|
9 |
that is mostly human readable. The generation and parsing of the |
|
10 |
various data types are done through the TypeConverter classes |
|
11 |
associated with the data types. |
|
12 |
|
|
13 |
Example: |
|
14 |
|
|
15 |
... ado.net/XML headers & schema ... |
|
16 |
<resheader name="resmimetype">text/microsoft-resx</resheader> |
|
17 |
<resheader name="version">2.0</resheader> |
|
18 |
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
|
19 |
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
|
20 |
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
|
21 |
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
|
22 |
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
|
23 |
<value>[base64 mime encoded serialized .NET Framework object]</value> |
|
24 |
</data> |
|
25 |
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
|
26 |
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
|
27 |
<comment>This is a comment</comment> |
|
28 |
</data> |
|
29 |
|
|
30 |
There are any number of "resheader" rows that contain simple |
|
31 |
name/value pairs. |
|
32 |
|
|
33 |
Each data row contains a name, and value. The row also contains a |
|
34 |
type or mimetype. Type corresponds to a .NET class that support |
|
35 |
text/value conversion through the TypeConverter architecture. |
|
36 |
Classes that don't support this are serialized and stored with the |
|
37 |
mimetype set. |
|
38 |
|
|
39 |
The mimetype is used for serialized objects, and tells the |
|
40 |
ResXResourceReader how to depersist the object. This is currently not |
|
41 |
extensible. For a given mimetype the value must be set accordingly: |
|
42 |
|
|
43 |
Note - application/x-microsoft.net.object.binary.base64 is the format |
|
44 |
that the ResXResourceWriter will generate, however the reader can |
|
45 |
read any of the formats listed below. |
|
46 |
|
|
47 |
mimetype: application/x-microsoft.net.object.binary.base64 |
|
48 |
value : The object must be serialized with |
|
49 |
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
|
50 |
: and then encoded with base64 encoding. |
|
51 |
|
|
52 |
mimetype: application/x-microsoft.net.object.soap.base64 |
|
53 |
value : The object must be serialized with |
|
54 |
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
|
55 |
: and then encoded with base64 encoding. |
|
56 |
|
|
57 |
mimetype: application/x-microsoft.net.object.bytearray.base64 |
|
58 |
value : The object must be serialized into a byte array |
|
59 |
: using a System.ComponentModel.TypeConverter |
|
60 |
: and then encoded with base64 encoding. |
|
61 |
--> |
|
62 |
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
|
63 |
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
|
64 |
<xsd:element name="root" msdata:IsDataSet="true"> |
|
65 |
<xsd:complexType> |
|
66 |
<xsd:choice maxOccurs="unbounded"> |
|
67 |
<xsd:element name="metadata"> |
|
68 |
<xsd:complexType> |
|
69 |
<xsd:sequence> |
|
70 |
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
|
71 |
</xsd:sequence> |
|
72 |
<xsd:attribute name="name" use="required" type="xsd:string" /> |
|
73 |
<xsd:attribute name="type" type="xsd:string" /> |
|
74 |
<xsd:attribute name="mimetype" type="xsd:string" /> |
|
75 |
<xsd:attribute ref="xml:space" /> |
|
76 |
</xsd:complexType> |
|
77 |
</xsd:element> |
|
78 |
<xsd:element name="assembly"> |
|
79 |
<xsd:complexType> |
|
80 |
<xsd:attribute name="alias" type="xsd:string" /> |
|
81 |
<xsd:attribute name="name" type="xsd:string" /> |
|
82 |
</xsd:complexType> |
|
83 |
</xsd:element> |
|
84 |
<xsd:element name="data"> |
|
85 |
<xsd:complexType> |
|
86 |
<xsd:sequence> |
|
87 |
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
|
88 |
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
|
89 |
</xsd:sequence> |
|
90 |
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
|
91 |
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
|
92 |
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
|
93 |
<xsd:attribute ref="xml:space" /> |
|
94 |
</xsd:complexType> |
|
95 |
</xsd:element> |
|
96 |
<xsd:element name="resheader"> |
|
97 |
<xsd:complexType> |
|
98 |
<xsd:sequence> |
|
99 |
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
|
100 |
</xsd:sequence> |
|
101 |
<xsd:attribute name="name" type="xsd:string" use="required" /> |
|
102 |
</xsd:complexType> |
|
103 |
</xsd:element> |
|
104 |
</xsd:choice> |
|
105 |
</xsd:complexType> |
|
106 |
</xsd:element> |
|
107 |
</xsd:schema> |
|
108 |
<resheader name="resmimetype"> |
|
109 |
<value>text/microsoft-resx</value> |
|
110 |
</resheader> |
|
111 |
<resheader name="version"> |
|
112 |
<value>2.0</value> |
|
113 |
</resheader> |
|
114 |
<resheader name="reader"> |
|
115 |
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
|
116 |
</resheader> |
|
117 |
<resheader name="writer"> |
|
118 |
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
|
119 |
</resheader> |
|
120 |
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
|
121 |
<value>17, 17</value> |
|
122 |
</metadata> |
|
123 |
</root> |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/AutoCAD_Utility/Program.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Threading.Tasks; |
|
5 |
using System.Windows.Forms; |
|
6 |
|
|
7 |
namespace AutoCAD_Utility |
|
8 |
{ |
|
9 |
static class Program |
|
10 |
{ |
|
11 |
/// <summary> |
|
12 |
/// 해당 응용 프로그램의 주 진입점입니다. |
|
13 |
/// </summary> |
|
14 |
[STAThread] |
|
15 |
static void Main() |
|
16 |
{ |
|
17 |
Application.EnableVisualStyles(); |
|
18 |
Application.SetCompatibleTextRenderingDefault(false); |
|
19 |
Application.Run(new Form1()); |
|
20 |
} |
|
21 |
} |
|
22 |
} |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/AutoCAD_Utility/Properties/AssemblyInfo.cs | ||
---|---|---|
1 |
using System.Reflection; |
|
2 |
using System.Runtime.CompilerServices; |
|
3 |
using System.Runtime.InteropServices; |
|
4 |
|
|
5 |
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 |
|
6 |
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면 |
|
7 |
// 이러한 특성 값을 변경하세요. |
|
8 |
[assembly: AssemblyTitle("AutoCAD_Utility")] |
|
9 |
[assembly: AssemblyDescription("")] |
|
10 |
[assembly: AssemblyConfiguration("")] |
|
11 |
[assembly: AssemblyCompany("")] |
|
12 |
[assembly: AssemblyProduct("AutoCAD_Utility")] |
|
13 |
[assembly: AssemblyCopyright("Copyright © 2021")] |
|
14 |
[assembly: AssemblyTrademark("")] |
|
15 |
[assembly: AssemblyCulture("")] |
|
16 |
|
|
17 |
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 |
|
18 |
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 |
|
19 |
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요. |
|
20 |
[assembly: ComVisible(false)] |
|
21 |
|
|
22 |
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다. |
|
23 |
[assembly: Guid("fb5e8d4b-1f72-4f7a-8fdd-0a088fbb72eb")] |
|
24 |
|
|
25 |
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다. |
|
26 |
// |
|
27 |
// 주 버전 |
|
28 |
// 부 버전 |
|
29 |
// 빌드 번호 |
|
30 |
// 수정 버전 |
|
31 |
// |
|
32 |
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로 |
|
33 |
// 지정되도록 할 수 있습니다. |
|
34 |
// [assembly: AssemblyVersion("1.0.*")] |
|
35 |
[assembly: AssemblyVersion("1.0.0.0")] |
|
36 |
[assembly: AssemblyFileVersion("1.0.0.0")] |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/AutoCAD_Utility/Properties/Resources.Designer.cs | ||
---|---|---|
1 |
//------------------------------------------------------------------------------ |
|
2 |
// <auto-generated> |
|
3 |
// 이 코드는 도구를 사용하여 생성되었습니다. |
|
4 |
// 런타임 버전:4.0.30319.42000 |
|
5 |
// |
|
6 |
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 |
|
7 |
// 이러한 변경 내용이 손실됩니다. |
|
8 |
// </auto-generated> |
|
9 |
//------------------------------------------------------------------------------ |
|
10 |
|
|
11 |
namespace AutoCAD_Utility.Properties |
|
12 |
{ |
|
13 |
|
|
14 |
|
|
15 |
/// <summary> |
|
16 |
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다. |
|
17 |
/// </summary> |
|
18 |
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder |
|
19 |
// 클래스에서 자동으로 생성되었습니다. |
|
20 |
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 |
|
21 |
// ResGen을 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오. |
|
22 |
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] |
|
23 |
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
|
24 |
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
|
25 |
internal class Resources |
|
26 |
{ |
|
27 |
|
|
28 |
private static global::System.Resources.ResourceManager resourceMan; |
|
29 |
|
|
30 |
private static global::System.Globalization.CultureInfo resourceCulture; |
|
31 |
|
|
32 |
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] |
|
33 |
internal Resources() |
|
34 |
{ |
|
35 |
} |
|
36 |
|
|
37 |
/// <summary> |
|
38 |
/// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다. |
|
39 |
/// </summary> |
|
40 |
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
|
41 |
internal static global::System.Resources.ResourceManager ResourceManager |
|
42 |
{ |
|
43 |
get |
|
44 |
{ |
|
45 |
if ((resourceMan == null)) |
|
46 |
{ |
|
47 |
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AutoCAD_Utility.Properties.Resources", typeof(Resources).Assembly); |
|
48 |
resourceMan = temp; |
|
49 |
} |
|
50 |
return resourceMan; |
|
51 |
} |
|
52 |
} |
|
53 |
|
|
54 |
/// <summary> |
|
55 |
/// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을 |
|
56 |
/// 재정의합니다. |
|
57 |
/// </summary> |
|
58 |
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
|
59 |
internal static global::System.Globalization.CultureInfo Culture |
|
60 |
{ |
|
61 |
get |
|
62 |
{ |
|
63 |
return resourceCulture; |
|
64 |
} |
|
65 |
set |
|
66 |
{ |
|
67 |
resourceCulture = value; |
|
68 |
} |
|
69 |
} |
|
70 |
} |
|
71 |
} |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/AutoCAD_Utility/Properties/Resources.resx | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<root> |
|
3 |
<!-- |
|
4 |
Microsoft ResX Schema |
|
5 |
|
|
6 |
Version 2.0 |
|
7 |
|
|
8 |
The primary goals of this format is to allow a simple XML format |
|
9 |
that is mostly human readable. The generation and parsing of the |
|
10 |
various data types are done through the TypeConverter classes |
|
11 |
associated with the data types. |
|
12 |
|
|
13 |
Example: |
|
14 |
|
|
15 |
... ado.net/XML headers & schema ... |
|
16 |
<resheader name="resmimetype">text/microsoft-resx</resheader> |
|
17 |
<resheader name="version">2.0</resheader> |
|
18 |
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
|
19 |
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
|
20 |
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
|
21 |
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
|
22 |
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
|
23 |
<value>[base64 mime encoded serialized .NET Framework object]</value> |
|
24 |
</data> |
|
25 |
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
|
26 |
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
|
27 |
<comment>This is a comment</comment> |
|
28 |
</data> |
|
29 |
|
|
30 |
There are any number of "resheader" rows that contain simple |
|
31 |
name/value pairs. |
|
32 |
|
|
33 |
Each data row contains a name, and value. The row also contains a |
|
34 |
type or mimetype. Type corresponds to a .NET class that support |
|
35 |
text/value conversion through the TypeConverter architecture. |
|
36 |
Classes that don't support this are serialized and stored with the |
|
37 |
mimetype set. |
|
38 |
|
|
39 |
The mimetype is used for serialized objects, and tells the |
|
40 |
ResXResourceReader how to depersist the object. This is currently not |
|
41 |
extensible. For a given mimetype the value must be set accordingly: |
|
42 |
|
|
43 |
Note - application/x-microsoft.net.object.binary.base64 is the format |
|
44 |
that the ResXResourceWriter will generate, however the reader can |
|
45 |
read any of the formats listed below. |
|
46 |
|
|
47 |
mimetype: application/x-microsoft.net.object.binary.base64 |
|
48 |
value : The object must be serialized with |
|
49 |
: System.Serialization.Formatters.Binary.BinaryFormatter |
|
50 |
: and then encoded with base64 encoding. |
|
51 |
|
|
52 |
mimetype: application/x-microsoft.net.object.soap.base64 |
|
53 |
value : The object must be serialized with |
|
54 |
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
|
55 |
: and then encoded with base64 encoding. |
|
56 |
|
|
57 |
mimetype: application/x-microsoft.net.object.bytearray.base64 |
|
58 |
value : The object must be serialized into a byte array |
|
59 |
: using a System.ComponentModel.TypeConverter |
|
60 |
: and then encoded with base64 encoding. |
|
61 |
--> |
|
62 |
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
|
63 |
<xsd:element name="root" msdata:IsDataSet="true"> |
|
64 |
<xsd:complexType> |
|
65 |
<xsd:choice maxOccurs="unbounded"> |
|
66 |
<xsd:element name="metadata"> |
|
67 |
<xsd:complexType> |
|
68 |
<xsd:sequence> |
|
69 |
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
|
70 |
</xsd:sequence> |
|
71 |
<xsd:attribute name="name" type="xsd:string" /> |
|
72 |
<xsd:attribute name="type" type="xsd:string" /> |
|
73 |
<xsd:attribute name="mimetype" type="xsd:string" /> |
|
74 |
</xsd:complexType> |
|
75 |
</xsd:element> |
|
76 |
<xsd:element name="assembly"> |
|
77 |
<xsd:complexType> |
|
78 |
<xsd:attribute name="alias" type="xsd:string" /> |
|
79 |
<xsd:attribute name="name" type="xsd:string" /> |
|
80 |
</xsd:complexType> |
|
81 |
</xsd:element> |
|
82 |
<xsd:element name="data"> |
|
83 |
<xsd:complexType> |
|
84 |
<xsd:sequence> |
|
85 |
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
|
86 |
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
|
87 |
</xsd:sequence> |
|
88 |
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> |
|
89 |
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
|
90 |
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
|
91 |
</xsd:complexType> |
|
92 |
</xsd:element> |
|
93 |
<xsd:element name="resheader"> |
|
94 |
<xsd:complexType> |
|
95 |
<xsd:sequence> |
|
96 |
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
|
97 |
</xsd:sequence> |
|
98 |
<xsd:attribute name="name" type="xsd:string" use="required" /> |
|
99 |
</xsd:complexType> |
|
100 |
</xsd:element> |
|
101 |
</xsd:choice> |
|
102 |
</xsd:complexType> |
|
103 |
</xsd:element> |
|
104 |
</xsd:schema> |
|
105 |
<resheader name="resmimetype"> |
|
106 |
<value>text/microsoft-resx</value> |
|
107 |
</resheader> |
|
108 |
<resheader name="version"> |
|
109 |
<value>2.0</value> |
|
110 |
</resheader> |
|
111 |
<resheader name="reader"> |
|
112 |
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
|
113 |
</resheader> |
|
114 |
<resheader name="writer"> |
|
115 |
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
|
116 |
</resheader> |
|
117 |
</root> |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/AutoCAD_Utility/Properties/Settings.Designer.cs | ||
---|---|---|
1 |
//------------------------------------------------------------------------------ |
|
2 |
// <auto-generated> |
|
3 |
// This code was generated by a tool. |
|
4 |
// Runtime Version:4.0.30319.42000 |
|
5 |
// |
|
6 |
// Changes to this file may cause incorrect behavior and will be lost if |
|
7 |
// the code is regenerated. |
|
8 |
// </auto-generated> |
|
9 |
//------------------------------------------------------------------------------ |
|
10 |
|
|
11 |
namespace AutoCAD_Utility.Properties |
|
12 |
{ |
|
13 |
|
|
14 |
|
|
15 |
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
|
16 |
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] |
|
17 |
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase |
|
18 |
{ |
|
19 |
|
|
20 |
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); |
|
21 |
|
|
22 |
public static Settings Default |
|
23 |
{ |
|
24 |
get |
|
25 |
{ |
|
26 |
return defaultInstance; |
|
27 |
} |
|
28 |
} |
|
29 |
} |
|
30 |
} |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/AutoCAD_Utility/Properties/Settings.settings | ||
---|---|---|
1 |
<?xml version='1.0' encoding='utf-8'?> |
|
2 |
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"> |
|
3 |
<Profiles> |
|
4 |
<Profile Name="(Default)" /> |
|
5 |
</Profiles> |
|
6 |
<Settings /> |
|
7 |
</SettingsFile> |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/CAD_Util/Bounds.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace CAD_Util |
|
8 |
{ |
|
9 |
public class Bounds |
|
10 |
{ |
|
11 |
public double MinX { get; set; } |
|
12 |
public double MinY { get; set; } |
|
13 |
public double MaxX { get; set; } |
|
14 |
public double MaxY { get; set; } |
|
15 |
|
|
16 |
public Autodesk.AutoCAD.Geometry.Point2d MinPoint |
|
17 |
{ |
|
18 |
get { return new Autodesk.AutoCAD.Geometry.Point2d(this.MinX, this.MinY); } |
|
19 |
} |
|
20 |
|
|
21 |
public Autodesk.AutoCAD.Geometry.Point2d MaxPoint |
|
22 |
{ |
|
23 |
get { return new Autodesk.AutoCAD.Geometry.Point2d(this.MaxX, this.MaxY); } |
|
24 |
} |
|
25 |
|
|
26 |
public Autodesk.AutoCAD.Geometry.Point2d CenterPoint |
|
27 |
{ |
|
28 |
get { return new Autodesk.AutoCAD.Geometry.Point2d((this.MinX + this.MaxX) * 0.5, (this.MinY + this.MaxY) * 0.5); } |
|
29 |
} |
|
30 |
|
|
31 |
public static Bounds A0 |
|
32 |
{ |
|
33 |
get |
|
34 |
{ |
|
35 |
return new Bounds(0.0, 0.0, 1189.0, 841.0); |
|
36 |
} |
|
37 |
} |
|
38 |
|
|
39 |
public double Width |
|
40 |
{ |
|
41 |
get |
|
42 |
{ |
|
43 |
return this.MaxX - this.MinX; |
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
public double Height |
|
48 |
{ |
|
49 |
get |
|
50 |
{ |
|
51 |
return this.MaxY - this.MinY; |
|
52 |
} |
|
53 |
} |
|
54 |
|
|
55 |
public Bounds(double MinX, double MinY, double MaxX, double MaxY) |
|
56 |
{ |
|
57 |
this.MinX = Math.Min(MinX, MaxX); |
|
58 |
this.MinY = Math.Min(MinY, MaxY); |
|
59 |
this.MaxX = Math.Max(MinX, MaxX); |
|
60 |
this.MaxY = Math.Max(MinY, MaxY); |
|
61 |
} |
|
62 |
|
|
63 |
public Bounds(Autodesk.AutoCAD.DatabaseServices.Extents3d? extents3d) |
|
64 |
{ |
|
65 |
if (!extents3d.HasValue) return; |
|
66 |
|
|
67 |
MinX = extents3d.Value.MinPoint.X; |
|
68 |
MinY = extents3d.Value.MinPoint.Y; |
|
69 |
MaxX = extents3d.Value.MaxPoint.X; |
|
70 |
MaxY = extents3d.Value.MaxPoint.Y; |
|
71 |
} |
|
72 |
|
|
73 |
public Bounds(Bounds bounds) : this(bounds.MinX, bounds.MinY, bounds.MaxX, bounds.MaxY) |
|
74 |
{ |
|
75 |
} |
|
76 |
|
|
77 |
public void Union(Bounds bounds) |
|
78 |
{ |
|
79 |
//throw System.Exception("Not yet implemented"); |
|
80 |
} |
|
81 |
|
|
82 |
public bool Contains(Autodesk.AutoCAD.Geometry.Point3d pt) |
|
83 |
{ |
|
84 |
if (pt.X < MinX) return false; |
|
85 |
if (pt.Y < MinY) return false; |
|
86 |
if (pt.X > MaxX) return false; |
|
87 |
if (pt.Y > MaxY) return false; |
|
88 |
|
|
89 |
return true; |
|
90 |
} |
|
91 |
|
|
92 |
/// <summary> |
|
93 |
/// return true if bounds contain given pt |
|
94 |
/// </summary> |
|
95 |
/// <author>humkyung</author> |
|
96 |
/// <date>2015.10.16</date> |
|
97 |
/// <param name="pt"></param> |
|
98 |
/// <returns></returns> |
|
99 |
public bool Contains(Autodesk.AutoCAD.Geometry.Point2d pt) |
|
100 |
{ |
|
101 |
if (pt.X < MinX) return false; |
|
102 |
if (pt.Y < MinY) return false; |
|
103 |
if (pt.X > MaxX) return false; |
|
104 |
if (pt.Y > MaxY) return false; |
|
105 |
|
|
106 |
return true; |
|
107 |
} |
|
108 |
|
|
109 |
/// <summary> |
|
110 |
/// calculate scale factor to convert before bounds to after bounds |
|
111 |
/// </summary> |
|
112 |
/// <author>humkyung</author> |
|
113 |
/// <param name="before"></param> |
|
114 |
/// <param name="after"></param> |
|
115 |
/// <param name="dScaleFactor"></param> |
|
116 |
/// <returns></returns> |
|
117 |
public static bool TryCalcScaleFactor(Bounds before, Bounds after, out double dScaleFactor) |
|
118 |
{ |
|
119 |
dScaleFactor = 1; |
|
120 |
try |
|
121 |
{ |
|
122 |
dScaleFactor = after.Width / before.Width; |
|
123 |
double temp = after.Height / before.Height; |
|
124 |
dScaleFactor = (temp < dScaleFactor) ? temp : dScaleFactor; |
|
125 |
} |
|
126 |
catch |
|
127 |
{ |
|
128 |
dScaleFactor = 1; |
|
129 |
} |
|
130 |
|
|
131 |
return true; |
|
132 |
} |
|
133 |
|
|
134 |
public override string ToString() |
|
135 |
{ |
|
136 |
return string.Format("({0:F4},{1:F4})-({2:F4},{3:F4})", this.MinX, this.MinY, this.MaxX, this.MaxY); |
|
137 |
} |
|
138 |
} |
|
139 |
} |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/CAD_Util/CAD_Util.csproj | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
3 |
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
|
4 |
<PropertyGroup> |
|
5 |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|
6 |
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|
7 |
<ProjectGuid>{E8B1149D-ADFF-4C33-82E0-C07CC0DFF6C0}</ProjectGuid> |
|
8 |
<OutputType>Library</OutputType> |
|
9 |
<AppDesignerFolder>Properties</AppDesignerFolder> |
|
10 |
<RootNamespace>CAD_Util</RootNamespace> |
|
11 |
<AssemblyName>CAD_Util</AssemblyName> |
|
12 |
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> |
|
13 |
<FileAlignment>512</FileAlignment> |
|
14 |
<Deterministic>true</Deterministic> |
|
15 |
</PropertyGroup> |
|
16 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
17 |
<DebugSymbols>true</DebugSymbols> |
|
18 |
<DebugType>full</DebugType> |
|
19 |
<Optimize>false</Optimize> |
|
20 |
<OutputPath>..\Setup\</OutputPath> |
|
21 |
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
22 |
<ErrorReport>prompt</ErrorReport> |
|
23 |
<WarningLevel>4</WarningLevel> |
|
24 |
</PropertyGroup> |
|
25 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
26 |
<DebugType>pdbonly</DebugType> |
|
27 |
<Optimize>true</Optimize> |
|
28 |
<OutputPath>bin\Release\</OutputPath> |
|
29 |
<DefineConstants>TRACE</DefineConstants> |
|
30 |
<ErrorReport>prompt</ErrorReport> |
|
31 |
<WarningLevel>4</WarningLevel> |
|
32 |
</PropertyGroup> |
|
33 |
<ItemGroup> |
|
34 |
<Reference Include="accoremgd"> |
|
35 |
<HintPath>C:\Program Files\Autodesk\AutoCAD 2020\accoremgd.dll</HintPath> |
|
36 |
</Reference> |
|
37 |
<Reference Include="acdbmgd"> |
|
38 |
<HintPath>C:\Program Files\Autodesk\AutoCAD 2020\acdbmgd.dll</HintPath> |
|
39 |
</Reference> |
|
40 |
<Reference Include="acdbmgdbrep"> |
|
41 |
<HintPath>C:\Program Files\Autodesk\AutoCAD 2020\acdbmgdbrep.dll</HintPath> |
|
42 |
</Reference> |
|
43 |
<Reference Include="acmgd"> |
|
44 |
<HintPath>C:\Program Files\Autodesk\AutoCAD 2020\acmgd.dll</HintPath> |
|
45 |
</Reference> |
|
46 |
<Reference Include="AcWindows"> |
|
47 |
<HintPath>C:\Program Files\Autodesk\AutoCAD 2020\AcWindows.dll</HintPath> |
|
48 |
</Reference> |
|
49 |
<Reference Include="AdWindows"> |
|
50 |
<HintPath>C:\Program Files\Autodesk\AutoCAD 2020\AdWindows.dll</HintPath> |
|
51 |
</Reference> |
|
52 |
<Reference Include="PresentationCore" /> |
|
53 |
<Reference Include="PresentationFramework" /> |
|
54 |
<Reference Include="System" /> |
|
55 |
<Reference Include="System.Core" /> |
|
56 |
<Reference Include="System.Drawing" /> |
|
57 |
<Reference Include="System.Windows.Forms" /> |
|
58 |
<Reference Include="System.Xml.Linq" /> |
|
59 |
<Reference Include="System.Data.DataSetExtensions" /> |
|
60 |
<Reference Include="Microsoft.CSharp" /> |
|
61 |
<Reference Include="System.Data" /> |
|
62 |
<Reference Include="System.Net.Http" /> |
|
63 |
<Reference Include="System.Xml" /> |
|
64 |
<Reference Include="WindowsBase" /> |
|
65 |
</ItemGroup> |
|
66 |
<ItemGroup> |
|
67 |
<Compile Include="Bounds.cs" /> |
|
68 |
<Compile Include="Class1.cs" /> |
|
69 |
<Compile Include="CustomRibbonClass.cs" /> |
|
70 |
<Compile Include="FormConvertToPDF.cs"> |
|
71 |
<SubType>Form</SubType> |
|
72 |
</Compile> |
|
73 |
<Compile Include="FormConvertToPDF.Designer.cs"> |
|
74 |
<DependentUpon>FormConvertToPDF.cs</DependentUpon> |
|
75 |
</Compile> |
|
76 |
<Compile Include="PlugInInitializer.cs" /> |
|
77 |
<Compile Include="Properties\AssemblyInfo.cs" /> |
|
78 |
</ItemGroup> |
|
79 |
<ItemGroup> |
|
80 |
<EmbeddedResource Include="FormConvertToPDF.resx"> |
|
81 |
<DependentUpon>FormConvertToPDF.cs</DependentUpon> |
|
82 |
</EmbeddedResource> |
|
83 |
</ItemGroup> |
|
84 |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|
85 |
</Project> |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/CAD_Util/Class1.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace CAD_Util |
|
8 |
{ |
|
9 |
public class Class1 |
|
10 |
{ |
|
11 |
} |
|
12 |
} |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/CAD_Util/CustomRibbonClass.cs | ||
---|---|---|
1 |
using Autodesk.AutoCAD.Runtime; |
|
2 |
using Autodesk.Windows; |
|
3 |
using System; |
|
4 |
using System.Collections.Generic; |
|
5 |
using System.Linq; |
|
6 |
using System.Text; |
|
7 |
using System.Threading.Tasks; |
|
8 |
using System.Windows.Input; |
|
9 |
using acApp = Autodesk.AutoCAD.ApplicationServices.Application; |
|
10 |
|
|
11 |
namespace CAD_Util |
|
12 |
{ |
|
13 |
class CustomRibbonClass |
|
14 |
{ |
|
15 |
private string[] m_Groups = new string[] { "Utility" }; |
|
16 |
private static CustomRibbonClass s_CustomRibbonClass; |
|
17 |
|
|
18 |
public static CustomRibbonClass Instance |
|
19 |
{ |
|
20 |
get |
|
21 |
{ |
|
22 |
if (CustomRibbonClass.s_CustomRibbonClass == null) |
|
23 |
CustomRibbonClass.s_CustomRibbonClass = new CustomRibbonClass(); |
|
24 |
return CustomRibbonClass.s_CustomRibbonClass; |
|
25 |
} |
|
26 |
} |
|
27 |
|
|
28 |
[CommandMethod("MainRibbon", CommandFlags.Transparent)] |
|
29 |
public void MainRibbon() |
|
30 |
{ |
|
31 |
//Tab 1 |
|
32 |
|
|
33 |
RibbonControl ribbon = ComponentManager.Ribbon; |
|
34 |
if (ribbon != null) |
|
35 |
{ |
|
36 |
RibbonTab rtab = ribbon.FindTab("Utility"); |
|
37 |
if (rtab != null) |
|
38 |
{ |
|
39 |
ribbon.Tabs.Remove(rtab); |
|
40 |
} |
|
41 |
rtab = new RibbonTab(); |
|
42 |
rtab.Title = "Utility"; |
|
43 |
rtab.Id = "Utility"; |
|
44 |
//Add the Tab |
|
45 |
ribbon.Tabs.Add(rtab); |
|
46 |
|
|
47 |
addContent(rtab, m_Groups); |
|
48 |
} |
|
49 |
} |
|
50 |
|
|
51 |
static void addContent(RibbonTab rtab, string[] sGroups) |
|
52 |
{ |
|
53 |
rtab.Panels.Add(AddOnePanel(sGroups)); |
|
54 |
} |
|
55 |
|
|
56 |
static RibbonPanel AddOnePanel(string[] sGroups) |
|
57 |
{ |
|
58 |
|
|
59 |
RibbonPanel rp = new RibbonPanel(); |
|
60 |
RibbonPanelSource rpsUtility = new RibbonPanelSource(); |
|
61 |
rpsUtility.Title = "Utility"; |
|
62 |
try |
|
63 |
{ |
|
64 |
foreach (string sGroup in sGroups) |
|
65 |
{ |
|
66 |
switch (sGroup) |
|
67 |
{ |
|
68 |
case "Utility": |
|
69 |
|
|
70 |
RibbonButton rbConvertToPDF = new RibbonButton(); |
|
71 |
rbConvertToPDF.Name = "ConvertToPDF"; |
|
72 |
rbConvertToPDF.ShowImage = true; |
|
73 |
rbConvertToPDF.ShowText = true; |
|
74 |
rbConvertToPDF.Orientation = System.Windows.Controls.Orientation.Vertical; |
|
75 |
rbConvertToPDF.Size = RibbonItemSize.Large; |
|
76 |
rbConvertToPDF.Text = "Convert To PDF"; |
|
77 |
rbConvertToPDF.Id = "ConvertToPDF"; |
|
78 |
rpsUtility.Items.Add(rbConvertToPDF); |
|
79 |
rbConvertToPDF.CommandHandler = new MyRibbonCommandHandler(); |
|
80 |
break; |
|
81 |
|
|
82 |
default: |
|
83 |
break; |
|
84 |
} |
|
85 |
} |
|
86 |
|
|
87 |
rp.Source = rpsUtility; |
|
88 |
} |
|
89 |
catch |
|
90 |
{ |
|
91 |
|
|
92 |
} |
|
93 |
return rp; |
|
94 |
} |
|
95 |
} |
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
public class MyRibbonCommandHandler : ICommand |
|
100 |
{ |
|
101 |
public event EventHandler CanExecuteChanged; |
|
102 |
|
|
103 |
public bool CanExecute(object parameter) |
|
104 |
{ |
|
105 |
return true; |
|
106 |
} |
|
107 |
|
|
108 |
public void Execute(object parameter) |
|
109 |
{ |
|
110 |
RibbonCommandItem cmd = parameter as RibbonCommandItem; |
|
111 |
|
|
112 |
if (cmd.Name == "ConvertToPDF") |
|
113 |
{ |
|
114 |
FormConvertToPDF form = new FormConvertToPDF(); |
|
115 |
//form.Show(); |
|
116 |
acApp.ShowModelessDialog(acApp.MainWindow.Handle, form, true); |
|
117 |
} |
|
118 |
|
|
119 |
} |
|
120 |
} |
|
121 |
|
|
122 |
} |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/CAD_Util/FormConvertToPDF.Designer.cs | ||
---|---|---|
1 |
namespace CAD_Util |
|
2 |
{ |
|
3 |
partial class FormConvertToPDF |
|
4 |
{ |
|
5 |
/// <summary> |
|
6 |
/// Required designer variable. |
|
7 |
/// </summary> |
|
8 |
private System.ComponentModel.IContainer components = null; |
|
9 |
|
|
10 |
/// <summary> |
|
11 |
/// Clean up any resources being used. |
|
12 |
/// </summary> |
|
13 |
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
|
14 |
protected override void Dispose(bool disposing) |
|
15 |
{ |
|
16 |
if (disposing && (components != null)) |
|
17 |
{ |
|
18 |
components.Dispose(); |
|
19 |
} |
|
20 |
base.Dispose(disposing); |
|
21 |
} |
|
22 |
|
|
23 |
#region Windows Form Designer generated code |
|
24 |
|
|
25 |
/// <summary> |
|
26 |
/// Required method for Designer support - do not modify |
|
27 |
/// the contents of this method with the code editor. |
|
28 |
/// </summary> |
|
29 |
private void InitializeComponent() |
|
30 |
{ |
|
31 |
this.panel1 = new System.Windows.Forms.Panel(); |
|
32 |
this.buttonOpen = new System.Windows.Forms.Button(); |
|
33 |
this.panel2 = new System.Windows.Forms.Panel(); |
|
34 |
this.buttonRun = new System.Windows.Forms.Button(); |
|
35 |
this.buttonClose = new System.Windows.Forms.Button(); |
|
36 |
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); |
|
37 |
this.panel4 = new System.Windows.Forms.Panel(); |
|
38 |
this.panel3 = new System.Windows.Forms.Panel(); |
|
39 |
this.dataGridView1 = new System.Windows.Forms.DataGridView(); |
|
40 |
this.ColumnFilePath = new System.Windows.Forms.DataGridViewTextBoxColumn(); |
|
41 |
this.dataGridViewException = new System.Windows.Forms.DataGridView(); |
|
42 |
this.ColumnExceptionBlockName = new System.Windows.Forms.DataGridViewTextBoxColumn(); |
|
43 |
this.panel1.SuspendLayout(); |
|
44 |
this.panel2.SuspendLayout(); |
|
45 |
this.panel4.SuspendLayout(); |
|
46 |
this.panel3.SuspendLayout(); |
|
47 |
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); |
|
48 |
((System.ComponentModel.ISupportInitialize)(this.dataGridViewException)).BeginInit(); |
|
49 |
this.SuspendLayout(); |
|
50 |
// |
|
51 |
// panel1 |
|
52 |
// |
|
53 |
this.panel1.Controls.Add(this.buttonOpen); |
|
54 |
this.panel1.Dock = System.Windows.Forms.DockStyle.Top; |
|
55 |
this.panel1.Location = new System.Drawing.Point(0, 0); |
|
56 |
this.panel1.Name = "panel1"; |
|
57 |
this.panel1.Size = new System.Drawing.Size(800, 46); |
|
58 |
this.panel1.TabIndex = 0; |
|
59 |
// |
|
60 |
// buttonOpen |
|
61 |
// |
|
62 |
this.buttonOpen.Location = new System.Drawing.Point(713, 12); |
|
63 |
this.buttonOpen.Name = "buttonOpen"; |
|
64 |
this.buttonOpen.Size = new System.Drawing.Size(75, 23); |
|
65 |
this.buttonOpen.TabIndex = 0; |
|
66 |
this.buttonOpen.Text = "Open Files"; |
|
67 |
this.buttonOpen.UseVisualStyleBackColor = true; |
|
68 |
this.buttonOpen.Click += new System.EventHandler(this.button1_Click); |
|
69 |
// |
|
70 |
// panel2 |
|
71 |
// |
|
72 |
this.panel2.Controls.Add(this.buttonRun); |
|
73 |
this.panel2.Controls.Add(this.buttonClose); |
|
74 |
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; |
|
75 |
this.panel2.Location = new System.Drawing.Point(0, 406); |
|
76 |
this.panel2.Name = "panel2"; |
|
77 |
this.panel2.Size = new System.Drawing.Size(800, 44); |
|
78 |
this.panel2.TabIndex = 1; |
|
79 |
// |
|
80 |
// buttonRun |
|
81 |
// |
|
82 |
this.buttonRun.Location = new System.Drawing.Point(632, 9); |
|
83 |
this.buttonRun.Name = "buttonRun"; |
|
84 |
this.buttonRun.Size = new System.Drawing.Size(75, 23); |
|
85 |
this.buttonRun.TabIndex = 2; |
|
86 |
this.buttonRun.Text = "Run"; |
|
87 |
this.buttonRun.UseVisualStyleBackColor = true; |
|
88 |
this.buttonRun.Click += new System.EventHandler(this.buttonRun_Click); |
|
89 |
// |
|
90 |
// buttonClose |
|
91 |
// |
|
92 |
this.buttonClose.Location = new System.Drawing.Point(713, 9); |
|
93 |
this.buttonClose.Name = "buttonClose"; |
|
94 |
this.buttonClose.Size = new System.Drawing.Size(75, 23); |
|
95 |
this.buttonClose.TabIndex = 1; |
|
96 |
this.buttonClose.Text = "Close"; |
|
97 |
this.buttonClose.UseVisualStyleBackColor = true; |
|
98 |
this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click); |
|
99 |
// |
|
100 |
// panel4 |
|
101 |
// |
|
102 |
this.panel4.Controls.Add(this.dataGridViewException); |
|
103 |
this.panel4.Dock = System.Windows.Forms.DockStyle.Top; |
|
104 |
this.panel4.Location = new System.Drawing.Point(0, 46); |
|
105 |
this.panel4.Name = "panel4"; |
|
106 |
this.panel4.Size = new System.Drawing.Size(800, 168); |
|
107 |
this.panel4.TabIndex = 3; |
|
108 |
// |
|
109 |
// panel3 |
|
110 |
// |
|
111 |
this.panel3.Controls.Add(this.dataGridView1); |
|
112 |
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; |
|
113 |
this.panel3.Location = new System.Drawing.Point(0, 214); |
|
114 |
this.panel3.Name = "panel3"; |
|
115 |
this.panel3.Size = new System.Drawing.Size(800, 192); |
|
116 |
this.panel3.TabIndex = 4; |
|
117 |
// |
|
118 |
// dataGridView1 |
|
119 |
// |
|
120 |
this.dataGridView1.AllowUserToAddRows = false; |
|
121 |
this.dataGridView1.AllowUserToDeleteRows = false; |
|
122 |
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; |
|
123 |
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { |
|
124 |
this.ColumnFilePath}); |
|
125 |
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; |
|
126 |
this.dataGridView1.Location = new System.Drawing.Point(0, 0); |
|
127 |
this.dataGridView1.Name = "dataGridView1"; |
|
128 |
this.dataGridView1.ReadOnly = true; |
|
129 |
this.dataGridView1.RowTemplate.Height = 23; |
|
130 |
this.dataGridView1.Size = new System.Drawing.Size(800, 192); |
|
131 |
this.dataGridView1.TabIndex = 0; |
|
132 |
// |
|
133 |
// ColumnFilePath |
|
134 |
// |
|
135 |
this.ColumnFilePath.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; |
|
136 |
this.ColumnFilePath.HeaderText = "FilePath"; |
|
137 |
this.ColumnFilePath.Name = "ColumnFilePath"; |
|
138 |
this.ColumnFilePath.ReadOnly = true; |
|
139 |
// |
|
140 |
// dataGridViewException |
|
141 |
// |
|
142 |
this.dataGridViewException.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; |
|
143 |
this.dataGridViewException.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { |
|
144 |
this.ColumnExceptionBlockName}); |
|
145 |
this.dataGridViewException.Dock = System.Windows.Forms.DockStyle.Fill; |
|
146 |
this.dataGridViewException.Location = new System.Drawing.Point(0, 0); |
|
147 |
this.dataGridViewException.Name = "dataGridViewException"; |
|
148 |
this.dataGridViewException.RowTemplate.Height = 23; |
|
149 |
this.dataGridViewException.Size = new System.Drawing.Size(800, 168); |
|
150 |
this.dataGridViewException.TabIndex = 0; |
|
151 |
// |
|
152 |
// ColumnExceptionBlockName |
|
153 |
// |
|
154 |
this.ColumnExceptionBlockName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; |
|
155 |
this.ColumnExceptionBlockName.HeaderText = "UnVisible Block Name"; |
|
156 |
this.ColumnExceptionBlockName.Name = "ColumnExceptionBlockName"; |
|
157 |
// |
|
158 |
// FormConvertToPDF |
|
159 |
// |
|
160 |
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); |
|
161 |
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
|
162 |
this.ClientSize = new System.Drawing.Size(800, 450); |
|
163 |
this.Controls.Add(this.panel3); |
|
164 |
this.Controls.Add(this.panel4); |
|
165 |
this.Controls.Add(this.panel2); |
|
166 |
this.Controls.Add(this.panel1); |
|
167 |
this.Name = "FormConvertToPDF"; |
|
168 |
this.Text = "FormConvertToPDF"; |
|
169 |
this.panel1.ResumeLayout(false); |
|
170 |
this.panel2.ResumeLayout(false); |
|
171 |
this.panel4.ResumeLayout(false); |
|
172 |
this.panel3.ResumeLayout(false); |
|
173 |
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); |
|
174 |
((System.ComponentModel.ISupportInitialize)(this.dataGridViewException)).EndInit(); |
|
175 |
this.ResumeLayout(false); |
|
176 |
|
|
177 |
} |
|
178 |
|
|
179 |
#endregion |
|
180 |
|
|
181 |
private System.Windows.Forms.Panel panel1; |
|
182 |
private System.Windows.Forms.Button buttonOpen; |
|
183 |
private System.Windows.Forms.Panel panel2; |
|
184 |
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; |
|
185 |
private System.Windows.Forms.Button buttonClose; |
|
186 |
private System.Windows.Forms.Button buttonRun; |
|
187 |
private System.Windows.Forms.Panel panel4; |
|
188 |
private System.Windows.Forms.DataGridView dataGridViewException; |
|
189 |
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnExceptionBlockName; |
|
190 |
private System.Windows.Forms.Panel panel3; |
|
191 |
private System.Windows.Forms.DataGridView dataGridView1; |
|
192 |
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnFilePath; |
|
193 |
} |
|
194 |
} |
DTI_PID/AutoCAD_Utility/AutoCAD_Utility/CAD_Util/FormConvertToPDF.cs | ||
---|---|---|
1 |
using Autodesk.AutoCAD.ApplicationServices; |
|
2 |
using Autodesk.AutoCAD.DatabaseServices; |
|
3 |
using Autodesk.AutoCAD.PlottingServices; |
|
4 |
using Autodesk.AutoCAD.Runtime; |
|
5 |
using System; |
|
6 |
using System.Collections.Generic; |
|
7 |
using System.ComponentModel; |
|
8 |
using System.Data; |
|
9 |
using System.Drawing; |
|
10 |
using System.IO; |
|
11 |
using System.Linq; |
|
12 |
using System.Text; |
|
13 |
using System.Threading.Tasks; |
|
14 |
using System.Windows.Forms; |
|
15 |
using Application = Autodesk.AutoCAD.ApplicationServices.Application; |
|
16 |
|
|
17 |
namespace CAD_Util |
|
18 |
{ |
|
19 |
public partial class FormConvertToPDF : Form |
|
20 |
{ |
|
21 |
public FormConvertToPDF() |
|
22 |
{ |
|
23 |
InitializeComponent(); |
|
24 |
} |
|
25 |
|
|
26 |
private void button1_Click(object sender, EventArgs e) |
|
27 |
{ |
|
28 |
if(folderBrowserDialog1.ShowDialog() == DialogResult.OK) |
|
29 |
{ |
|
30 |
string sSelectPath = folderBrowserDialog1.SelectedPath; |
|
31 |
|
|
32 |
DirectoryInfo di = new DirectoryInfo(sSelectPath); |
|
33 |
List<FileInfo> lstFiles = new List<FileInfo>(); |
|
34 |
|
|
35 |
lstFiles = di.GetFiles("*.dwg").ToList(); |
|
36 |
|
|
37 |
foreach(FileInfo fi in lstFiles) |
|
38 |
{ |
|
39 |
dataGridView1.Rows.Add(new object[] { fi.FullName }); |
|
40 |
} |
|
41 |
} |
|
42 |
} |
|
43 |
|
|
44 |
private void buttonRun_Click(object sender, EventArgs e) |
|
45 |
{ |
|
46 |
string sLayer1 = "ISSUED FOR PDP"; |
|
47 |
string sLayer2 = "ISSUED FOR PHA"; |
|
48 |
|
|
49 |
string sSavePath = @"C:\Convert To PDF\"; |
|
50 |
|
|
51 |
if(!Directory.Exists(sSavePath)) |
|
52 |
{ |
|
53 |
Directory.CreateDirectory(sSavePath); |
|
54 |
} |
|
55 |
|
|
56 |
foreach (DataGridViewRow row in dataGridView1.Rows) |
|
57 |
{ |
|
58 |
string sFullFileName = row.Cells["ColumnFilePath"].Value.ToString(); |
|
59 |
string sFileName = string.Empty; |
|
60 |
|
|
61 |
List<string> lstUnVisibleBlocks = new List<string>(); |
|
62 |
|
|
63 |
foreach(DataGridViewRow data in dataGridViewException.Rows) |
|
64 |
{ |
|
65 |
string sException = data.Cells[0].Value != null ? data.Cells[0].Value.ToString() : string.Empty; |
|
66 |
|
|
67 |
if (!string.IsNullOrEmpty(sException)) |
|
68 |
lstUnVisibleBlocks.Add(sException); |
|
69 |
} |
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
FileInfo fi = new FileInfo(sFullFileName); |
|
74 |
if(fi.Exists) |
|
75 |
{ |
|
76 |
sFileName = fi.Name; |
|
77 |
} |
|
78 |
Document document = OpenOrActivateDocument(sFullFileName, false); |
|
79 |
Database database = document.Database; |
|
80 |
|
|
81 |
try |
|
82 |
{ |
|
83 |
using (DocumentLock documentLock = document.LockDocument()) |
|
84 |
{ |
|
85 |
using (Transaction transaction = database.TransactionManager.StartTransaction()) |
|
86 |
{ |
|
87 |
var bt = transaction.GetObject(database.BlockTableId, OpenMode.ForRead) as BlockTable; |
|
88 |
var btr = transaction.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead) as BlockTableRecord; |
|
89 |
|
|
90 |
foreach (ObjectId res in btr) |
|
91 |
{ |
|
92 |
try |
|
93 |
{ |
|
94 |
Entity en = transaction.GetObject(res, OpenMode.ForWrite) as Entity; |
|
95 |
|
|
96 |
if (en.Layer == sLayer1 || en.Layer == sLayer2) |
|
97 |
{ |
|
98 |
en.Visible = false; |
|
99 |
} |
|
100 |
|
|
101 |
|
|
102 |
BlockReference blockRef = transaction.GetObject(res, OpenMode.ForRead) as BlockReference; |
|
103 |
BlockTableRecord block = null; |
|
104 |
|
|
105 |
if (blockRef.IsDynamicBlock) |
|
106 |
{ |
|
107 |
//get the real dynamic block name. |
|
108 |
|
|
109 |
block = transaction.GetObject(blockRef.DynamicBlockTableRecord, OpenMode.ForRead) as BlockTableRecord; |
내보내기 Unified diff