Grasshopper

algorithmic modeling for Rhino

Trying to put together a script component to insert block. please help

Hello.

I managed to insert blocks based on this post

The problem is that it really creates geometry on the document.

Is there a way to just preview the geometry?

I can retrieve geometry from the instance definition itself using docObjects.InstanceDefinition.GetObjects but I can't show it or use it in any component

Also, If I manage to make a script component to preview block insertions is there a way to bake the results?

Is bake mechanism available on a sdk component?

Can someone give me some pointers? I'm a little lost about the way to go here.

Thanks

Views: 2735

Replies to This Discussion

Hi Rui,

there is a way to preview your geometry. But you have to do it for each type of geom...like Point Curve Breps Surface ect. (Look at the example file)

The bake is basically also possible...look at the example file also here.

The example i've made for you shows the approach of displaying all different kinds of geometry and if you hit the bake button it will create a new block and insert it....if the block with the same name already exists it will override it...this prevents from annoying errors if you make some changes and just want to update the block

Hope this helps and gives you an idea...of course this can be done in a completely different way, but all the methods and classes you might use are in the example.

Cheers FF

Attachments:

Hi Rui,

Just read your post... Nice to see that people make use of the definition I posted some time ago...

For previewing you could just insert your block and delete it every time a value updates... In a way that is a way of "previewing".

Just add a global variable to keep track of all the block references (GUIDs) which you delete everytime the component updates... With an additional boolean toggle you can then control bake/delete (preview on/off). Attached a simple setup on how this works.

Another way would be to bake a special user text with the block. This way you can keep track of the baked objects in the file itself which will allow you to filter these blocks later on.

Does that help?
Best, Marc

Attachments:

Marc, 

Thanks for sharing this definition. It's straight forward and easy to use.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2021   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service