is there a way to do a match-properties on the VisualArq attributes of an object? Without using the styles?
Sometimes I like to set them manually per object, to have a proper lineweight and hatch on the drawing, without wanting to make a new style.
Hi @isolabella the Rhino âMatch Propertiesâ command works on VisualARQ objects with the existing Rhino object properties, but it doesnât work with the âsection attributesâ. I take this request for the future development.
I was about to ask for the same - Iâll just add my voice to this request.
Something similar to âMatch Propertiesâ but for the Parameters and Section Attributes would be very handy. I know that we can sort of solve the matching of Parameters in GH, but it is a too long way around the problem.
If you do implement such a feature - please do add âSelect allâ âSelect noneâ buttons in the menu Thanks.
I mean something like this in the âMatch Parametersâ window
There can be many parameters, and if we only want to match one of them, then Select None + (selecting the one we want) is very helpful shortcut. I know it is not something important, but vanilla Rhino doesnât have these buttons in âMatch Propertiesâ and I felt the lack of them many times.
You can check the VisualARQ roadmapâs page to see the planned features (not specified if they will be included in VisualARQ 3 or in future versions), the features that are currently in progress (probably included in VisualARQ 3), and the features done in our internal Work In Progress versions of VisualARQ 3: Roadmap - VisualARQ
Since the latest API functions allow it, I did a small python script that kind of answers this feature request. It does not include the Select All and Select None request from @Czaja but it still is quite useful to quickly copy parameters from one object to another without using Grasshopper.
I also used the Document User Text to save the last selected parameters. Donât know if itâs a good practice, but it does the job
Here is the script:
import rhinoscriptsyntax as rs
import clr
clr.AddReference("VisualARQ.Script")
import VisualARQ.Script as va
def va_match_parameters():
objs_to_modify = rs.GetObjects("Select objects to modify", filter=0, preselect=True)
if not objs_to_modify:
print("No objects selected.")
return
source_obj = rs.GetObject("Select source object", filter=0, preselect=False)
if not source_obj:
print("No source object selected.")
return
rs.EnableRedraw(False)
source_parameters_ids = va.GetAllObjectParameterIds(source_obj, True)
parameter_names = [va.GetParameterName(param_id) for param_id in source_parameters_ids]
last_selected = rs.GetDocumentData("MatchParameters", "LastSelected")
if last_selected:
last_selected = last_selected.split(",")
check_list_items = [(param, (param in last_selected if last_selected else False)) for param in parameter_names]
parameters_to_copy = rs.CheckListBox(check_list_items, "Select Parameters to Copy", "Choose parameters:")
if not parameters_to_copy:
print("No parameters selected.")
return
selected_parameters = [param for param, checked in parameters_to_copy if checked]
rs.SetDocumentData("MatchParameters", "LastSelected", ",".join(selected_parameters))
for obj in objs_to_modify:
for param in selected_parameters:
param_id = source_parameters_ids[parameter_names.index(param)]
param_value = va.GetParameterValue(param_id, source_obj)
va.SetParameterValue(param_id, obj, param_value)
rs.EnableRedraw(True)
print(str(len(objs_to_modify)) + " objects modified.")
if __name__ == "__main__":
va_match_parameters()
Let me know if it produces any bug, Iâll update it to match more use cases
Sometimes I canât believe that I find my 3-year-old posts in 6-year-old wish-threads. Especially when itâs about something obviously lacking and itâs stopping me from using Visual ARQ or Rhino with the functionality that it supposedly currently has.
@antoine3
Thank you very much for your script, there are some issues, maybe I will fix them.
ModuleNotFoundError: No module named âVisualARQ.Scriptâ
After I changed it to simply import VisualARQ as va script runs but it stops while trying to copy the attributes with the error
Hi @Czaja,
Your bug could be a matter of VisualArq version. Which version are you running?
Changing
import clr
clr.AddReference("VisualARQ.Script")
import VisualARQ.Script as va
into
import VisualARQ as va
does not seem to be a correct solution, I always imported VisualArq this way and I think it is the regular use of it since I got it from VisualArq scripting examples.
Even if it allows the script to run on your machine, you get the next bug because your script canât find the VisualArq GetAllObjectParameterIds method (which makes sense since the library youâre importing may not include this method).
I strongly suppose itâs a matter of VisualArq version, since the API has evolved a lot lately.
@Czaja check the VisualARQ Labs as well. It includes some commands to match properties between VisualARQ objects and section attributes between Rhino objects.
Hi,
I forgot about VisualARQ Labs, thank you. Indeed, there is a tool that mostly do what I want. It doesnât work with Blocks, but this might be a Rhino issue.
There is one weirdness that you might want to solve.
When selecting objects you need to:
Select object to modify, accept,
Then itâs once again asking you to select objects to modify where you shouldnât select anything (otherwise your objects will be copied)
Finally itâs asking you to select the source objects.
Video shows how this script can produce multiple copies of an object
Hi @Czaja
After selecting the objects to modify, you need to hit ENTER twice, and not select the same object again, otherwise a new copy will be created for each repeated selection.
The other commands that reference VisualARQ objects in the Labs donât have this problem because they use a different âGet Objectâ component (developed by our team) that prevents this from happening.
Ah, so itâs a Grasshopper Player definition? Nice. Do you use any custom scripting components inside or only vanilla Grasshopper to achieve this functionality?