static void Main(string[] args) { const string rhinocommonPath = @"C:\dev\github\mcneel\rhino\src4\DotNetSDK\rhinocommon\dotnet"; Console.WriteLine("[BEGIN PARSE]"); Console.ForegroundColor = ConsoleColor.DarkGreen; ClassBuilder.BuildClassDictionary(rhinocommonPath); Console.ResetColor(); Console.WriteLine("[END PARSE]"); // just do a small number of classes to get started string[] filter = new string[] { ".Mesh", ".Brep", ".BrepFace", ".Curve", ".BezierCurve", ".Extrusion", ".NurbsCurve", ".Intersection", ".AreaMassProperties", ".VolumeMassProperties" }; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("Writing javascript client"); var js = new JavascriptClient(); js.Write(ClassBuilder.AllClasses, "compute.rhino3d.js", filter); Console.WriteLine("Writing python client"); var py = new PythonClient(); py.Write(ClassBuilder.AllClasses, "", filter); Console.WriteLine("Writing C# client"); var cs = new DotNetClient(); cs.Write(ClassBuilder.AllClasses, "RhinoCompute.cs", filter); Console.ResetColor(); }
static void Main(string[] args) { const string rhinocommonPath = @"C:\dev\github\mcneel\rhino\src4\DotNetSDK\rhinocommon\dotnet"; Console.WriteLine("[BEGIN PARSE]"); Console.ForegroundColor = ConsoleColor.DarkGreen; ClassBuilder.BuildClassDictionary(rhinocommonPath); Console.ResetColor(); Console.WriteLine("[END PARSE]"); string[] filter = new string[] { ".AreaMassProperties", ".BezierCurve", ".Brep", ".BrepFace", ".Curve", ".Extrusion", ".Intersection", ".Mesh", ".NurbsCurve", ".NurbsSurface", ".SubD", ".Surface", ".VolumeMassProperties" }; var di = SharedRepoDirectory(); Console.ForegroundColor = ConsoleColor.Blue; var classes = ClassBuilder.FilteredList(ClassBuilder.AllClasses, filter); // Javascript Console.WriteLine("Writing javascript client"); var js = new JavascriptClient(); string javascriptPath = "compute.rhino3d.js"; if (di != null) { string dir = Path.Combine(di.FullName, "computeclient_js"); if (Directory.Exists(dir)) { javascriptPath = Path.Combine(dir, javascriptPath); } } js.Write(ClassBuilder.AllClasses, javascriptPath, filter); DirectoryInfo jsdocDirectory = new DirectoryInfo("docs\\javascript"); if (di != null) { string dir = Path.Combine(di.FullName, "computeclient_js", "docs"); if (Directory.Exists(dir)) { jsdocDirectory = new DirectoryInfo(dir); } } Console.WriteLine("Writing javascript docs"); RstClient.WriteJavascriptDocs(classes, jsdocDirectory); // Python Console.WriteLine("Writing python client"); string basePythonDirectory = ""; if (di != null) { string dir = Path.Combine(di.FullName, "computeclient_py"); if (Directory.Exists(dir)) { basePythonDirectory = dir; } } var py = new PythonClient(); py.Write(ClassBuilder.AllClasses, basePythonDirectory, filter); Console.WriteLine("Writing python docs"); RstClient.WritePythonDocs(basePythonDirectory, classes); // C# Console.WriteLine("Writing C# client"); var cs = new DotNetClient(); cs.Write(ClassBuilder.AllClasses, "RhinoCompute.cs", filter); Console.ResetColor(); }
static void Main(string[] args) { var rootDir = GetRepoRootDirectory(); var distDir = Path.Combine(rootDir, "dist"); // destination for generated client code var rhinocommonPath = Path.Combine("rhino3dm", "src", "dotnet"); if (!Directory.Exists(rhinocommonPath)) { throw new InvalidOperationException($"RhinoCommon directory not found! ({rhinocommonPath})"); } Console.WriteLine("[BEGIN PARSE]"); Console.ForegroundColor = ConsoleColor.DarkGreen; ClassBuilder.BuildClassDictionary(rhinocommonPath); Console.ResetColor(); Console.WriteLine("[END PARSE]"); string[] filter = new string[] { ".AreaMassProperties", ".BezierCurve", ".Brep", ".BrepFace", ".Curve", ".Extrusion", ".GeometryBase", ".Intersection", ".Mesh", ".NurbsCurve", ".NurbsSurface", ".SubD", ".Surface", ".VolumeMassProperties" }; var classes = ClassBuilder.FilteredList(ClassBuilder.AllClasses, filter); Console.ForegroundColor = ConsoleColor.Blue; /* --- JavaScript --- */ Console.WriteLine("Writing javascript client"); string jsDir = Path.Combine(distDir, "javascript"); Console.WriteLine(jsDir); Directory.CreateDirectory(jsDir); var js = new JavascriptClient(false); js.Write(ClassBuilder.AllClasses, Path.Combine(jsDir, "compute.rhino3d.js"), filter); var jsm = new JavascriptClient(true); jsm.Write(ClassBuilder.AllClasses, Path.Combine(jsDir, "compute.rhino3d.module.js"), filter); Console.WriteLine("Writing javascript docs"); RstClient.WriteJavascriptDocs(classes, distDir); /* ----- Python ----- */ Console.WriteLine("Writing python client"); string pyDir = Path.Combine(distDir, "python"); Console.WriteLine(pyDir); Directory.CreateDirectory(pyDir); var py = new PythonClient(); py.Write(ClassBuilder.AllClasses, pyDir, filter); Console.WriteLine("Writing python docs"); RstClient.WritePythonDocs(classes, distDir); /* ------- C# ------- */ Console.WriteLine("Writing C# client"); var csDir = Path.Combine(distDir, "dotnet"); Console.WriteLine(csDir); Directory.CreateDirectory(csDir); var cs = new DotNetClient(); cs.Write(ClassBuilder.AllClasses, Path.Combine(csDir, "RhinoCompute.cs"), filter); Console.ResetColor(); }