├── .gitignore
├── AnyCAD.Basic
├── AnyCAD.Basic.csproj
├── DrawCurveOnSurfaceEditor.cs
├── DrawLineEditor.cs
├── FormMain.Designer.cs
├── FormMain.cs
├── FormMain.resx
├── LoadDxfContext.cs
├── MeasureDistanceEditor.cs
├── MoveNodeEditor.cs
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── QueryShapeInfoEditor.cs
├── ReadShapeContext.cs
├── app.config
└── packages.config
├── AnyCAD.Designer
├── AnyCAD.Designer.csproj
├── DrawLineEditor.cs
├── MainForm.Designer.cs
├── MainForm.cs
├── MainForm.resx
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── TubeSystem.cs
└── packages.config
├── AnyCAD.Net.SDK.Sample.sln
├── AnyCAD.WPF
├── AnyCAD.WPF.csproj
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── packages.config
├── DxfViewer
├── DxfViewer.csproj
├── MainForm.Designer.cs
├── MainForm.cs
├── MainForm.resx
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── packages.config
├── README.md
├── StpViewer
├── CADBrower.cs
├── MainForm.Designer.cs
├── MainForm.cs
├── MainForm.resx
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── StpViewer.csproj
└── packages.config
├── StpViewer_VB
├── App.config
├── Form1.Designer.vb
├── Form1.resx
├── Form1.vb
├── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ └── Settings.settings
├── StpViewer_VB.vbproj
└── packages.config
├── delm.bat
└── weixin.jpg
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | bin
3 | *.suo
4 | *.user
5 | .vs
6 | obj
7 | packages
8 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/AnyCAD.Basic.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x86
7 | 8.0.30703
8 | 2.0
9 | {89766480-D042-4E86-B67B-5BB22C6B8F21}
10 | WinExe
11 | Properties
12 | AnyCAD.Basic
13 | AnyCAD.Basic
14 | v4.0
15 |
16 |
17 | 512
18 |
19 |
20 |
21 |
22 | x86
23 | true
24 | full
25 | false
26 | ..\bin\x86\Debug\
27 | DEBUG;TRACE
28 | prompt
29 | 4
30 |
31 |
32 | x86
33 | pdbonly
34 | true
35 | ..\bin\x86\Release\
36 | TRACE
37 | prompt
38 | 4
39 |
40 |
41 | true
42 | ..\bin\x64\Debug\
43 | DEBUG;TRACE
44 | full
45 | x64
46 | ..\..\..\..\bin\Debug\AnyCAD.Basic.exe.CodeAnalysisLog.xml
47 | true
48 | GlobalSuppressions.cs
49 | prompt
50 | MinimumRecommendedRules.ruleset
51 | ;D:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
52 | false
53 | ;D:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
54 | false
55 |
56 |
57 | ..\bin\x64\Release\
58 | TRACE
59 | true
60 | pdbonly
61 | x64
62 | ..\..\..\..\bin\Release\AnyCAD.Basic.exe.CodeAnalysisLog.xml
63 | true
64 | GlobalSuppressions.cs
65 | prompt
66 | MinimumRecommendedRules.ruleset
67 | ;D:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
68 | false
69 | ;D:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
70 | false
71 | false
72 |
73 |
74 |
75 | ..\packages\AnyCAD.Net.Pro.2020.6.4\lib\x64\AnyCAD.Exchange.Net.dll
76 | False
77 |
78 |
79 | ..\packages\AnyCAD.Net.Pro.2020.6.4\lib\x64\AnyCAD.Foundation.Net.dll
80 | False
81 |
82 |
83 | ..\packages\AnyCAD.Net.Pro.2020.6.4\lib\x64\AnyCAD.Presentation.Net.dll
84 | False
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 | Form
102 |
103 |
104 | FormMain.cs
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 | FormMain.cs
113 |
114 |
115 | ResXFileCodeGenerator
116 | Resources.Designer.cs
117 | Designer
118 |
119 |
120 | True
121 | Resources.resx
122 | True
123 |
124 |
125 |
126 |
127 | SettingsSingleFileGenerator
128 | Settings.Designer.cs
129 |
130 |
131 | True
132 | Settings.settings
133 | True
134 |
135 |
136 |
137 |
138 |
139 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
140 |
141 |
142 |
143 |
150 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/DrawCurveOnSurfaceEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using AnyCAD.Platform;
6 |
7 | namespace AnyCAD.Basic
8 | {
9 | class DrawCurveOnSurfaceEditor : AnyCAD.Platform.CustomEditor
10 | {
11 | System.Collections.Generic.List m_Points = new System.Collections.Generic.List();
12 |
13 |
14 | Vector3 GetPointOnShape(int cx, int cy)
15 | {
16 | Platform.Vector3 hitPoint = null;
17 | Renderer rv = GetRenderer();
18 |
19 | PickHelper pickHelper = new PickHelper();
20 | pickHelper.Initialize(rv);
21 |
22 | if (pickHelper.Pick(cx, cy))
23 | {
24 | hitPoint = pickHelper.GetPointOnShape();
25 | }
26 |
27 | return hitPoint;
28 | }
29 |
30 | public override void OnStartEvent()
31 | {
32 | }
33 |
34 | public override void OnExitEvent()
35 | {
36 | this.RemoveAllTempNodes();
37 | }
38 |
39 | public override void OnButtonDownEvent(InputEvent evt)
40 | {
41 | if (evt.IsRButtonDown())
42 | {
43 | this.Exit(1);
44 | return;
45 | }
46 |
47 | Vector3 pt = GetPointOnShape((int)evt.GetMousePosition().X, (int)evt.GetMousePosition().Y);
48 | if (pt == null)
49 | return;
50 |
51 | m_Points.Add(pt);
52 |
53 | if (m_Points.Count > 1)
54 | {
55 | TopoShape spline = GlobalInstance.BrepTools.MakeSpline(m_Points);
56 | if (spline != null)
57 | {
58 | SceneNode node = GlobalInstance.TopoShapeConvert.ToEdgeNode(spline, 0.0f);
59 |
60 | this.RemoveAllTempNodes();
61 | this.ShowTempNode(node);
62 | GetRenderer().RequestDraw(1);
63 | }
64 | }
65 | }
66 |
67 | public override void OnButtonUpEvent(InputEvent evt)
68 | {
69 |
70 | }
71 |
72 | public override void OnMouseMoveEvent(InputEvent evt)
73 | {
74 |
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/DrawLineEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using AnyCAD.Platform;
6 |
7 | namespace AnyCAD.Basic
8 | {
9 | class DrawLineEditor : AnyCAD.Platform.CustomEditor
10 | {
11 | private Vector3 m_StartPos = new Vector3();
12 | private int m_Step = 0;
13 | LineNode tempLineNode = new LineNode();
14 |
15 | enum EditStep
16 | {
17 | ES_Init,
18 | ES_Drawing,
19 | ES_Finish,
20 | };
21 |
22 | public override void OnStartEvent()
23 | {
24 | LineStyle lineStyle = new LineStyle();
25 | lineStyle.SetPatternStyle((int)EnumLinePattern.LP_DashedLine);
26 | lineStyle.SetColor(100, 0, 100);
27 |
28 | tempLineNode.SetLineStyle(lineStyle);
29 |
30 | this.ShowTempNode(tempLineNode);
31 | GetRenderer().RequestDraw(1);
32 | }
33 |
34 | public override void OnExitEvent()
35 | {
36 | this.RemoveAllTempNodes();
37 | }
38 |
39 | public override void OnButtonDownEvent(InputEvent evt)
40 | {
41 | Renderer renderer = GetRenderer();
42 | m_Step += 1;
43 | if (m_Step == (int)EditStep.ES_Finish)
44 | {
45 | m_Step = (int)EditStep.ES_Init;
46 |
47 | LineNode lineNode = new LineNode();
48 | lineNode.Set(m_StartPos, ToWorldPoint(evt.GetMousePosition()));
49 |
50 | renderer.GetSceneManager().AddNode(lineNode);
51 | tempLineNode.SetVisible(false);
52 |
53 | renderer.RequestDraw(1);
54 | return;
55 | }
56 |
57 | if (evt.IsLButtonDown())
58 | {
59 | m_StartPos = ToWorldPoint(evt.GetMousePosition());
60 | tempLineNode.SetVisible(true);
61 | renderer.RequestDraw(1);
62 | }
63 | }
64 |
65 | public override void OnButtonUpEvent(InputEvent evt)
66 | {
67 |
68 | }
69 |
70 | public override void OnMouseMoveEvent(InputEvent evt)
71 | {
72 | if (m_Step == (int)EditStep.ES_Drawing)
73 | {
74 | Renderer renderer = GetRenderer();
75 | tempLineNode.Set(m_StartPos, ToWorldPoint(evt.GetMousePosition()));
76 | renderer.RequestDraw(1);
77 | }
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/FormMain.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
124 | True
125 |
126 |
127 | True
128 |
129 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/LoadDxfContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using AnyCAD.Platform;
6 |
7 | namespace AnyCAD.Basic
8 | {
9 | public class LoadDxfContext : AnyCAD.Platform.TopoShapeReaderContext
10 | {
11 | public TopoShapeGroup ShapeGroup = new TopoShapeGroup();
12 |
13 | public LoadDxfContext()
14 | {
15 | }
16 |
17 | public override void OnBeginGroup(String name)
18 | {
19 | }
20 |
21 | public override void OnEndGroup()
22 | {
23 |
24 | }
25 |
26 | public override bool OnBeiginComplexShape(TopoShape shape)
27 | {
28 | ShapeGroup.Add(shape);
29 | return false;
30 | }
31 |
32 | public override void OnEndComplexShape()
33 | {
34 |
35 | }
36 |
37 | public override void OnFace(TopoShape shape)
38 | {
39 | ShapeGroup.Add(shape);
40 | }
41 |
42 | public override void OnWire(TopoShape shape)
43 | {
44 |
45 | ShapeGroup.Add(shape);
46 |
47 | }
48 |
49 | public override void OnEdge(TopoShape shape)
50 | {
51 | //ShapeGroup.Add(shape);
52 | //var newShape = GlobalInstance.BrepTools.ProjectOnPlane(shape, new Vector3(0, 0, 200), new Vector3(-1, 0, -1), Vector3.UNIT_Z);
53 |
54 | //shape = GlobalInstance.BrepTools.MakeLoft(shape, newShape, false);
55 | ShapeGroup.Add(shape);
56 | }
57 |
58 | public override void OnPoint(TopoShape shape)
59 | {
60 |
61 | }
62 |
63 |
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/MeasureDistanceEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using AnyCAD.Platform;
6 |
7 | namespace AnyCAD.Basic
8 | {
9 | class MeasureDistanceEditor : AnyCAD.Platform.CustomEditor
10 | {
11 | private int m_Step = 0;
12 | Vector3 m_Pt1 = null;
13 |
14 | enum EditStep
15 | {
16 | ES_Init,
17 | ES_Drawing,
18 | ES_Finish,
19 | };
20 |
21 | Vector3 GetSelectedShape(int cx, int cy)
22 | {
23 | Renderer rv = GetRenderer();
24 |
25 | PickHelper ph = new PickHelper();
26 | ph.Initialize(rv);
27 | if (!ph.Pick(cx, cy))
28 | return null;
29 |
30 | return ph.GetPointOnShape();
31 | }
32 |
33 | public override void OnStartEvent()
34 | {
35 | }
36 |
37 | public override void OnExitEvent()
38 | {
39 |
40 | }
41 |
42 | public override void OnButtonDownEvent(InputEvent evt)
43 | {
44 | Vector3 pt = GetSelectedShape((int)evt.GetMousePosition().X, (int)evt.GetMousePosition().Y);
45 | if (pt == null)
46 | return;
47 |
48 | Renderer renderer = GetRenderer();
49 | m_Step += 1;
50 | if (m_Step == (int)EditStep.ES_Finish)
51 | {
52 | m_Step = (int)EditStep.ES_Init;
53 |
54 | LineNode lineNode = new LineNode();
55 | lineNode.SetShowText(true);
56 | lineNode.Set(m_Pt1, pt);
57 |
58 | renderer.GetSceneManager().AddNode(lineNode);
59 | renderer.RequestDraw(1);
60 | return;
61 | }
62 |
63 | if (evt.IsLButtonDown())
64 | {
65 |
66 | m_Pt1 = pt;
67 | }
68 | }
69 |
70 | public override void OnButtonUpEvent(InputEvent evt)
71 | {
72 | }
73 |
74 | public override void OnMouseMoveEvent(InputEvent evt)
75 | {
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/MoveNodeEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using AnyCAD.Platform;
6 |
7 | namespace AnyCAD.Basic
8 | {
9 | class MoveNodeEditor : AnyCAD.Platform.CustomEditor
10 | {
11 | private Vector3 m_StartPos = new Vector3();
12 | private EditStep m_Step = 0;
13 | private SceneNode m_TargetNode = null;
14 | private Matrix4 m_InitTrf = null;
15 |
16 | enum EditStep
17 | {
18 | ES_PickNode,
19 | ES_BeginMove,
20 | };
21 |
22 | public override void OnStartEvent()
23 | {
24 |
25 | }
26 |
27 | public override void OnExitEvent()
28 | {
29 |
30 | }
31 |
32 | public override void OnButtonDownEvent(InputEvent evt)
33 | {
34 | Renderer renderer = GetRenderer();
35 | if (m_Step == EditStep.ES_PickNode)
36 | {
37 | if (renderer.Select(true) > 0)
38 | {
39 | SelectedShapeQuery query = new SelectedShapeQuery();
40 | renderer.QuerySelection(query);
41 | m_TargetNode = query.GetRootNode();
42 | if (m_TargetNode != null)
43 | {
44 | m_Step = EditStep.ES_BeginMove;
45 | m_InitTrf = m_TargetNode.GetTransform();
46 | }
47 | }
48 | }
49 | else
50 | {
51 | m_StartPos = ToWorldPoint(evt.GetMousePosition());
52 | }
53 | }
54 |
55 | public override void OnButtonUpEvent(InputEvent evt)
56 | {
57 | m_Step = EditStep.ES_PickNode;
58 | GetRenderer().ClearSelection();
59 | GetRenderer().RequestDraw(1);
60 | }
61 |
62 | public override void OnMouseMoveEvent(InputEvent evt)
63 | {
64 | if (m_Step == EditStep.ES_PickNode)
65 | {
66 | Vector2 pt = evt.GetMousePosition();
67 | GetRenderer().Highlight((int)pt.X, (int)pt.Y);
68 | }
69 | else
70 | {
71 | Vector3 endPt = ToWorldPoint(evt.GetMousePosition());
72 | Matrix4 trf = GlobalInstance.MatrixBuilder.MakeTranslate(endPt - m_StartPos);
73 | m_TargetNode.SetTransform(GlobalInstance.MatrixBuilder.Multiply(m_InitTrf, trf));
74 |
75 | GetRenderer().RequestDraw(1);
76 | }
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace AnyCAD.Basic
7 | {
8 | static class Program
9 | {
10 | ///
11 | /// The main entry point for the application.
12 | ///
13 | [STAThread]
14 | static void Main()
15 | {
16 | Application.EnableVisualStyles();
17 | Application.SetCompatibleTextRenderingDefault(false);
18 | AnyCAD.Platform.GlobalInstance.Application.SetLogFileName(new AnyCAD.Platform.Path("anycad.net.sdk.log"));
19 | Application.Run(new FormMain());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("AnyCAD.Basic")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("AnyCAD.Basic")]
13 | [assembly: AssemblyCopyright("Copyright © 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("8bb786bf-323f-4499-91a6-c4abef273bc9")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
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 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace AnyCAD.Basic.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
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 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AnyCAD.Basic.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
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 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace AnyCAD.Basic.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/QueryShapeInfoEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using AnyCAD.Platform;
6 |
7 | namespace AnyCAD.Basic
8 | {
9 | class QueryShapeInfoEditor : AnyCAD.Platform.CustomEditor
10 | {
11 | public override void OnStartEvent()
12 | {
13 | }
14 |
15 | public override void OnExitEvent()
16 | {
17 | this.RemoveAllTempNodes();
18 | }
19 |
20 | public override void OnButtonDownEvent(InputEvent evt)
21 | {
22 |
23 | if (evt.IsRButtonDown())
24 | {
25 | this.Exit(1);
26 | return;
27 | }
28 | this.RemoveAllTempNodes();
29 |
30 | Renderer rv = GetRenderer();
31 |
32 | PickHelper pickHelper = new PickHelper();
33 | pickHelper.Initialize(rv);
34 |
35 | if (!pickHelper.Pick(evt.GetMousePosition()))
36 | return;
37 |
38 |
39 | TopoShape shape = pickHelper.GetGeometry();
40 | GeomSurface surface = new GeomSurface();
41 | if (!surface.Initialize(shape))
42 | return;
43 |
44 | IntersectionLineSurface intersector = new IntersectionLineSurface();
45 | intersector.SetSurface(shape);
46 | if (!intersector.Perform(rv.ComputeScreenRay(evt.GetMousePosition())))
47 | {
48 | return;
49 | }
50 |
51 | int nCount = intersector.GetPointCount();
52 | if(nCount < 1)
53 | return;
54 |
55 | double u = intersector.GetParameterU(1);
56 | double v = intersector.GetParameterV(1);
57 |
58 | Vector3 pt = surface.Value(u, v);
59 | Vector3 normal = surface.GetNormal(u, v);
60 |
61 | LineNode lineNode = new LineNode();
62 | lineNode.Set(pt, pt + normal);
63 |
64 | this.ShowTempNode(lineNode);
65 | rv.RequestDraw(1);
66 | }
67 |
68 | public override void OnButtonUpEvent(InputEvent evt)
69 | {
70 |
71 | }
72 |
73 | public override void OnMouseMoveEvent(InputEvent evt)
74 | {
75 |
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/ReadShapeContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using AnyCAD.Platform;
6 |
7 | namespace AnyCAD.Basic
8 | {
9 | public class ReadShapeContext : AnyCAD.Platform.TopoShapeReaderContext
10 | {
11 | private int nShapeCount = 100;
12 |
13 | AnyCAD.Platform.SceneManager sceneManager = null;
14 |
15 | public ReadShapeContext(AnyCAD.Platform.SceneManager sm)
16 | {
17 | sceneManager = sm;
18 | }
19 |
20 | private void ShowGeometry(TopoShape topoShape)
21 | {
22 | AnyCAD.Platform.SceneNode faceNode = AnyCAD.Platform.GlobalInstance.TopoShapeConvert.ToEntityNode(topoShape, 0.5f);
23 | faceNode.SetId(++nShapeCount);
24 | sceneManager.AddNode(faceNode);
25 | }
26 |
27 | public override void OnBeginGroup(String name)
28 | {
29 | }
30 |
31 | public override void OnEndGroup()
32 | {
33 |
34 | }
35 |
36 | public override void OnCompound(TopoShape shape)
37 | {
38 |
39 | }
40 |
41 | public override void OnSolid(TopoShape shape)
42 | {
43 |
44 | }
45 |
46 | public override void OnShell(TopoShape shape)
47 | {
48 |
49 | }
50 |
51 | public override void OnFace(TopoShape shape)
52 | {
53 |
54 | }
55 |
56 | public override void OnWire(TopoShape shape)
57 | {
58 | ShowGeometry(shape);
59 | }
60 |
61 | public override void OnEdge(TopoShape shape)
62 | {
63 | ShowGeometry(shape);
64 | }
65 |
66 | public override void OnPoint(TopoShape shape)
67 | {
68 |
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/AnyCAD.Basic/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/AnyCAD.Designer/AnyCAD.Designer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x86
7 | 8.0.30703
8 | 2.0
9 | {086D95F6-FA7A-416A-8883-E7BADF9A40F4}
10 | WinExe
11 | Properties
12 | AnyCAD.Designer
13 | AnyCAD.Designer
14 | v4.0
15 | Client
16 | 512
17 |
18 |
19 |
20 |
21 | x86
22 | true
23 | full
24 | false
25 | ..\bin\x86\Debug\
26 | DEBUG;TRACE
27 | prompt
28 | 4
29 |
30 |
31 | x86
32 | pdbonly
33 | true
34 | ..\bin\x86\Release\
35 | TRACE
36 | prompt
37 | 4
38 |
39 |
40 | true
41 | ..\bin\x64\Debug\
42 | DEBUG;TRACE
43 | full
44 | x64
45 | bin\Debug\AnyCAD.Designer.exe.CodeAnalysisLog.xml
46 | true
47 | GlobalSuppressions.cs
48 | prompt
49 | MinimumRecommendedRules.ruleset
50 | ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
51 | ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
52 |
53 |
54 | ..\bin\x64\Release\
55 | TRACE
56 | true
57 | pdbonly
58 | x64
59 | bin\Release\AnyCAD.Designer.exe.CodeAnalysisLog.xml
60 | true
61 | GlobalSuppressions.cs
62 | prompt
63 | MinimumRecommendedRules.ruleset
64 | ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
65 | true
66 | ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
67 | true
68 | false
69 |
70 |
71 |
72 | ..\packages\AnyCAD.Net.Pro.2020.0.1\lib\x64\AnyCAD.Exchange.Net.dll
73 |
74 |
75 | ..\packages\AnyCAD.Net.Pro.2020.0.1\lib\x64\AnyCAD.Foundation.Net.dll
76 |
77 |
78 | ..\packages\AnyCAD.Net.Pro.2020.0.1\lib\x64\AnyCAD.Presentation.Net.dll
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | Form
95 |
96 |
97 | MainForm.cs
98 |
99 |
100 |
101 |
102 |
103 | MainForm.cs
104 |
105 |
106 | ResXFileCodeGenerator
107 | Resources.Designer.cs
108 | Designer
109 |
110 |
111 | True
112 | Resources.resx
113 |
114 |
115 |
116 | SettingsSingleFileGenerator
117 | Settings.Designer.cs
118 |
119 |
120 | True
121 | Settings.settings
122 | True
123 |
124 |
125 |
126 |
127 |
128 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
129 |
130 |
131 |
132 |
139 |
--------------------------------------------------------------------------------
/AnyCAD.Designer/DrawLineEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using AnyCAD.Platform;
6 |
7 | namespace AnyCAD.Designer
8 | {
9 | class EditStep
10 | {
11 | public const int ES_Init = 0;
12 | public const int ES_Drawing = 1;
13 | public const int ES_Finish = 2;
14 | };
15 |
16 | delegate void AddLineEvent(Vector3 startPt, Vector3 endPt);
17 |
18 | class DrawLineEditor : AnyCAD.Platform.CustomEditor
19 | {
20 | Vector3 m_StartPos = new Vector3();
21 | LineNode tempLineNode = new LineNode();
22 |
23 | int m_Step = EditStep.ES_Init;
24 | AddLineEvent OnAddLineEvent;
25 |
26 | public DrawLineEditor(AddLineEvent callback)
27 | {
28 | SetId("AD::DrawLine");
29 | OnAddLineEvent = callback;
30 |
31 | LineStyle lineStyle = new LineStyle();
32 | lineStyle.SetPatternStyle((int)EnumLinePattern.LP_DashedLine);
33 | lineStyle.SetColor(255, 0, 100);
34 | lineStyle.SetLineWidth(2);
35 |
36 | tempLineNode.SetLineStyle(lineStyle);
37 | }
38 |
39 | public override void OnStartEvent()
40 | {
41 | m_Step = EditStep.ES_Init;
42 |
43 | this.ShowTempNode(tempLineNode);
44 | GetRenderer().RequestDraw(1);
45 | }
46 |
47 | public override void OnExitEvent()
48 | {
49 | this.RemoveAllTempNodes();
50 | }
51 |
52 | public override void OnButtonDownEvent(InputEvent evt)
53 | {
54 | Renderer renderer = GetRenderer();
55 | m_Step += 1;
56 | if (m_Step == EditStep.ES_Finish)
57 | {
58 | LineNode lineNode = new LineNode();
59 |
60 | // Screen position to world position
61 | Vector3 endPos = ToWorldPoint(evt.GetMousePosition());
62 | if (OnAddLineEvent != null)
63 | {
64 | OnAddLineEvent(m_StartPos, endPos);
65 | }
66 |
67 | // Start the next line
68 | m_Step = EditStep.ES_Drawing;
69 | m_StartPos = endPos;
70 | lineNode.Set(m_StartPos, endPos);
71 |
72 | renderer.RequestDraw(1);
73 | return;
74 | }
75 |
76 | if (evt.IsLButtonDown())
77 | {
78 | m_StartPos = ToWorldPoint(evt.GetMousePosition());
79 | tempLineNode.SetVisible(true);
80 | renderer.RequestDraw(1);
81 | }
82 | }
83 |
84 | public override void OnButtonUpEvent(InputEvent evt)
85 | {
86 |
87 | }
88 |
89 | public override void OnMouseMoveEvent(InputEvent evt)
90 | {
91 | if (m_Step == (int)EditStep.ES_Drawing)
92 | {
93 | Renderer renderer = GetRenderer();
94 | tempLineNode.Set(m_StartPos, ToWorldPoint(evt.GetMousePosition()));
95 | renderer.RequestDraw(1);
96 | }
97 | }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/AnyCAD.Designer/MainForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 |
10 | using AnyCAD.Platform;
11 |
12 | namespace AnyCAD.Designer
13 | {
14 | public partial class MainForm : Form
15 | {
16 | private AnyCAD.Presentation.RenderWindow3d renderView;
17 |
18 | private int ShapeId = 100;
19 | private DrawLineEditor mDrawLineEditor = null;
20 |
21 | private LineStyle mDefaultLineStyle;
22 |
23 | public MainForm()
24 | {
25 | InitializeComponent();
26 |
27 | this.renderView = new AnyCAD.Presentation.RenderWindow3d();
28 |
29 | System.Drawing.Size size = this.panel1.ClientSize;
30 | this.renderView.Size = size;
31 |
32 | this.renderView.TabIndex = 1;
33 | this.panel1.Controls.Add(this.renderView);
34 |
35 | GlobalInstance.EventListener.OnChangeCursorEvent += OnChangeCursor;
36 | GlobalInstance.EventListener.OnSelectElementEvent += OnSelectElement;
37 |
38 | }
39 |
40 | private void MainForm_Load(object sender, EventArgs e)
41 | {
42 | mDefaultLineStyle = new LineStyle();
43 | mDefaultLineStyle.SetColor(255, 0, 0);
44 | mDefaultLineStyle.SetLineWidth(2);
45 |
46 | renderView.ExecuteCommand("PickClearMode", "Single");
47 | }
48 |
49 | private void OnSelectElement(SelectionChangeArgs args)
50 | {
51 | if (!args.IsHighlightMode())
52 | {
53 | SelectedShapeQuery query = new SelectedShapeQuery();
54 | renderView.QuerySelection(query);
55 | var ids = query.GetIds();
56 | if(ids.Length > 0)
57 | {
58 | var shape = query.GetGeometry();
59 |
60 | if (shape != null)
61 | {
62 | GeomCurve curve = new GeomCurve();
63 | if (curve.Initialize(shape))
64 | {
65 | TopoShapeProperty property = new TopoShapeProperty();
66 | property.SetShape(shape);
67 | var str = String.Format("Length:{0}", property.EdgeLength());
68 | toolStripStatusLabel2.Text = str;
69 |
70 | return;
71 | }
72 | }
73 | }
74 | else
75 | {
76 | toolStripStatusLabel2.Text = "";
77 | }
78 | }
79 | }
80 |
81 | private void OnChangeCursor(String commandId, String cursorHint)
82 | {
83 |
84 | if (cursorHint == "Pan")
85 | {
86 | this.renderView.Cursor = System.Windows.Forms.Cursors.SizeAll;
87 | }
88 | else if (cursorHint == "Orbit")
89 | {
90 | this.renderView.Cursor = System.Windows.Forms.Cursors.Hand;
91 | }
92 | else if (cursorHint == "Cross")
93 | {
94 | this.renderView.Cursor = System.Windows.Forms.Cursors.Cross;
95 | }
96 | else
97 | {
98 | if (commandId == "Pick")
99 | {
100 | this.renderView.Cursor = System.Windows.Forms.Cursors.Arrow;
101 | }
102 | else
103 | {
104 | this.renderView.Cursor = System.Windows.Forms.Cursors.Default;
105 | }
106 | }
107 |
108 | }
109 |
110 | private void MainForm_SizeChanged(object sender, EventArgs e)
111 | {
112 | if (renderView != null)
113 | {
114 |
115 | System.Drawing.Size size = this.panel1.ClientSize;
116 | renderView.Size = size;
117 | }
118 | }
119 |
120 |
121 | private void OnAddLine(Vector3 startPt, Vector3 endPt)
122 | {
123 | var shape = GlobalInstance.BrepTools.MakeLine(startPt, endPt);
124 | if (shape == null)
125 | return;
126 |
127 | var node = renderView.ShowGeometry(shape, ++ShapeId);
128 | node.SetLineStyle(mDefaultLineStyle);
129 |
130 | }
131 | private void lineToolStripMenuItem_Click(object sender, EventArgs e)
132 | {
133 | if(mDrawLineEditor == null)
134 | mDrawLineEditor = new DrawLineEditor(OnAddLine);
135 | renderView.ActiveEditor(mDrawLineEditor);
136 | toolStripStatusLabel2.Text = "Draw Line";
137 | }
138 |
139 | private void pickToolStripMenuItem_Click(object sender, EventArgs e)
140 | {
141 | renderView.ExecuteCommand("Pick", "");
142 | }
143 |
144 | private void dToolStripMenuItem_Click(object sender, EventArgs e)
145 | {
146 | //renderView.ShowCoordinateAxis(false);
147 | //renderView.ShowWorkingGrid(false);
148 |
149 | //ColorValue clr = new ColorValue(33f / 255f, 40f / 255f, 48f / 255f, 1);
150 | //renderView.SetBackgroundColor(clr, clr, clr);
151 |
152 | Renderer renderer = renderView.Renderer;
153 |
154 | //// Customize the Axis
155 | //ScreenWidget coodinateNode = new ScreenWidget();
156 | //AxesWidget axesNode = new AxesWidget();
157 | //axesNode.SetArrowText((int)EnumAxesDirection.Axes_Z, "");
158 | //coodinateNode.SetNode(axesNode);
159 | //coodinateNode.SetWidgetPosition(2);
160 | //renderer.SetCoordinateWidget(coodinateNode);
161 |
162 | // Set the fixed Top View
163 | renderer.SetStandardView(EnumStandardView.SV_Top);
164 | renderer.SetViewType(EnumStandardView.SV_Top);
165 | }
166 |
167 | void UpdateView()
168 | {
169 | this.renderView.RequestDraw();
170 | }
171 |
172 | TubeSystem tubeSystem = null;
173 | private void tubeToolStripMenuItem_Click(object sender, EventArgs e)
174 | {
175 | if (tubeSystem == null)
176 | {
177 | tubeSystem = new TubeSystem();
178 | tubeSystem.Init(this.renderView);
179 |
180 | renderView.RenderTick += new Presentation.RenderEventHandler(tubeSystem.OnTimer);
181 | tubeSystem.OnUpdate += UpdateView;
182 | }
183 | }
184 |
185 | private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
186 | {
187 |
188 | }
189 |
190 | private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
191 | {
192 | mDrawLineEditor = null;
193 | }
194 | }
195 | }
196 |
--------------------------------------------------------------------------------
/AnyCAD.Designer/MainForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
124 | 137, 17
125 |
126 |
--------------------------------------------------------------------------------
/AnyCAD.Designer/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace AnyCAD.Designer
7 | {
8 | static class Program
9 | {
10 | ///
11 | /// 应用程序的主入口点。
12 | ///
13 | [STAThread]
14 | static void Main()
15 | {
16 | Application.EnableVisualStyles();
17 | Application.SetCompatibleTextRenderingDefault(false);
18 | Application.Run(new MainForm());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/AnyCAD.Designer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的常规信息通过以下
6 | // 特性集控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("AnyCAD.Designer")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("AnyCAD.Designer")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 使此程序集中的类型
18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
19 | // 则将该类型上的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("7f49315e-0d9c-46ab-bea6-1f089623a708")]
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")]
37 |
--------------------------------------------------------------------------------
/AnyCAD.Designer/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace AnyCAD.Designer.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 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 | ///
38 | /// 返回此类使用的、缓存的 ResourceManager 实例。
39 | ///
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("AnyCAD.Designer.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 为所有资源查找重写当前线程的 CurrentUICulture 属性,
56 | /// 方法是使用此强类型资源类。
57 | ///
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 | }
72 |
--------------------------------------------------------------------------------
/AnyCAD.Designer/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/AnyCAD.Designer/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
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 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace AnyCAD.Designer.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.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 | }
31 |
--------------------------------------------------------------------------------
/AnyCAD.Designer/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/AnyCAD.Designer/TubeSystem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using AnyCAD.Platform;
6 | using AnyCAD.Presentation;
7 |
8 | namespace AnyCAD.Designer
9 | {
10 |
11 | class PartElement
12 | {
13 | public ElementId Id;
14 | public TopoShape Shape = null;
15 | public SceneNode Node = null;
16 | }
17 |
18 | class BoltElement : PartElement
19 | {
20 |
21 | public double Length = 100;
22 | public double Diameter = 10;
23 | public double Thickness = 2;
24 |
25 |
26 |
27 | public BoltElement(int id)
28 | {
29 | Id = new ElementId(id);
30 | }
31 |
32 | public void UpdateShape()
33 | {
34 | double radius = Diameter * 0.5;
35 | if (Thickness >= radius)
36 | throw new Exception("INVALID PARAMETERS!");
37 |
38 | Shape = GlobalInstance.BrepTools.MakeTube(Vector3.ZERO, Vector3.UNIT_Z, radius - Thickness, Thickness, Length);
39 |
40 |
41 | }
42 | }
43 |
44 | class NutElement: PartElement
45 | {
46 | public double Length = 100;
47 | public double Diameter = 14;
48 | public double Thickness = 2;
49 |
50 | public NutElement(int id)
51 | {
52 | Id = new ElementId(id);
53 | }
54 |
55 | public void UpdateShape()
56 | {
57 | double radius = Diameter * 0.5;
58 | if (Thickness >= radius)
59 | throw new Exception("INVALID PARAMETERS!");
60 |
61 | double radiusIn = radius - Thickness;
62 | //var bottom = GlobalInstance.BrepTools.MakeCylinder(Vector3.ZERO, Vector3.UNIT_Z, radius, Thickness, 0);
63 | //var tube = GlobalInstance.BrepTools.MakeTube(new Vector3(0, 0, Thickness), Vector3.UNIT_Z, radiusIn, Thickness, Length);
64 |
65 | //Shape = GlobalInstance.BrepTools.BooleanAdd(tube, bottom);
66 | List points = new List();
67 | points.Add(Vector3.ZERO);
68 | points.Add(new Vector3(radius,0,0));
69 | points.Add(new Vector3(radius, 0, Length));
70 | points.Add(new Vector3(radiusIn, 0, Length));
71 | points.Add(new Vector3(radiusIn, 0, Thickness));
72 | points.Add(new Vector3(0, 0, Thickness));
73 |
74 | var sketch = GlobalInstance.BrepTools.MakePolygon(points);
75 | Shape = GlobalInstance.BrepTools.Revol(sketch, Vector3.ZERO, Vector3.UNIT_Z, 360);
76 | }
77 | }
78 |
79 |
80 |
81 | class TubeSystem
82 | {
83 | public BoltElement Bolt;
84 | public NutElement Nut;
85 |
86 | public double Deep = 0;
87 | public double Step = 1;
88 |
89 | FaceStyle RedStyle;
90 | FaceStyle BlueStyle;
91 |
92 | public delegate void UpdateViewEvent();
93 |
94 | public UpdateViewEvent OnUpdate;
95 |
96 | public TubeSystem()
97 | {
98 | Bolt = new BoltElement(100);
99 | Nut = new NutElement(101);
100 |
101 | RedStyle = new FaceStyle();
102 | RedStyle.SetColor(255, 100, 100);
103 |
104 | BlueStyle = new FaceStyle();
105 | BlueStyle.SetColor(100, 100, 255);
106 | }
107 |
108 | public void Init(RenderWindow3d renderView)
109 | {
110 | // TODO: change parameters
111 | Bolt.UpdateShape();
112 | Nut.UpdateShape();
113 |
114 | Bolt.Node = renderView.ShowGeometry(Bolt.Shape, Bolt.Id);
115 |
116 | Bolt.Node.SetFaceStyle(RedStyle);
117 |
118 |
119 | Nut.Node = renderView.ShowGeometry(Nut.Shape, Nut.Id);
120 | FaceStyle faceStyle = new FaceStyle();
121 | faceStyle.SetTransparecy(0.5f);
122 | faceStyle.SetTransparent(true);
123 | Nut.Node.SetFaceStyle(faceStyle);
124 | }
125 |
126 | public void Connect(double deep)
127 | {
128 | //move Nut
129 | var trf = GlobalInstance.MatrixBuilder.MakeTranslate(0, 0, deep);
130 | Bolt.Node.SetTransform(trf);
131 |
132 | if (deep > 50)
133 | Bolt.Node.SetFaceStyle(BlueStyle);
134 | else
135 | Bolt.Node.SetFaceStyle(RedStyle);
136 | }
137 |
138 | public void OnTimer()
139 | {
140 | Deep += Step;
141 | if (Deep >= 100)
142 | {
143 | Deep = 100;
144 | Step = -1;
145 | }
146 | else if (Deep <= 2)
147 | {
148 | Step = 1;
149 | Deep = 2;
150 | }
151 |
152 | Connect(Deep);
153 |
154 | if (OnUpdate!=null)
155 | OnUpdate();
156 | }
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/AnyCAD.Designer/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/AnyCAD.Net.SDK.Sample.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30114.105
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnyCAD.Basic", "AnyCAD.Basic\AnyCAD.Basic.csproj", "{89766480-D042-4E86-B67B-5BB22C6B8F21}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnyCAD.WPF", "AnyCAD.WPF\AnyCAD.WPF.csproj", "{D455BA05-04B3-44CC-BA94-4F88C1257F55}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|x64 = Debug|x64
13 | Release|x64 = Release|x64
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {89766480-D042-4E86-B67B-5BB22C6B8F21}.Debug|x64.ActiveCfg = Debug|x64
17 | {89766480-D042-4E86-B67B-5BB22C6B8F21}.Debug|x64.Build.0 = Debug|x64
18 | {89766480-D042-4E86-B67B-5BB22C6B8F21}.Release|x64.ActiveCfg = Release|x64
19 | {89766480-D042-4E86-B67B-5BB22C6B8F21}.Release|x64.Build.0 = Release|x64
20 | {D455BA05-04B3-44CC-BA94-4F88C1257F55}.Debug|x64.ActiveCfg = Debug|x64
21 | {D455BA05-04B3-44CC-BA94-4F88C1257F55}.Debug|x64.Build.0 = Debug|x64
22 | {D455BA05-04B3-44CC-BA94-4F88C1257F55}.Release|x64.ActiveCfg = Release|x64
23 | {D455BA05-04B3-44CC-BA94-4F88C1257F55}.Release|x64.Build.0 = Release|x64
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {D915594E-B650-4722-AC1D-DFA2F83FE2FF}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/AnyCAD.WPF/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/AnyCAD.WPF/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace AnyCAD.WPF
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/AnyCAD.WPF/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/AnyCAD.WPF/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace AnyCAD.WPF
16 | {
17 | ///
18 | /// Interaction logic for MainWindow.xaml
19 | ///
20 | public partial class MainWindow : Window
21 | {
22 | public MainWindow()
23 | {
24 | InitializeComponent();
25 | }
26 |
27 | private void Window_Loaded(object sender, RoutedEventArgs e)
28 | {
29 | // Create the interop host control.
30 | var host =
31 | new System.Windows.Forms.Integration.WindowsFormsHost();
32 |
33 | var renderView = new AnyCAD.Presentation.RenderWindow3d();
34 | host.Child = renderView;
35 |
36 | this.grid3d.Children.Add(host);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/AnyCAD.WPF/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("AnyCAD.WPF")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("Microsoft")]
14 | [assembly: AssemblyProduct("AnyCAD.WPF")]
15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2014")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/AnyCAD.WPF/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18444
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace AnyCAD.WPF.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
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 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
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("AnyCAD.WPF.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
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 | }
72 |
--------------------------------------------------------------------------------
/AnyCAD.WPF/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/AnyCAD.WPF/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18444
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace AnyCAD.WPF.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.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 | }
31 |
--------------------------------------------------------------------------------
/AnyCAD.WPF/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/AnyCAD.WPF/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/DxfViewer/DxfViewer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x86
7 | 8.0.30703
8 | 2.0
9 | {2EE728F9-DF2C-438B-A9A6-ADEF0B411CC1}
10 | WinExe
11 | Properties
12 | DxfViewer
13 | DxfViewer
14 | v4.0
15 | Client
16 | 512
17 |
18 |
19 |
20 |
21 | x86
22 | true
23 | full
24 | false
25 | ..\bin\x86\Debug\
26 | DEBUG;TRACE
27 | prompt
28 | 4
29 |
30 |
31 | x86
32 | pdbonly
33 | true
34 | ..\bin\x86\Release\
35 | TRACE
36 | prompt
37 | 4
38 |
39 |
40 | true
41 | ..\bin\x64\Debug\
42 | DEBUG;TRACE
43 | full
44 | x64
45 | ..\..\..\..\bin\Debug\DxfViewer.exe.CodeAnalysisLog.xml
46 | true
47 | GlobalSuppressions.cs
48 | prompt
49 | MinimumRecommendedRules.ruleset
50 | ;D:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
51 | false
52 | ;D:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
53 | false
54 | false
55 |
56 |
57 | ..\bin\x64\Release\
58 | TRACE
59 | true
60 | pdbonly
61 | x64
62 | ..\..\..\..\bin\Release\DxfViewer.exe.CodeAnalysisLog.xml
63 | true
64 | GlobalSuppressions.cs
65 | prompt
66 | MinimumRecommendedRules.ruleset
67 | ;D:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
68 | false
69 | ;D:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
70 | false
71 | false
72 |
73 |
74 |
75 | ..\packages\AnyCAD.Net.Pro.2020.0.1\lib\x64\AnyCAD.Exchange.Net.dll
76 |
77 |
78 | ..\packages\AnyCAD.Net.Pro.2020.0.1\lib\x64\AnyCAD.Foundation.Net.dll
79 |
80 |
81 | ..\packages\AnyCAD.Net.Pro.2020.0.1\lib\x64\AnyCAD.Presentation.Net.dll
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | Form
97 |
98 |
99 | MainForm.cs
100 |
101 |
102 |
103 |
104 | MainForm.cs
105 |
106 |
107 | ResXFileCodeGenerator
108 | Resources.Designer.cs
109 | Designer
110 |
111 |
112 | True
113 | Resources.resx
114 |
115 |
116 |
117 | SettingsSingleFileGenerator
118 | Settings.Designer.cs
119 |
120 |
121 | True
122 | Settings.settings
123 | True
124 |
125 |
126 |
127 |
128 |
129 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
130 |
131 |
132 |
133 |
140 |
--------------------------------------------------------------------------------
/DxfViewer/MainForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DxfViewer
2 | {
3 | partial class MainForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
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 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.menuStrip1 = new System.Windows.Forms.MenuStrip();
32 | this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
33 | this.imageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
34 | this.dToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
35 | this.dToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
36 | this.exportIgesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
37 | this.panel3d = new System.Windows.Forms.Panel();
38 | this.menuStrip1.SuspendLayout();
39 | this.SuspendLayout();
40 | //
41 | // menuStrip1
42 | //
43 | this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
44 | this.openToolStripMenuItem,
45 | this.imageToolStripMenuItem,
46 | this.dToolStripMenuItem1,
47 | this.dToolStripMenuItem,
48 | this.exportIgesToolStripMenuItem});
49 | this.menuStrip1.Location = new System.Drawing.Point(0, 0);
50 | this.menuStrip1.Name = "menuStrip1";
51 | this.menuStrip1.Size = new System.Drawing.Size(652, 25);
52 | this.menuStrip1.TabIndex = 0;
53 | this.menuStrip1.Text = "menuStrip1";
54 | //
55 | // openToolStripMenuItem
56 | //
57 | this.openToolStripMenuItem.Name = "openToolStripMenuItem";
58 | this.openToolStripMenuItem.Size = new System.Drawing.Size(52, 21);
59 | this.openToolStripMenuItem.Text = "Open";
60 | this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
61 | //
62 | // imageToolStripMenuItem
63 | //
64 | this.imageToolStripMenuItem.Name = "imageToolStripMenuItem";
65 | this.imageToolStripMenuItem.Size = new System.Drawing.Size(57, 21);
66 | this.imageToolStripMenuItem.Text = "Image";
67 | this.imageToolStripMenuItem.Click += new System.EventHandler(this.imageToolStripMenuItem_Click);
68 | //
69 | // dToolStripMenuItem1
70 | //
71 | this.dToolStripMenuItem1.Name = "dToolStripMenuItem1";
72 | this.dToolStripMenuItem1.Size = new System.Drawing.Size(36, 21);
73 | this.dToolStripMenuItem1.Text = "2D";
74 | this.dToolStripMenuItem1.Click += new System.EventHandler(this.dToolStripMenuItem1_Click);
75 | //
76 | // dToolStripMenuItem
77 | //
78 | this.dToolStripMenuItem.Name = "dToolStripMenuItem";
79 | this.dToolStripMenuItem.Size = new System.Drawing.Size(36, 21);
80 | this.dToolStripMenuItem.Text = "3D";
81 | this.dToolStripMenuItem.Click += new System.EventHandler(this.dToolStripMenuItem_Click);
82 | //
83 | // exportIgesToolStripMenuItem
84 | //
85 | this.exportIgesToolStripMenuItem.Name = "exportIgesToolStripMenuItem";
86 | this.exportIgesToolStripMenuItem.Size = new System.Drawing.Size(87, 21);
87 | this.exportIgesToolStripMenuItem.Text = "Export Iges";
88 | this.exportIgesToolStripMenuItem.Click += new System.EventHandler(this.exportIgesToolStripMenuItem_Click);
89 | //
90 | // panel3d
91 | //
92 | this.panel3d.Dock = System.Windows.Forms.DockStyle.Fill;
93 | this.panel3d.Location = new System.Drawing.Point(0, 25);
94 | this.panel3d.Name = "panel3d";
95 | this.panel3d.Size = new System.Drawing.Size(652, 486);
96 | this.panel3d.TabIndex = 1;
97 | //
98 | // MainForm
99 | //
100 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
101 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
102 | this.ClientSize = new System.Drawing.Size(652, 511);
103 | this.Controls.Add(this.panel3d);
104 | this.Controls.Add(this.menuStrip1);
105 | this.MainMenuStrip = this.menuStrip1;
106 | this.Name = "MainForm";
107 | this.Text = "dxfViewer - Powered by AnyCAD .Net Graphics Component";
108 | this.Load += new System.EventHandler(this.MainForm_Load);
109 | this.Resize += new System.EventHandler(this.MainForm_Resize);
110 | this.menuStrip1.ResumeLayout(false);
111 | this.menuStrip1.PerformLayout();
112 | this.ResumeLayout(false);
113 | this.PerformLayout();
114 |
115 | }
116 |
117 | #endregion
118 |
119 | private System.Windows.Forms.MenuStrip menuStrip1;
120 | private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
121 | private System.Windows.Forms.ToolStripMenuItem imageToolStripMenuItem;
122 | private System.Windows.Forms.ToolStripMenuItem dToolStripMenuItem;
123 | private System.Windows.Forms.ToolStripMenuItem exportIgesToolStripMenuItem;
124 | private System.Windows.Forms.Panel panel3d;
125 | private System.Windows.Forms.ToolStripMenuItem dToolStripMenuItem1;
126 | }
127 | }
128 |
129 |
--------------------------------------------------------------------------------
/DxfViewer/MainForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 | using AnyCAD.Platform;
10 |
11 | namespace DxfViewer
12 | {
13 | public partial class MainForm : Form
14 | {
15 | private AnyCAD.Presentation.RenderWindow3d renderView = null;
16 | private ElementId mBeginId = new ElementId();
17 | private ElementId mEndId = new ElementId();
18 |
19 | public MainForm()
20 | {
21 | InitializeComponent();
22 |
23 | this.renderView = new AnyCAD.Presentation.RenderWindow3d();
24 | this.renderView.Size = this.panel3d.ClientSize;
25 | this.renderView.TabIndex = 1;
26 | panel3d.Controls.Add(this.renderView);
27 | }
28 |
29 | private void MainForm_Load(object sender, EventArgs e)
30 | {
31 | renderView.ShowWorkingGrid(false);
32 | renderView.ExecuteCommand("ShadeWithEdgeMode");
33 | renderView.ShowCoordinateAxis(false);
34 |
35 | ColorValue clr = new ColorValue(33f / 255f, 40f / 255f, 48f / 255f, 1);
36 | renderView.SetBackgroundColor(clr, clr, clr);
37 |
38 | Renderer renderer = renderView.Renderer;
39 |
40 | // Customize the Axis
41 | ScreenWidget coodinateNode = new ScreenWidget();
42 | AxesWidget axesNode = new AxesWidget();
43 | axesNode.SetArrowText((int)EnumAxesDirection.Axes_Z, "");
44 | coodinateNode.SetNode(axesNode);
45 | coodinateNode.SetWidgetPosition(2);
46 | renderer.SetCoordinateWidget(coodinateNode);
47 |
48 | // Set the fixed Top View
49 | renderer.SetStandardView(EnumStandardView.SV_Top);
50 | renderer.SetViewType(EnumStandardView.SV_Top);
51 |
52 | this.renderView.RequestDraw();
53 |
54 | }
55 |
56 | private void MainForm_Resize(object sender, EventArgs e)
57 | {
58 | if (renderView != null)
59 | renderView.Size = this.panel3d.ClientSize;
60 | }
61 |
62 | private void openToolStripMenuItem_Click(object sender, EventArgs e)
63 | {
64 | OpenFileDialog dlg = new OpenFileDialog();
65 | dlg.Filter = "DXF (*.dxf)|*.dxf";
66 |
67 | if (DialogResult.OK == dlg.ShowDialog())
68 | {
69 | AnyCAD.Exchange.DxfReader reader = new AnyCAD.Exchange.DxfReader();
70 | renderView.ClearScene();
71 | AnyCAD.Exchange.ShowShapeReaderContext context = new AnyCAD.Exchange.ShowShapeReaderContext(renderView.SceneManager);
72 | context.NextShapeId = mBeginId;
73 | if (reader.Read(dlg.FileName, context, false))
74 | {
75 | renderView.RequestDraw();
76 | mEndId = context.NextShapeId;
77 | }
78 |
79 | }
80 |
81 | renderView.View3d.FitAll();
82 | }
83 |
84 | private void pDFToolStripMenuItem_Click(object sender, EventArgs e)
85 | {
86 | SaveFileDialog dlg = new SaveFileDialog();
87 | dlg.Filter = "PDF (*.pdf)|*.pdf";
88 | if (DialogResult.OK == dlg.ShowDialog())
89 | {
90 | renderView.Renderer.Print(dlg.FileName);
91 | }
92 |
93 | }
94 |
95 | private void imageToolStripMenuItem_Click(object sender, EventArgs e)
96 | {
97 | SaveFileDialog dlg = new SaveFileDialog();
98 | dlg.Filter = "Image File (*.jpg;*.png)|*.jpg;*.png";
99 | if (DialogResult.OK == dlg.ShowDialog())
100 | {
101 | renderView.CaptureImage(dlg.FileName);
102 | }
103 | }
104 |
105 | private void dToolStripMenuItem_Click(object sender, EventArgs e)
106 | {
107 | renderView.ExecuteCommand("IsoView");
108 | renderView.View3d.FitAll();
109 | }
110 |
111 | private void exportIgesToolStripMenuItem_Click(object sender, EventArgs e)
112 | {
113 | SceneManager sceneManager = renderView.SceneManager;
114 |
115 |
116 |
117 | TopoShapeGroup group = new TopoShapeGroup();
118 | for (ElementId ii = mBeginId; ii < mEndId; ++ii)
119 | {
120 | SceneNode node = sceneManager.FindNode(ii);
121 | if (node != null)
122 | {
123 | TopoShapeGroup shapeGroup = GlobalInstance.TopoShapeConvert.ToTopoShape(node);
124 | if (shapeGroup != null)
125 | {
126 | for (Int32 jj = 0, len = shapeGroup.Size(); jj < len; ++ii)
127 | {
128 | TopoShape shape = shapeGroup.GetTopoShape(jj);
129 | Matrix4 trf = GlobalInstance.MatrixBuilder.MakeRotation(90, Vector3.UNIT_X);
130 | shape = GlobalInstance.BrepTools.Transform(shape, trf);
131 | group.Add(shape);
132 | }
133 | }
134 | }
135 | }
136 |
137 | if (group.Size() > 0)
138 | {
139 | SaveFileDialog dlg = new SaveFileDialog();
140 | dlg.Filter = "IGES File (*.igs;*.iges)|*.igs;*.iges";
141 | if (DialogResult.OK != dlg.ShowDialog())
142 | {
143 | return;
144 | }
145 | TopoDataExchangeIges igsWriter = new TopoDataExchangeIges();
146 | igsWriter.Write(group, new AnyCAD.Platform.Path(dlg.FileName));
147 | }
148 | else
149 | {
150 | MessageBox.Show("No shape to save!");
151 | }
152 |
153 | }
154 |
155 | private void dToolStripMenuItem1_Click(object sender, EventArgs e)
156 | {
157 | renderView.ExecuteCommand("TopView");
158 | this.renderView.RequestDraw();
159 | }
160 |
161 | }
162 | }
163 |
--------------------------------------------------------------------------------
/DxfViewer/MainForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/DxfViewer/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace DxfViewer
7 | {
8 | static class Program
9 | {
10 | ///
11 | /// The main entry point for the application.
12 | ///
13 | [STAThread]
14 | static void Main()
15 | {
16 | Application.EnableVisualStyles();
17 | Application.SetCompatibleTextRenderingDefault(false);
18 | Application.Run(new MainForm());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/DxfViewer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("DxfViewer")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DxfViewer")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("f29caf80-d3d6-4190-9f17-d422ceb14b6f")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/DxfViewer/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34011
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DxfViewer.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
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 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
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("DxfViewer.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
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 | }
72 |
--------------------------------------------------------------------------------
/DxfViewer/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/DxfViewer/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34011
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DxfViewer.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.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 | }
31 |
--------------------------------------------------------------------------------
/DxfViewer/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/DxfViewer/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | anycad .net sdk
2 | ===============
3 | The graphics sdk for anycad graphics sdk for .net developers.
4 |
5 | ---
6 |
7 | Document:
8 |
9 | http://www.anycad.net/docs/getstarted.html
10 |
11 | API:
12 |
13 | http://anycad.net/api/chs2020/modules.html
14 |
15 | Weixin:
16 |
17 | 
--------------------------------------------------------------------------------
/StpViewer/CADBrower.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using AnyCAD.Platform;
6 | using AnyCAD.Presentation;
7 | using System.IO;
8 |
9 | namespace StpViewer
10 | {
11 | class CADBrower : AnyCAD.Platform.TopoShapeReaderContext
12 | {
13 |
14 | private System.Windows.Forms.TreeView treeView = null;
15 | private AnyCAD.Presentation.RenderWindow3d renderView = null;
16 | private Stack nodeStack = new Stack();
17 | private int nShapeCount = 100;
18 | private FaceStyle faceStyle;
19 | private FaceStyle revolutionStyle;
20 | private LineStyle holeStyle;
21 | private System.Collections.Generic.Dictionary faceStyleDict = new System.Collections.Generic.Dictionary();
22 | public CADBrower(System.Windows.Forms.TreeView _treeView, AnyCAD.Presentation.RenderWindow3d _renderView)
23 | {
24 | treeView = _treeView;
25 | renderView = _renderView;
26 | faceStyle = new FaceStyle();
27 | holeStyle = new LineStyle();
28 | holeStyle.SetLineWidth(3);
29 | holeStyle.SetColor(0, 256, 0);
30 |
31 | System.Windows.Forms.TreeNode node = treeView.Nodes.Add("AnyCAD.net");
32 | nodeStack.Push(node);
33 |
34 | revolutionStyle = new FaceStyle();
35 | revolutionStyle.SetColor(255, 0, 0);
36 | }
37 |
38 | ~CADBrower()
39 | {
40 | //fileSys.Close();
41 | }
42 | public override void OnSetFaceColor(ColorValue clr)
43 | {
44 | if (clr.ToRGBA() == faceStyle.GetColor().ToRGBA())
45 | return;
46 |
47 | FaceStyle fs = null;
48 | if (!faceStyleDict.TryGetValue(clr.ToRGBA(), out fs))
49 | {
50 | fs = new FaceStyle();
51 | fs.SetColor(clr);
52 | faceStyleDict.Add(clr.ToRGBA(), fs);
53 | }
54 | // fs.SetTransparecy(0.5f);
55 | //fs.SetTransparent(true);
56 | faceStyle = fs;
57 | }
58 |
59 |
60 | public override void OnBeginGroup(String name)
61 | {
62 | if (name.Length == 0)
63 | {
64 | name = "";
65 | }
66 |
67 | if (nodeStack.Count == 0)
68 | {
69 | System.Windows.Forms.TreeNode node = treeView.Nodes.Add(name);
70 | nodeStack.Push(node);
71 | }
72 | else
73 | {
74 | nodeStack.Push(nodeStack.Peek().Nodes.Add(name));
75 | }
76 | }
77 |
78 | public override void OnEndGroup()
79 | {
80 | nodeStack.Pop();
81 | }
82 |
83 | public override bool OnBeiginComplexShape(TopoShape shape)
84 | {
85 | ++nShapeCount;
86 | String type = "Shape";
87 | var st = shape.GetShapeType();
88 | if (st == EnumTopoShapeType.Topo_COMPOUND)
89 | {
90 | type = "Compound";
91 | }
92 | else if (st == EnumTopoShapeType.Topo_COMPSOLID)
93 | {
94 | type = "CompSolid";
95 | }
96 | else if (st == EnumTopoShapeType.Topo_SOLID)
97 | {
98 | type = "Solid";
99 | }
100 | else if (st == EnumTopoShapeType.Topo_SHELL)
101 | {
102 | type = "Shell";
103 | }
104 | nodeStack.Push(nodeStack.Peek().Nodes.Add(String.Format("{0}", nShapeCount), type));
105 | //SceneNode node = renderView.ShowGeometry(shape, nShapeCount);
106 | //node.SetFaceStyle(faceStyle);
107 | return true;
108 | }
109 |
110 | public override void OnEndComplexShape()
111 | {
112 | nodeStack.Pop();
113 | }
114 |
115 | public override void OnFace(TopoShape face)
116 | {
117 | ++nShapeCount;
118 | //nodeStack.Peek().Nodes.Add(String.Format("{0}", nShapeCount), String.Format("Face {0}", nShapeCount));
119 |
120 | SceneNode node = renderView.ShowGeometry(face, nShapeCount);
121 | node.SetFaceStyle(faceStyle);
122 |
123 | //GeomSurface gs = new GeomSurface();
124 | //gs.Initialize(face);
125 | //var st = gs.GetSurfaceType();
126 | //if (st == EnumSurfaceType.SurfaceType_SurfaceOfRevolution
127 | // || st == EnumSurfaceType.SurfaceType_Cylinder)
128 | //{
129 | // node.SetFaceStyle(revolutionStyle);
130 | //}
131 | ////if (gs.IsUClosed() || gs.IsVClosed())
132 | //{
133 |
134 | // //SceneNode node = renderView.ShowGeometry(face, nShapeCount);
135 | // //node.SetFaceStyle(faceStyle);
136 | // WireClassifier wc = new WireClassifier();
137 | // if (!wc.Initialize(face))
138 | // return;
139 |
140 | // var holes = wc.GetInnerWires();
141 | // for (int ii = 0, len = holes.Size(); ii < len; ++ii)
142 | // {
143 | // var holeEdge = holes.GetAt(ii);
144 | // ++nShapeCount;
145 | // var holeNode = renderView.ShowGeometry(holeEdge, nShapeCount);
146 | // holeNode.SetLineStyle(holeStyle);
147 | // }
148 | //}
149 |
150 |
151 |
152 |
153 |
154 | //var outer = wc.GetOuterWire();
155 | //TopoExplor te = new TopoExplor();
156 | //var edges = te.ExplorEdges(outer);
157 | //for (int ii = 0, len = edges.Size(); ii < len; ++ii)
158 | //{
159 | // var edge = edges.GetAt(ii);
160 | // GeomCurve curve = new GeomCurve();
161 | // curve.Initialize(edge);
162 | // if (curve.IsClosed())
163 | // {
164 | // var holeNode = renderView.ShowGeometry(edge, ++nShapeCount);
165 | // holeNode.SetLineStyle(holeStyle);
166 | // }
167 | //}
168 | }
169 | }
170 | }
171 |
--------------------------------------------------------------------------------
/StpViewer/MainForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 | using AnyCAD.Platform;
10 | namespace StpViewer
11 | {
12 | public partial class MainForm : Form
13 | {
14 | private AnyCAD.Presentation.RenderWindow3d renderView = null;
15 |
16 | public MainForm()
17 | {
18 | InitializeComponent();
19 |
20 | this.renderView = new AnyCAD.Presentation.RenderWindow3d();
21 | this.renderView.Location = new System.Drawing.Point(0, 0);
22 | this.renderView.Size = this.Size;
23 | this.renderView.TabIndex = 1;
24 | this.splitContainer1.Panel2.Controls.Add(this.renderView);
25 |
26 | GlobalInstance.EventListener.OnSelectElementEvent += OnSelectionChanged;
27 | }
28 |
29 | void OnSelectionChanged(SelectionChangeArgs args)
30 | {
31 |
32 | }
33 |
34 | private void MainForm_Resize(object sender, EventArgs e)
35 | {
36 | if (renderView != null)
37 | renderView.Size = this.splitContainer1.Panel2.Size;
38 | }
39 |
40 | private void MainForm_Load(object sender, EventArgs e)
41 | {
42 | renderView.ExecuteCommand("ShadeWithEdgeMode");
43 | renderView.ShowCoordinateAxis(true);
44 | //renderView.SetPickMode((int)EnumPickMode.RF_Edge);
45 | this.renderView.RequestDraw();
46 | }
47 |
48 | private void openToolStripMenuItem_Click(object sender, EventArgs e)
49 | {
50 | OpenFileDialog dlg = new OpenFileDialog();
51 | dlg.Filter = "STEP File(*.stp;*.step)|*.stp;*.step|All Files(*.*)|*.*";
52 |
53 | if (DialogResult.OK == dlg.ShowDialog())
54 | {
55 | this.treeViewStp.Nodes.Clear();
56 | this.renderView.ClearScene();
57 |
58 | CADBrower browser = new CADBrower(this.treeViewStp, this.renderView);
59 | AnyCAD.Exchange.StepReader reader = new AnyCAD.Exchange.StepReader();
60 | reader.Read(dlg.FileName, browser);
61 | }
62 |
63 | renderView.FitAll();
64 | }
65 |
66 | private void treeViewStp_AfterSelect(object sender, TreeViewEventArgs e)
67 | {
68 |
69 | }
70 |
71 | private void openIGESToolStripMenuItem_Click(object sender, EventArgs e)
72 | {
73 | OpenFileDialog dlg = new OpenFileDialog();
74 | dlg.Filter = "IGES File(*.iges;*.igs)|*.igs;*.igesp|All Files(*.*)|*.*";
75 |
76 | if (DialogResult.OK == dlg.ShowDialog())
77 | {
78 | this.treeViewStp.Nodes.Clear();
79 | this.renderView.ClearScene();
80 |
81 | CADBrower browser = new CADBrower(this.treeViewStp, this.renderView);
82 | AnyCAD.Exchange.IgesReader reader = new AnyCAD.Exchange.IgesReader();
83 | reader.Read(dlg.FileName, browser);
84 | }
85 |
86 | renderView.View3d.FitAll();
87 | }
88 |
89 | private void saveImageToolStripMenuItem_Click(object sender, EventArgs e)
90 | {
91 | SaveFileDialog dlg = new SaveFileDialog();
92 | dlg.Filter = "Image File(*.png;*.jpg)|*.png;*.jpg|All Files(*.*)|*.*";
93 |
94 | if (DialogResult.OK == dlg.ShowDialog())
95 | {
96 | renderView.CaptureImage(dlg.FileName);
97 | }
98 | }
99 |
100 | private void zoomFitToolStripMenuItem_Click(object sender, EventArgs e)
101 | {
102 | renderView.FitAll();
103 | }
104 |
105 | private void circleToolStripMenuItem_Click(object sender, EventArgs e)
106 | {
107 | SelectedShapeQuery query = new SelectedShapeQuery();
108 | renderView.QuerySelection(query);
109 | var shape = query.GetSubGeometry();
110 | if (shape == null)
111 | return;
112 |
113 | GeomCurve curve = new GeomCurve();
114 | if (!curve.Initialize(shape))
115 | return;
116 |
117 | if(curve.GetCurveType() != EnumCurveType.CurveType_Circle)
118 | {
119 | var xx = curve.FirstParameter() + curve.LastParameter();
120 | Vector3 pt1 = curve.Value(curve.FirstParameter());
121 | Vector3 pt2 = curve.Value(xx * 0.3);
122 | Vector3 pt3 = curve.Value(xx * 0.6);
123 |
124 | var arc = GlobalInstance.BrepTools.MakeArc3Pts(pt1, pt3, pt2);
125 | if(arc != null)
126 | {
127 | GeomCircle circle = new GeomCircle();
128 | circle.Initialize(arc);
129 | var center = circle.GetCenter();
130 | MessageBox.Show(String.Format("Center: {0}, {1}, {2}", center.X, center.Y, center.Z));
131 | }
132 |
133 | }
134 | }
135 | }
136 |
137 |
138 | }
139 |
--------------------------------------------------------------------------------
/StpViewer/MainForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/StpViewer/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace StpViewer
7 | {
8 | static class Program
9 | {
10 | ///
11 | /// The main entry point for the application.
12 | ///
13 | [STAThread]
14 | static void Main()
15 | {
16 | Application.EnableVisualStyles();
17 | Application.SetCompatibleTextRenderingDefault(false);
18 | Application.Run(new MainForm());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/StpViewer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("StpViewer")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("StpViewer")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("21da7a2d-517c-44c8-8881-82938e55cb5e")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/StpViewer/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18444
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace StpViewer.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
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 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
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("StpViewer.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
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 | }
72 |
--------------------------------------------------------------------------------
/StpViewer/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/StpViewer/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18444
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace StpViewer.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.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 | }
31 |
--------------------------------------------------------------------------------
/StpViewer/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/StpViewer/StpViewer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x86
7 | 8.0.30703
8 | 2.0
9 | {B4AD4738-657A-4BDF-A224-CF51AD629490}
10 | WinExe
11 | Properties
12 | StpViewer
13 | StpViewer
14 | v4.0
15 | Client
16 | 512
17 |
18 |
19 |
20 |
21 | x86
22 | true
23 | full
24 | false
25 | ..\bin\x86\Debug\
26 | DEBUG;TRACE
27 | prompt
28 | 4
29 |
30 |
31 | x86
32 | pdbonly
33 | true
34 | ..\bin\x86\Release\
35 | TRACE
36 | prompt
37 | 4
38 |
39 |
40 | true
41 | ..\bin\x64\Debug\
42 | DEBUG;TRACE
43 | full
44 | x64
45 | ..\..\..\..\bin\x64\Debug\StpViewer.exe.CodeAnalysisLog.xml
46 | true
47 | GlobalSuppressions.cs
48 | prompt
49 | MinimumRecommendedRules.ruleset
50 | ;D:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
51 | true
52 | ;D:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
53 | true
54 |
55 |
56 | ..\bin\x64\Release\
57 | TRACE
58 | true
59 | pdbonly
60 | x64
61 | ..\..\..\..\bin\x64\Release\StpViewer.exe.CodeAnalysisLog.xml
62 | true
63 | GlobalSuppressions.cs
64 | prompt
65 | MinimumRecommendedRules.ruleset
66 | ;D:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
67 | true
68 | ;D:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
69 | true
70 |
71 |
72 |
73 | ..\packages\AnyCAD.Net.Pro.2020.0.1\lib\x64\AnyCAD.Exchange.Net.dll
74 |
75 |
76 | ..\packages\AnyCAD.Net.Pro.2020.0.1\lib\x64\AnyCAD.Foundation.Net.dll
77 |
78 |
79 | ..\packages\AnyCAD.Net.Pro.2020.0.1\lib\x64\AnyCAD.Presentation.Net.dll
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | Form
95 |
96 |
97 | MainForm.cs
98 |
99 |
100 |
101 |
102 |
103 | MainForm.cs
104 |
105 |
106 | ResXFileCodeGenerator
107 | Resources.Designer.cs
108 | Designer
109 |
110 |
111 | True
112 | Resources.resx
113 |
114 |
115 |
116 | SettingsSingleFileGenerator
117 | Settings.Designer.cs
118 |
119 |
120 | True
121 | Settings.settings
122 | True
123 |
124 |
125 |
126 |
127 |
128 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
129 |
130 |
131 |
132 |
139 |
--------------------------------------------------------------------------------
/StpViewer/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/StpViewer_VB/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/StpViewer_VB/Form1.Designer.vb:
--------------------------------------------------------------------------------
1 | _
2 | Partial Class Form1
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form 重写 Dispose,以清理组件列表。
6 | _
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Windows 窗体设计器所必需的
18 | Private components As System.ComponentModel.IContainer
19 |
20 | '注意: 以下过程是 Windows 窗体设计器所必需的
21 | '可以使用 Windows 窗体设计器修改它。
22 | '不要使用代码编辑器修改它。
23 | _
24 | Private Sub InitializeComponent()
25 | Me.SplitContainer1 = New System.Windows.Forms.SplitContainer()
26 | Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()
27 | Me.TreeView1 = New System.Windows.Forms.TreeView()
28 | Me.FileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
29 | Me.OpenStepToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
30 | Me.OpenIGESToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
31 | Me.SaveImageToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
32 | CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit()
33 | Me.SplitContainer1.Panel1.SuspendLayout()
34 | Me.SplitContainer1.SuspendLayout()
35 | Me.MenuStrip1.SuspendLayout()
36 | Me.SuspendLayout()
37 | '
38 | 'SplitContainer1
39 | '
40 | Me.SplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
41 | Me.SplitContainer1.Location = New System.Drawing.Point(0, 0)
42 | Me.SplitContainer1.Name = "SplitContainer1"
43 | '
44 | 'SplitContainer1.Panel1
45 | '
46 | Me.SplitContainer1.Panel1.Controls.Add(Me.TreeView1)
47 | Me.SplitContainer1.Panel1.Controls.Add(Me.MenuStrip1)
48 | Me.SplitContainer1.Size = New System.Drawing.Size(812, 299)
49 | Me.SplitContainer1.SplitterDistance = 270
50 | Me.SplitContainer1.TabIndex = 0
51 | '
52 | 'MenuStrip1
53 | '
54 | Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.FileToolStripMenuItem})
55 | Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
56 | Me.MenuStrip1.Name = "MenuStrip1"
57 | Me.MenuStrip1.Size = New System.Drawing.Size(270, 25)
58 | Me.MenuStrip1.TabIndex = 0
59 | Me.MenuStrip1.Text = "MenuStrip1"
60 | '
61 | 'TreeView1
62 | '
63 | Me.TreeView1.Dock = System.Windows.Forms.DockStyle.Fill
64 | Me.TreeView1.Location = New System.Drawing.Point(0, 25)
65 | Me.TreeView1.Name = "TreeView1"
66 | Me.TreeView1.Size = New System.Drawing.Size(270, 274)
67 | Me.TreeView1.TabIndex = 1
68 | '
69 | 'FileToolStripMenuItem
70 | '
71 | Me.FileToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenStepToolStripMenuItem, Me.OpenIGESToolStripMenuItem, Me.SaveImageToolStripMenuItem})
72 | Me.FileToolStripMenuItem.Name = "FileToolStripMenuItem"
73 | Me.FileToolStripMenuItem.Size = New System.Drawing.Size(39, 21)
74 | Me.FileToolStripMenuItem.Text = "File"
75 | '
76 | 'OpenStepToolStripMenuItem
77 | '
78 | Me.OpenStepToolStripMenuItem.Name = "OpenStepToolStripMenuItem"
79 | Me.OpenStepToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
80 | Me.OpenStepToolStripMenuItem.Text = "Open STEP"
81 | '
82 | 'OpenIGESToolStripMenuItem
83 | '
84 | Me.OpenIGESToolStripMenuItem.Name = "OpenIGESToolStripMenuItem"
85 | Me.OpenIGESToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
86 | Me.OpenIGESToolStripMenuItem.Text = "Open IGES"
87 | '
88 | 'SaveImageToolStripMenuItem
89 | '
90 | Me.SaveImageToolStripMenuItem.Name = "SaveImageToolStripMenuItem"
91 | Me.SaveImageToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
92 | Me.SaveImageToolStripMenuItem.Text = "Save Image"
93 | '
94 | 'Form1
95 | '
96 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
97 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
98 | Me.ClientSize = New System.Drawing.Size(812, 299)
99 | Me.Controls.Add(Me.SplitContainer1)
100 | Me.MainMenuStrip = Me.MenuStrip1
101 | Me.Name = "Form1"
102 | Me.Text = "Form1"
103 | Me.SplitContainer1.Panel1.ResumeLayout(False)
104 | Me.SplitContainer1.Panel1.PerformLayout()
105 | CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit()
106 | Me.SplitContainer1.ResumeLayout(False)
107 | Me.MenuStrip1.ResumeLayout(False)
108 | Me.MenuStrip1.PerformLayout()
109 | Me.ResumeLayout(False)
110 |
111 | End Sub
112 |
113 | Friend WithEvents SplitContainer1 As SplitContainer
114 | Friend WithEvents TreeView1 As TreeView
115 | Friend WithEvents MenuStrip1 As MenuStrip
116 | Friend WithEvents FileToolStripMenuItem As ToolStripMenuItem
117 | Friend WithEvents OpenStepToolStripMenuItem As ToolStripMenuItem
118 | Friend WithEvents OpenIGESToolStripMenuItem As ToolStripMenuItem
119 | Friend WithEvents SaveImageToolStripMenuItem As ToolStripMenuItem
120 | End Class
121 |
--------------------------------------------------------------------------------
/StpViewer_VB/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/StpViewer_VB/Form1.vb:
--------------------------------------------------------------------------------
1 | Imports AnyCAD.Platform
2 | Imports AnyCAD.Presentation
3 |
4 |
5 | Public Class Form1
6 | Dim renderView As AnyCAD.Presentation.RenderWindow3d
7 | Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
8 | renderView = New AnyCAD.Presentation.RenderWindow3d
9 | renderView.Location = New System.Drawing.Point(0, 0)
10 | renderView.Size = SplitContainer1.Panel2.Size
11 | renderView.TabIndex = 1
12 | SplitContainer1.Panel2.Controls.Add(renderView)
13 |
14 | 'GlobalInstance.EventListener.OnSelectElementEvent += OnSelectionChanged;
15 | 'AddHandler AnyCAD.Platform.EventListener.SelectElementEvent, AddressOf OnSelectionChanged
16 |
17 | renderView.ExecuteCommand("ShadeWithEdgeMode")
18 | renderView.ShowCoordinateAxis(True)
19 | renderView.SetPickMode(CType(AnyCAD.Platform.EnumPickMode.RF_Face, Integer))
20 | renderView.RequestDraw()
21 | End Sub
22 |
23 | Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles Me.Resize
24 | If renderView IsNot Nothing Then
25 | renderView.Size = SplitContainer1.Panel2.Size
26 | End If
27 | End Sub
28 | End Class
29 |
--------------------------------------------------------------------------------
/StpViewer_VB/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' 此代码由工具生成。
4 | ' 运行时版本:4.0.30319.42000
5 | '
6 | ' 对此文件的更改可能会导致不正确的行为,并且如果
7 | ' 重新生成代码,这些更改将会丢失。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | '注意: 此文件是自动生成的;请不要直接修改它。 若要进行更改,
18 | ' 或者如果您在此文件中遇到生成错误,请转至项目设计器
19 | ' (转至“项目属性”或在解决方案资源管理器中双击“我的项目”节点),
20 | ' 然后在“应用程序”选项卡中进行更改。
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | End Sub
32 |
33 | _
34 | Protected Overrides Sub OnCreateMainForm()
35 | Me.MainForm = Global.StpViewer_VB.Form1
36 | End Sub
37 | End Class
38 | End Namespace
39 |
--------------------------------------------------------------------------------
/StpViewer_VB/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | 0
10 | true
11 |
12 |
--------------------------------------------------------------------------------
/StpViewer_VB/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' 有关程序集的一般信息由以下
6 | ' 控制。更改这些特性值可修改
7 | ' 与程序集关联的信息。
8 |
9 | '查看程序集特性的值
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | '如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
21 |
22 |
23 | ' 程序集的版本信息由下列四个值组成:
24 | '
25 | ' 主版本
26 | ' 次版本
27 | ' 生成号
28 | ' 修订号
29 | '
30 | '可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
31 | ' 方法是按如下所示使用“*”: :
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/StpViewer_VB/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' 此代码由工具生成。
4 | ' 运行时版本:4.0.30319.42000
5 | '
6 | ' 对此文件的更改可能会导致不正确的行为,并且如果
7 | ' 重新生成代码,这些更改将会丢失。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | '此类是由 StronglyTypedResourceBuilder
19 | '类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | '若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | '(以 /str 作为命令选项),或重新生成 VS 项目。
22 | '''
23 | ''' 一个强类型的资源类,用于查找本地化的字符串等。
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' 返回此类使用的缓存的 ResourceManager 实例。
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("StpViewer_VB.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' 使用此强类型资源类,为所有资源查找
51 | ''' 重写当前线程的 CurrentUICulture 属性。
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 | End Module
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/StpViewer_VB/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/StpViewer_VB/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' 此代码由工具生成。
4 | ' 运行时版本:4.0.30319.42000
5 | '
6 | ' 对此文件的更改可能会导致不正确的行为,并且如果
7 | ' 重新生成代码,这些更改将会丢失。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
24 |
25 | #Region "My.Settings 自动保存功能"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.StpViewer_VB.My.MySettings
68 | Get
69 | Return Global.StpViewer_VB.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/StpViewer_VB/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/StpViewer_VB/StpViewer_VB.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Debug
7 | x64
8 | {EB12C944-F665-4857-856D-8D7A57D32760}
9 | WinExe
10 | StpViewer_VB.My.MyApplication
11 | StpViewer_VB
12 | StpViewer_VB
13 | 512
14 | WindowsForms
15 | v4.5
16 | true
17 |
18 |
19 |
20 |
21 |
22 |
23 | On
24 |
25 |
26 | Binary
27 |
28 |
29 | Off
30 |
31 |
32 | On
33 |
34 |
35 | true
36 | true
37 | true
38 | ..\bin\x64\Debug\
39 | StpViewer_VB.xml
40 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
41 | full
42 | x64
43 | MinimumRecommendedRules.ruleset
44 |
45 |
46 | true
47 | ..\bin\x64\Release\
48 | StpViewer_VB.xml
49 | true
50 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
51 | pdbonly
52 | x64
53 | MinimumRecommendedRules.ruleset
54 |
55 |
56 |
57 | ..\packages\AnyCAD.Net.Pro.2020.0.1\lib\x64\AnyCAD.Exchange.Net.dll
58 |
59 |
60 | ..\packages\AnyCAD.Net.Pro.2020.0.1\lib\x64\AnyCAD.Foundation.Net.dll
61 |
62 |
63 | ..\packages\AnyCAD.Net.Pro.2020.0.1\lib\x64\AnyCAD.Presentation.Net.dll
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 | Form
92 |
93 |
94 | Form1.vb
95 | Form
96 |
97 |
98 |
99 | True
100 | Application.myapp
101 |
102 |
103 | True
104 | True
105 | Resources.resx
106 |
107 |
108 | True
109 | Settings.settings
110 | True
111 |
112 |
113 |
114 |
115 | Form1.vb
116 |
117 |
118 | VbMyResourcesResXFileCodeGenerator
119 | Resources.Designer.vb
120 | My.Resources
121 | Designer
122 |
123 |
124 |
125 |
126 | MyApplicationCodeGenerator
127 | Application.Designer.vb
128 |
129 |
130 | SettingsSingleFileGenerator
131 | My
132 | Settings.Designer.vb
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
141 |
142 |
143 |
144 |
151 |
--------------------------------------------------------------------------------
/StpViewer_VB/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/delm.bat:
--------------------------------------------------------------------------------
1 | del .\AnyCAD.Basic\obj /s/q
2 | del .\AnyCAD.Designer\obj /s/q
3 | del .\AnyCAD.WPF\obj /s/q
4 | del .\DxfViewer\obj /s/q
5 | del .\StpViewer\obj /s/q
6 | del .\StpViewer_VB\obj /s/q
--------------------------------------------------------------------------------
/weixin.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anycad/anycadnetsdkpro/998ce0731b93a067607b2e1656380cc9f2c4531e/weixin.jpg
--------------------------------------------------------------------------------