VisualARQ SDK?

Hello !

I would like to know if there is a solution or a plan to use VisualARQ elements in C# and RhinoCommon?

Thank you
-jmv

Hi @kitjmv,

We have introduced a small API in VisualARQ 2.4, but it is not complete yet. We’re also working on the documentation and samples for the new VisualARQ Script API, but nothing is public yet.

VisualARQ Script API is currently only accessible from RhinoCommon (C#, VB.NET, Python), but new version will allow to access this API from C++ and RhinoScript.

VisualARQ Script API is still in WIP, and not all features are still exposed in the API. VisualARQ 2.4 has methods to work with:

  • Common Style operations (rename, delete, etc)
  • Parameters
  • Wall and Wall Styles
  • Element and Element Styles
  • Furniture and Furniture Styles

VisualARQ 2.5 will include more objects in the API. If you need any method in particular, just ask for it and I’ll try to include it in the next release. I’m currently working in all Beam/Column/Door/Window methods.

To use the API, just reference the VisualARQ.Script.dll assembly that is installed with VisualARQ. You’ll find it next to Rhino.exe, usually in C:\Program Files\Rhino 6\System. This API has been created to work with document resident objects (create, edit, modify and delete) using their object ID. All methods are members of an static class VisualARQ.Script. In order to use the API, you don’t need to do anything in particular, just call any method. If VisualARQ is not yet loaded, the assembly will take care of any initialization needed on the first VisualARQ Script call.

Here is a sample code using the API:

using System;
using System.Collections.Generic;
using Rhino;
using Rhino.Commands;
using Rhino.Geometry;
using Rhino.Input;
using Rhino.Input.Custom;
using va = VisualARQ.Script;

namespace VisualARQ
{
    public class VaScriptSampleCommand : Command
    {
        public VaScriptSampleCommand()
        {
            // Rhino only creates one instance of each command class defined in a
            // plug-in, so it is safe to store a refence in a static property.
            Instance = this;
        }

        ///<summary>The only instance of this command.</summary>
        public static VaScriptSampleCommand Instance
        {
            get; private set;
        }

        ///<returns>The command name as it appears on the Rhino command line.</returns>
        public override string EnglishName
        {
            get { return "ScriptSampleCommand"; }
        }

        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            // Get units scale factor from meters to document units
            double unitScale = RhinoMath.UnitScale(UnitSystem.Meters, doc.ModelUnitSystem);

            // Create a block with a 3D sphere as mnodel representation
            var sphere = Brep.CreateFromSphere(new Sphere(Point3d.Origin, 1.0 * unitScale));
            doc.InstanceDefinitions.Add("Sphere", string.Empty, Point3d.Origin, new[] { sphere });

            // Create a block with a 2D rectangle as plan representation
            var retangle = new ArcCurve(new Circle(Point3d.Origin, 1.0 * unitScale));
            var idefIndex = doc.InstanceDefinitions.Add("Circle", string.Empty, Point3d.Origin, new[] { retangle });
            
            // Create a VisualARQ Generic Element Style
            var styleId = va.AddGenericElementStyle("Sphere", new List<string>() { "Sphere" }, new List<string>() { "Circle" });

            // Insert VisualARQ Generic Element
            var elementId = va.AddGenericElement(styleId, new Point3d(1.0, 1.0, 1.0), 2.0);

            // Change Element position
            Point3d pos = va.GetGenericElementPosition(elementId);
            va.SetGenericElementPosition(elementId, pos + new Vector3d(2.0, 2.0, -2.0));

            // Create a document parameter "price"
            var priceId = va.AddDocumentParameter("Price", va.ParameterType.Currency, "Costs");

            // Set "Price" value to element
            va.SetParameterValue(priceId, elementId, 100.0);

            return Result.Success;
        }
    }
}

Let me know if you have any doubts or issues using the API.

Regards,

Enric

Thank you very much @enric for your complete answer !

I don’t really know. In my case, it’s about exporting and importing to software that supports block definitions.

VisualARQ creates a block definition for each element to modify the properties individually.
And even though none of the default properties will change.
The problem is that we lose the benefit of block instantiation or other advantages of scattering methods.

For example, I would like to import a Rhino or FBX file into Unreal Engine and have a single mesh for all elements of the same type. (of course, unless the properties are not the default ones)

And currently the result in EU is that memory is exploding. I do not know VisualARQ well in Grasshopper and I prefer to write in C# than to use GH but maybe I can do it without opening Visual Studio.

In any case, I would test VisualARQ Script.

thanks again
-jmv

I don’t recommend you to use VisualARQ Script API in Grasshopper, as VisualARQ Script API is intended to be used with document resident objects, while Grasshopper works with in-memory (temporary) geometry-only objects.

Just create a RhinoCommon C# Plug-In and use VisualARQ Script API as RhinoCommon or any other .NET assembly.

Enric

Sorry to revive this old topic. Is there any VisualARQ API documentation available?

There isn’t. The API is still in WIP phase.

But if you reference the file:

C:\Program Files\Rhino 6\System\VisualARQ.Script.dll

You can see all the avaialable methods, structs, enums.
Asuni did such a good job with method names that sometimes you don’t even need a documentation to figure out how to perform some simple tasks.

Thanks @djordje! I did that already. I was just wondering if there was something like the rhinocommon api documentation.

I think it was never released. Online or offline version of documentation,

Hi,

I’m happy to announce that we have exposed almost all features in the Script API in VisualARQ 2.13: section attributes, all objects and styles, parameters, etc. I guess more than 500 new methods have been exposed.

We have also write a basic documentation for all methods, but we have to prepare a public website for it. Unfortunately, we have yet to create some samples.

I hope VisualARQ 2.13 will be published this October.

Regards,

Enric

3 Likes

is the API doc out yet? can’t find it from anywhere

Hi @Yankun_Yang there is no public documentation for the VisualARQ API yet. I hope we can work on it soon. You can find some examples here: Is there an API or SDK for VisualARQ? - VisualARQ

Thanks for the update.
Is there an example of converting IFC to rhino3dm using VisualARQ API that I can take a look?

Hi @Yankun_Yang,

There is no API in VisualARQ to import or export an IFC file. You should use the RhinoCommon SDK. For example, you can open any supported file into Rhino using the Rhino.RhinoDoc.ReadFile method.

Enric