Assign section attributes via python script

Hello,

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.

Thank you!

2 Likes

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.

2 Likes

Hi @fsalla, thank you for your answer! That will be useful in my workflow, thanks a lot.

@fsalla likewise. Looking forward to this. Thank you

Hello! Iā€™ve got the feeling you are going to release 2.13 real soonā€¦ And 3.0 shortly after that.
=}

@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.

More details: VisualARQ 2 - Version 2.13 released

1 Like

It would be even easier if we could ā€œmatch propertiesā€ of objects - is this possible in 2.13, please?

Hi @fsalla, thanks for the info! I will try to use it.

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

1 Like

Thank you. This is a great improvement.

1 Like

2 posts were split to a new topic: Generate dimensions from walls and openings automatically

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!

Hi @antoine3,

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)

Section pattern
Section pattern.3dm (2.6 MB)
Section pattern.py (195 Bytes)

1 Like

Hi @alfmelbev, thanks a lot

1 Like

I downloaded the files and it would not work for me

1 Like

Hi @o-lit,

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.

Thank you, will test this week

1 Like

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:

image

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,

Hi @antoine3,

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.

1 Like

Hi @alfmelbev,

Iā€™ve been working with VA using this automated way of assigning section attributes for the last 9 months now, and it works very well!

However, I have a question about one specific method Iā€™m looking for: is there a way to use the va.SetObjectSectionPattern() function and assign ā€˜Noneā€™ as a pattern?

This is relevant in a scenario where I assigned patterns on objects previously, and would like to go back to an empty section.

For now, my workaround is to either set a hatch and give it a very large scale, or I could apply a white solid pattern, but I guess it would be more clean to assign the right thing to my objects.

Thank you,