├── show.jpg ├── show2.png ├── RapidCAX ├── app.ico ├── Resources │ ├── app.ico │ ├── icon.png │ └── StringResource.xaml ├── App.config ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── packages.config ├── App.xaml.cs ├── Controls │ ├── CommandLineCtrl.xaml.cs │ ├── RapidBackstageCtrl.xaml.cs │ ├── CommandLineCtrl.xaml │ └── RapidBackstageCtrl.xaml ├── App.xaml ├── PropertyUI │ ├── BasicPage.xaml │ ├── BasicPage.xaml.cs │ ├── TransformPage.xaml │ └── TransformPage.xaml.cs ├── MainWindow.xaml.cs ├── MainWindow.xaml └── RapidCAX.csproj ├── README.md ├── AnyCAD.Rapid.Core ├── packages.config ├── Command │ ├── UICommand.cs │ ├── UICommandContext.cs │ └── UICommandManager.cs ├── CommandEx │ ├── ShapeCommand.cs │ ├── AddTagCommand.cs │ ├── ViewCommands.cs │ └── FileCommands.cs ├── Data │ ├── SphereElementSchema.cs │ └── MyTextElement.cs ├── Properties │ └── AssemblyInfo.cs ├── MyDocumentListener.cs ├── MyDocumentViewer.cs └── AnyCAD.Rapid.Core.csproj ├── .gitignore └── RapidCAX.sln /show.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anycad/RapidCAX/HEAD/show.jpg -------------------------------------------------------------------------------- /show2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anycad/RapidCAX/HEAD/show2.png -------------------------------------------------------------------------------- /RapidCAX/app.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anycad/RapidCAX/HEAD/RapidCAX/app.ico -------------------------------------------------------------------------------- /RapidCAX/Resources/app.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anycad/RapidCAX/HEAD/RapidCAX/Resources/app.ico -------------------------------------------------------------------------------- /RapidCAX/Resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anycad/RapidCAX/HEAD/RapidCAX/Resources/icon.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RapidCAX 2 | The Rapid UI framework for CAD/CAE/CAM ... 3 | 4 | 5 | ![SHOW](./show.jpg) 6 | ![SHOW](./show2.png) -------------------------------------------------------------------------------- /AnyCAD.Rapid.Core/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /RapidCAX/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /RapidCAX/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # This .gitignore file was automatically created by Microsoft(R) Visual Studio. 3 | ################################################################################ 4 | 5 | /packages 6 | /.vs 7 | obj 8 | bin 9 | -------------------------------------------------------------------------------- /AnyCAD.Rapid.Core/Command/UICommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AnyCAD.Rapid.Core 8 | { 9 | public class UICommand 10 | { 11 | public String Name = ""; 12 | public UICommand() 13 | { 14 | 15 | } 16 | 17 | public virtual bool Execute(UICommandContext ctx) 18 | { 19 | return false; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /RapidCAX/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /RapidCAX/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using Fluent; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Configuration; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | 10 | namespace RapidCAX 11 | { 12 | /// 13 | /// Interaction logic for App.xaml 14 | /// 15 | public partial class App : Application 16 | { 17 | protected override void OnStartup(StartupEventArgs e) 18 | { 19 | AnyCAD.Foundation.GlobalInstance.Initialize(); 20 | base.OnStartup(e); 21 | } 22 | 23 | protected override void OnExit(ExitEventArgs e) 24 | { 25 | AnyCAD.Foundation.GlobalInstance.Destroy(); 26 | base.OnExit(e); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /RapidCAX/Controls/CommandLineCtrl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace RapidCAX 17 | { 18 | /// 19 | /// Interaction logic for CommandLineControl.xaml 20 | /// 21 | public partial class CommandLineControl : UserControl 22 | { 23 | public CommandLineControl() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /RapidCAX/Controls/RapidBackstageCtrl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace RapidCAX 17 | { 18 | /// 19 | /// Interaction logic for RapidBackstageCtrl.xaml 20 | /// 21 | public partial class RapidBackstageCtrl : UserControl 22 | { 23 | public RapidBackstageCtrl() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /RapidCAX/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /AnyCAD.Rapid.Core/CommandEx/ShapeCommand.cs: -------------------------------------------------------------------------------- 1 | using AnyCAD.Forms; 2 | using AnyCAD.Foundation; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace AnyCAD.Rapid.Core 11 | { 12 | 13 | 14 | class ShapeCommand : UICommand 15 | { 16 | public ShapeCommand() 17 | { 18 | this.Name = "Sphere"; 19 | } 20 | 21 | public override bool Execute(UICommandContext ctx) 22 | { 23 | //创建事务 24 | var transaction = new UndoTransaction(ctx.Document); 25 | transaction.Start(this.Name); 26 | 27 | //创建个球 28 | var element = SphereElementSchema.Create(ctx.Document); 29 | // 显示 30 | ctx.ShowElement(element); 31 | 32 | //提交事务 33 | transaction.Commit(); 34 | 35 | ctx.RequestUpdate(); 36 | 37 | return true; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /AnyCAD.Rapid.Core/CommandEx/AddTagCommand.cs: -------------------------------------------------------------------------------- 1 | using AnyCAD.Foundation; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace AnyCAD.Rapid.Core 9 | { 10 | class AddTagCommand : UICommand 11 | { 12 | public AddTagCommand() 13 | { 14 | this.Name = "AddTag"; 15 | } 16 | 17 | public override bool Execute(UICommandContext ctx) 18 | { 19 | //创建事务 20 | var transaction = new UndoTransaction(ctx.Document); 21 | transaction.Start(this.Name); 22 | 23 | var text = new MyTextElement(); 24 | text.Text = "这是一个好引擎!"; 25 | text.Position = new Vector3(100, 100, 100); 26 | 27 | text.AddElement(ctx.Document); 28 | 29 | text.Show(ctx.RenderView.GetScene()); 30 | 31 | 32 | //提交事务 33 | transaction.Commit(); 34 | 35 | ctx.RequestUpdate(); 36 | 37 | return true; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /RapidCAX/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 RapidCAX.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /RapidCAX/PropertyUI/BasicPage.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /RapidCAX/PropertyUI/BasicPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using AnyCAD.Foundation; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace RapidCAX 18 | { 19 | /// 20 | /// Interaction logic for BasicPage.xaml 21 | /// 22 | public partial class BasicPage : UserControl 23 | { 24 | private Element mElement; 25 | public BasicPage(Element element) 26 | { 27 | mElement = element; 28 | 29 | InitializeComponent(); 30 | 31 | DataContext = this; 32 | } 33 | 34 | public string ElementName 35 | { 36 | get { return mElement.GetName(); } 37 | set { 38 | mElement.SetName(value); 39 | } 40 | } 41 | 42 | public string ElementSchemaName 43 | { 44 | get { return mElement.GetSchemaName(); } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /AnyCAD.Rapid.Core/Command/UICommandContext.cs: -------------------------------------------------------------------------------- 1 | using AnyCAD.Forms; 2 | using AnyCAD.Foundation; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AnyCAD.Rapid.Core 10 | { 11 | public class UICommandContext 12 | { 13 | public MyDocumentViewer mDocView; 14 | 15 | public UICommandContext(MyDocumentViewer docView) 16 | { 17 | mDocView = docView; 18 | } 19 | 20 | 21 | public Document Document 22 | { 23 | get { return mDocView.mDocument; } 24 | } 25 | 26 | public ElementId DefaultMaterialId 27 | { 28 | get { return mDocView.mMaterialId; } 29 | } 30 | 31 | public RenderControl RenderView 32 | { 33 | get { return mDocView.mRenderCtrl; } 34 | } 35 | 36 | public void ShowElement(DrawableElement element) 37 | { 38 | mDocView.mDbView.ShowElement(element); 39 | } 40 | 41 | public void RequestUpdate() 42 | { 43 | mDocView.mRootSceneNode.ComputeBoundingBox(); 44 | mDocView.mRootSceneNode.RequstUpdate(); 45 | mDocView.mRenderCtrl.RequestDraw(EnumUpdateFlags.Scene); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /AnyCAD.Rapid.Core/Command/UICommandManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace AnyCAD.Rapid.Core 9 | { 10 | public class UICommandManager 11 | { 12 | 13 | private static Dictionary mCommands = new Dictionary(); 14 | 15 | private UICommandManager() 16 | { 17 | 18 | } 19 | 20 | public static void LoadCommands(Assembly assembly) 21 | { 22 | var types = assembly.GetTypes(); 23 | foreach (var type in types) 24 | { 25 | if (type.IsSubclassOf(typeof(UICommand))) 26 | { 27 | var command = Activator.CreateInstance(type) as UICommand; 28 | if (command.Name.Length == 0) 29 | continue; 30 | mCommands[command.Name] = command; 31 | } 32 | } 33 | 34 | } 35 | 36 | public static bool ExecuteCommand(string name, UICommandContext ctx) 37 | { 38 | UICommand command; 39 | if (mCommands.TryGetValue(name, out command)) 40 | { 41 | return command.Execute(ctx); 42 | } 43 | 44 | return false; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /AnyCAD.Rapid.Core/Data/SphereElementSchema.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using AnyCAD.Foundation; 7 | 8 | namespace AnyCAD.Rapid.Core 9 | { 10 | /// 11 | /// 球类型的模板 12 | /// 13 | class SphereElementSchema : ElementSchema 14 | { 15 | public SphereElementSchema() 16 | : base("Sphere") 17 | { 18 | //增加参数 19 | AddParameter("Radius", ParameterCreator.Create(5.0f)); 20 | } 21 | 22 | /// 23 | /// 参数化驱动构造模型 24 | /// 25 | /// 26 | /// 27 | /// 28 | public override bool OnParameterChanged(Element instance, ParameterDict parameters) 29 | { 30 | var shape = CastShapeElement(instance); 31 | var radius = parameters.Cast("Radius", 5.0f); 32 | shape.SetShape(ShapeBuilder.MakeSphere(GP.Origin(), radius)); 33 | return true; 34 | } 35 | 36 | /// 37 | /// 创建一个实例对象 38 | /// 39 | /// 40 | /// 41 | static public ShapeElement Create(Document doc) 42 | { 43 | return ElementSchemaManager.Instance().CreateShapeInstance("Sphere", doc); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /RapidCAX/PropertyUI/TransformPage.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /RapidCAX/Controls/CommandLineCtrl.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |