Grasshopper

algorithmic modeling for Rhino

I am trying to select all the instances of a block to get their basepoint.  I have found out how to do this based on the "name" attribute, However some of the instances have an empty name attribute, and thus the script is ignoring it.  Instead I would like to find all instances of the block based on the block name.  Currently this is my approach...

1) Create an array of all instance objects in the file

2) Search the array for any instance whos "name" attribute matches a given string

3) Get the "Basepoint" attribute from all matching instances

I would think that all I would need to do is find an attribute that holds what the instance is referencing and match the string against that, however I can not find the correct attribute.

I am working in C#

Any help would be appreciated! :-)

Views: 505

Replies to This Discussion

I think you're after InstanceObject.InstanceDefinition.Name.

Perfect!  Plugged  in InstanceObject.InstanceDefinition.Name instead of InstanceObject.Attributes.Name and got exactly what I wanted!  Thanks again Andrew!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service