Is there any way to fix multiple blocks at once
or is there a way to select multiple objects of the same layer in multiple blocks
following this up on your pm you sent me, I think it is better to handle this in public instead. Maybe you can clarify more what you want to do. Why do you need the objects to reside in blocks and why do you need to edit them all at the same time across multiple blocks . Furthermore, what kind of edits do you need to perform?
This possible in Grasshopper, so certainly script-able. Select Blocks somehow, deconstruct block, sort geometry by something.
In my work, there are many similar objects.
I placed the same objects on the same layer and the block. I want to Mapping objects inside the blocks. (those objects I put together Layer).
As a result, I want to quickly select those objects. I can’t edit multiple blocks to select them.
absolutely.
@Gijs
I want to fix multiple blocks at once.
so I can select multiple objects in blocks
You say fix multiple blocks, what does that mean?
You cannot select objects across multiple blocks. You need to get into block edit mode. So if you dive into python scripting, you will need to iterate over the blocks you want to edit and modify the objects on a per block basis.
Again, you can’t do this. So use (python) scripting or gh @Rickson pointed out to you to iterate over each block you want to access and modify the content of.
If by help you mean: “ please do my work for you “ then I need to disappoint you. You basically already have the code you need to access blocks, which was given to you in earlier threads. So show some effort from your side, write some code, see where it works and where it doesn’t and then post your results and ask questions.
never too late to start learning
Hi @dangtungx,
following up on the PM you sent me, my understanding is that you want to apply planar mapping for all objects inside selected blocks that are on specific layer.
Below does that but also matches other object attributes; I don’t know more specific way to do it. You will have to first make an object with the mapping you want, and on correct layer, because we need to use it to “match” your in-block object attributes, including mapping.
So:
- select block instances
- select layer for the object you want to match mapping
- select source object that has the desired mapping…
Option Explicit
Call Main()
Sub Main()
Dim arrTargets, strSource,i,j
'get blocks'
Dim B: B = Rhino.GetObjects("Blocks?", 4096)
If isnull(B) Then Exit Sub
'get layer'
Dim l : l = Rhino.GetLayer()
If isnull(l) Then Exit Sub
'get object to match mapping and other attributes'
strSource = Rhino.GetObject("Select object to match attributes")
If isnull(strSource) Then Exit Sub
For i=0 To Ubound(B)
arrTargets = Rhino.BlockObjects(Rhino.BlockInstanceName(B(i)))
'match attributes, incl. mapping, to all in-block objects on selected layer'
If IsArray(arrTargets) Then
For j=0 To Ubound(arrTargets)
If Rhino.ObjectLayer(arrTargets(j)) = l Then
Rhino.MatchObjectAttributes arrTargets(j), strSource
End If
Next
End If
Next
End Sub