I would like to assign section attributes to elements via a script (preferably in python).
I would like to use the benefits of VisualARQ with dynamic levels and sections to create 2D documentation, but using 3D polysurfaces from Rhino (and not VisualARQ objects), since all my projects are modeled this way.
For example, would it be possible to select all polysurfaces from a layer and assign them all the same section attributes?
I guess this post has already explored the topic, but I does not document so much on the method.
Hi @antoine3, we are going to release VisualARQ 2.13 very soon, which will expand the API functions available and therefore it will be possible to access to section attributes through Python scripts. I’ll keep you posted.
@eugen, @antoine3 you may have seen the news already. We have already published VisualARQ 2.13, which adds API methods to get and set section attributes to objects, styles and components.
Hi @o-lit this is already possible with a GH definition run with the GH Player. We have published the “VisualARQ Labs” plug-in that collects some commands driven by the GH Player, which include some to match properties among VisualARQ objects (vaMatchHeight, vaMatchStyle, vaMatchProperty,…) You can download it here: https://www.food4rhino.com/en/app/visualarq-labs
Hi @fsalla, I’ve downloaded the latest version, and I would like to test some scripts. I’m looking for a simple documentation for the new API methods to set section attributes to objects. Can you give me some guidance on this? Thanks a lot for this new version!
There are some methods available to define section attributes. Here you have an example:
import clr
import rhinoscriptsyntax as rs
clr.AddReference("VisualARQ.Script")
import VisualARQ.Script as va
obj = rs.GetObject("Pick an object")
va.SetObjectSectionPattern(obj,1,45,0.5)
We had to fix an issue with these methods in the last public version. I send you in a PM a newer version where these methods are working fine so that you can use them as well.
Hi @alfmelbev,
I just tested a simple script, and I get strange values applied to my object’s Section Attributes.
Here is the full python script:
import clr
import rhinoscriptsyntax as rs
clr.AddReference("VisualARQ.Script")
import VisualARQ.Script as va
obj = rs.GetObject("Pick an object")
va.SetObjectSectionPattern(obj,1,45,0.5)
va.SetObjectSectionPlotWeight(obj,1.50)
And when I check my object’s section attributes, it looks like this:
I tested it with several values, and it seems that:
the print width applied is the closest one from the list
I don’t understand the shift in the Pattern Angle value
selecting the Pattern with an integer is also a bit tricky (I understand that the Pattern index is based on the hatches list from the Options window, but the list displayed in the Section Attributes is displaying a different order). Would it be a solution to select a Pattern with a string instead of an integer?
Do you have any idea what I might have done wrong about the angle values? And how I could fix it?
Thank you,
Yes, for now you cannot define any value as print width, it must be one of the values from the list, that is why it is taking the closest one. I’ll report this to make it possible.
Pattern Angle is shown in degrees and the Python method is reading the value in radians, so you need to define the value in radians. In the following example I am defining a value of 90º:
import clr
import rhinoscriptsyntax as rs
import math
clr.AddReference("VisualARQ.Script")
import VisualARQ.Script as va
obj = rs.GetObject("Pick an object")
pi = math.pi
va.SetObjectSectionPattern(obj,1,pi/2,0.5)
va.SetObjectSectionPlotWeight(obj,1.50)
I see the problem. I’ll report this to make this selection easier.