Get all VisualARQ objects in document by type with Rhino Python

In Rhino Python Editor I start like this:

import clr
import VisualARQ.Script as va

and it works fine for known methods. I’d like to collect all VA objects of given type, something like this:
I noticed that in Grasshopper you have the VARQAll component, aka VisualARQ Pipeline.
Thank you

Hi @Andrea_Guerra,

There is a VisualARQ command doing this, so you don’t need to develop a Python script. The command is called vaSelSameType.

If you still want to develop a Python script, there is not a method to get all the objects of the same type, but you could obtain all the objects in the file and then evaluate if they correspond to a certain VisualARQ type (using, for example, the isWall method for walls) to determine if they should be selected or not.

1 Like

Hello @alfmelbev
I followed your advice, collected all objects in the document and then looped and filtered the walls:

for obj in Rhino.RhinoDoc.ActiveDoc.Objects:
    if obj.IsNormal and va.IsWall(obj.Id):
        # print wall object Ids to CSV file

It works fine, I generate a CSV file with all wall Ids. Now I need to extract info from the objects: Style, geometry (surface, volume) and parameters. Couldn’t figure it out reading the documentation.
Thank you very much

Hi @Andrea_Guerra,

You can get the style of an object using the GetProductStyle method, which will return an style Guid. If you want to get the name, you can use the GetStyleName method afterwards.

As for parameters, you can get their values like this:

import clr
import VisualARQ.Script as va
import rhinoscriptsyntax as rs

objectId = rs.GetObject("Select an object",0,1,1,0,0,)

paramId = va.GetObjectParameterId("Cost",objectId,1)
print va.GetParameterValue(paramId,objectId)

You can get other data from parameters using methods such as GetParameterName or GetParameterType.

As for calculating the volume, we don’t have a method to calculate it (I have already requested it) so the way to do it is by getting the InstanceReference using the UUID of the object, then open the InstanceDefinition , get each geometry inside, apply the transformation matrix of the InstanceReference , and compute the volume of each transformed geometry.

Why do you need to get the volume in Python? Maybe there is a different workflow depending on what you need.

1 Like

Hello @alfmelbev
Thank you very much for your tips.
I’m an experienced architect and python enthousiast, but a newbie in Rhino & VisualARQ.
I’m working on a python plugin that extracts a bill of quantities from the VisualARQ objects. It’s still in early stage, you can check improvements on Github.
A command creates some parameters (boolean/percentage) that are attached to objects. The parameters represent “construction works” like demolition, reconstruction, remove plaster, add plaster, paint and so on. Another command will extract the bill of quantities based on the “construction works” associated to objects and their geometric/physical properties. The bill of quantities will be automatically exported in excel.
I need the volume of the objects in example if I demolish a wall, move the rubble around and transport it to the discharge. My hope is to automate some everyday tasks and have fun with python!

1 Like

Of course the workflow can be greatly simplified: I can prepare some VisualARQ tables that include all the “construction work” parameters alongside geometric values, and extract the CSV files from the tables.
Then, with an external python app (I was thinking of a Django app, but this is outside the concerns of this forum), I can collect all these CSVs and build up the bill of quantities. Easy but not as clean as the internal script!

In the end I used a mixed approach:

  • First script gets all wall styles and attaches “Physical” and “Construction work” parameters (numeric, boolean, percentage)
  • Second script gets all walls and fills the “Description” parameter with the wall Id (used SetObjectDescription built in method)
  • I prepared a custom Wall Table that outputs Description (wall Id), Style, Length, Area and Volume of selected walls. All these values are extracted to a CSV file.
  • Third script picks up the CSV file generating a dictionary of all walls, then it loops through all wall objects in the document and adds parametric values to the dictionary. At the end of the process I have a list of walls that looks like this: [{"Wall-1":{"Style":"Wall style", "Length": length,...,"Parameter-1":value,...},{"Wall-2":{...}},...]
  • The script goes on building the Bill of Quantities, it loops in the wall list and pairs “Construction work” parameters with proper wall geometry, adding up quantities wall by wall. Results are extracted into a CSV file.

By now I’m limited to wall objects and only few construction works, but you can check improvements on the github repository linked in a previous reply.

1 Like