Place Family Instance

Place Family Instance

Anonymous
Not applicable
1,839 Views
3 Replies
Message 1 of 4

Place Family Instance

Anonymous
Not applicable

Hey Guys,

 

I have a GUI button that when pressed should prompt the user to create specific family instances (walls in this case). However, I am having issues with the PromptForFamilyInstancePlacement. I can't create the 'FamilySymbol' object for OST_Walls.

 

When I try debug through the SDK example, and this discussion on The Building coder

(http://thebuildingcoder.typepad.com/blog/2010/06/place-family-instance.html) then the 'symbol' object is always null and an exception is thrown.

 

I'm stuck!!! Any help appreciated!

 

Thanks guys

 

 

    uidoc.PromptForFamilyInstancePlacement( symbol );

FilteredElementCollector collector = new FilteredElementCollector( doc );
 
    collector.OfCategory( BuiltInCategory.OST_Doors );
    collector.OfClass( typeof( FamilySymbol ) );
 
    FamilySymbol symbol = collector.FirstElement() as FamilySymbol;
    uidoc.PromptForFamilyInstancePlacement( symbol );
 
0 Likes
1,840 Views
3 Replies
Replies (3)
Message 2 of 4

saikat
Autodesk
Autodesk

Hi:

 

If you wish to create new walls you can directly use the dedicated method for wall creation using Document.Create.NewWall(). Since wall is a system family, we have dedicated classes for them and also enable their creation. You can find out more from the Revit API chm file located in the SDK. The PromptForFamilyInstance() method can be used for inserting instances of component families.

 

If you wish to take a quick look at the NewWall() please refer to : http://thebuildingcoder.typepad.com/blog/2011/07/create-gable-wall.html. There are many other examples in the SDK and the building coder website too.

 

Hope this helps

Saikat



Saikat Bhattacharya
Senior Manager - Technology Consulting
Message 3 of 4

jeremy_tammik
Alumni
Alumni

Hi Padraig,

To add to Saikat's answer, I might also point out that you cannot create a FamilySymbol object for OST_Walls, because walls use the built-in system wall family and use dedicated WallType instances to define their type, instead of the generic FamilySymbol used by standard RFA families for objects such as doors and windows.

cheers

jeremy
--
Jeremy Tammik
Autodesk Developer Network -- http://www.autodesk.com/joinadn
The Building Coder -- http://thebuildingcoder.typepad.com

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 4 of 4

Anonymous
Not applicable

Great, thanks for the replies! They really helped. 


My problem was, as Jeremy pointed out, that I was trying to create a FamilySymbol object for OST_Walls. 
I are trying to identify certain walls created by the user as 'special walls'. Going to rethink my solution, might try marking the walls instead through setting the mark parameter.


Thanks again guys!

0 Likes