View - Meshola - web based mesh content creation ;

Meshola -- web based mesh content creation

Home Log In Facebook Contact Keep Me Posted Public Meshes Source Code Articles API & Applications

Hello, Stairs

The Meshola API takes XML as its input so no special software is required to access it. However, there is a .NET library that will make access easier by generating the correct XML. The library is available via NuGet, and its called Meshola.Library.ShapeTemplateLib

The source code to the library is also available on GitHub . This project is open source and public domain.

The documentation for the API is located here.

To use the library in an application, perform the following steps:

  1. Create a console application in your favorite version of Visual Studio
  2. Add the Nuget package Meshola.Library.ShapeTemplateLib to the project.
  3. Add in the function below to instantiate some stairs, which will contact the API and get the results.
using ShapeTemplateLib.Templates.User0;
using System.IO;
using System.Net;
public void HelloStairs() {
    // Create some simple stairs using as template, with the defaults. Look at the public properties to see options
    StraightStairs stairs = new StraightStairs();
    
    // Properties for this call, the url, name of command and XML data
    string url = "http://www.meshola.com/API/APIAlpha";
    string command = "getmesh";
    string xmldata = stairs.GetProperties().ToString();
    
    // Post to the API url and get back a file
    using (WebClient client = new WebClient())
    {
          var reqparm = new System.Collections.Specialized.NameValueCollection();
          reqparm.Add("uk", "");
          reqparm.Add("command", command);
          reqparm.Add("xmldata", xmldata);
          reqparm.Add("outputfile", "HelloStairs.fbx");
          Console.WriteLine("before API call");
          byte[] responsebytes = client.UploadValues(url, "POST", reqparm);
          MemoryStream ms = new MemoryStream(responsebytes);
          Console.WriteLine("after API call");
          File.WriteAllBytes("HelloStairs.fbx", responsebytes);
    }
}
;