algorithmic modeling for Rhino
Hoi Sander,
Currently thats not possible in grasshopper but you can use the SDK to do it.
Just copy this function into the "custom additional code" body of a vb component and call it from the main subroutine:
Function InsertBlock(BlockName As String, insPt As Point3d, dblScale As Double, dblRotation As Double) As Guid
Dim blockTable As docobjects.Tables.InstanceDefinitionTable = doc.InstanceDefinitions
Dim block As docObjects.InstanceDefinition = blockTable.Find(BlockName, True)
Dim move As Transform = Transform.Translation(New Vector3d(insPt))
Dim scale As Transform = Transform.Scale(point3d.Origin, dblScale)
Dim rotate As Transform = Transform.Rotation(math.PI * dblRotation / 180, point3d.Origin)
Dim xform As Transform = move * scale * rotate
insertBlock = doc.Objects.AddInstanceObject(block.Index, xform)
End Function
On calling it adds the block to your scene directly. To be able to keep track of all the inserted blocks I usually collect the guid's in a global variable.
Hope that this helps you out,
Marc
Dag Marc,
I've been looking into using the SDK and got stuck, you just unstuck it!
Thanks a bundle !
gr
S
Hi Marc,
I'm wondering if you could help me with a similar problem. I'm trying to replace the geometry within an existing block with geometry from grasshopper using VB but so far I've had no luck. Any ideas?
Cheers,
Scott
Hey Marc,
Stupid script question, when you say "call it from the main subroutine" how do you do that? It's something I don't quite get with functions yet.
Thanks in advance,
ryan
Hi Marc,
I am a rather new user to VB scripts and would really like to know the answer to Ryan's question as well - any chance you can share?
Thanks!
Neil
Hi Marc
This is really great - except that it places a new block every time I update settings like a slider value. Can you suggest a way to show the block in GH style preview and bake like other GH data?
Thanks!
Chris
Hi Marc,
I am a rather new user to VB scripts and would really like to know the answer to Ryan's question as well - any chance you can share?
Thanks!
Neil
VERY GOOD!!!BUT FOR NEW USERS
Dim blockTable As docobjects.Tables.InstanceDefinitionTable = doc.InstanceDefinitions
Dim block As docObjects.InstanceDefinition = blockTable.Find(BlockName, True)
Dim move As Transform = Transform.Translation(New Vector3d(insPt))
Dim scale As Transform = Transform.Scale(point3d.Origin, dblScale)
Dim rotate As Transform = Transform.Rotation(math.PI * dblRotation / 180, point3d.Origin)
Dim xform As Transform = move * scale * rotate
A = doc.Objects.AddInstanceObject(block.Index, xform)
Hi guys,
You might read this post...there you find a complete solution to this inserting block. I've posted a version Preview blocks and bake them...
The script also get's sure the block is updated each time the geometry changes and is suppressing the annoying prompt from rhino when a block already exists.
Best regards
FF
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by