Selecting objects in an Assembly

Selecting objects in an Assembly

Anonymous
Not applicable
1,132 Views
5 Replies
Message 1 of 6

Selecting objects in an Assembly

Anonymous
Not applicable

Hi,

I am strugging to grab objects in an assembly like this one. Here i have a stacked wall type that is composed of two other wall types.
I have minimal experience with the revit structure beyond programming for it. 

 

I wish to grab types 1 and 2.

I thought I was supposed to use the AssemblyInstance class with the GetMemberIDs() but its been throwing a lot of exceptions and I am not going anywhere and I am not totally sure its the right class i should be using..

 

If there is a simple example of how to do this that would be great.

Cheers

 

Capture.PNG

0 Likes
Accepted solutions (1)
1,133 Views
5 Replies
Replies (5)
Message 2 of 6

jeremytammik
Autodesk
Autodesk

Hi.

 

Sorry, I am not clear on what you are trying to achieve.

 

When you say 'select' and 'grab', do you mean prompting the user to interactively select something on screen, or programmatically retrieve things from the database?

 

When you say 'wall type', I would tend to assume the latter.

 

In the latter case, almost all retrieval of elements from the database happens through filtered element collectors and nothing else.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 6

Anonymous
Not applicable

In my program I end up deleting both of these types highlighted bellow... but it throws an error saying "The last type in Stacked Wall cannot be deleted".

 

So I decided I would build a dictionary linking the types shown here to the type..

 

 

  • OMP_Generic_Stacked Wall_Conceptual External Wall on Foundation_450mm. 

where this is the key and if the ElementTypes linked to that key... 

 

  • Generic_Basic Wall_EWS-000_Exterior Wall_450mm
  • Generic_Basic Wall_SWS-001_Foundation Wall_300mm

.....is more then one... Delete each ElementType until there is one left linked to the key.

 

Capture.PNG

 

I want to cover all cases of this error occuring so i want to know if there is any connection made through the api between these elements to build a dictionary on in a similar way that a connection can be found between a family and each family symbol.

 

apologies if there is any confusion, my experience with revit is minimal so i could misphrase something due to uncertainty over my understanding of the revit structure.

 

Cheers

 

 

0 Likes
Message 4 of 6

Anonymous
Not applicable

An easier way of phrasing it might be I need a way of linking types to the assemblies they are in.

0 Likes
Message 5 of 6

Anonymous
Not applicable
Accepted solution

SOLVED!, i was attempting to make solve this issue for any situation of this type that might arise, i dod not know that this is a problem specific to this situation alone (The Stacked Wall).

 

Now i realised that the wall class allows us get the stacked wall member ids. This solves the problem.

solution found here.

http://thebuildingcoder.typepad.com/blog/2014/04/whats-new-in-the-revit-2015-api.html

 

thanks Jeremy

0 Likes
Message 6 of 6

jeremytammik
Autodesk
Autodesk

Congratulations, and thank you for your appreciation!



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes