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

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.



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

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.