Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Place Family Instance

3 REPLIES 3
Reply
Message 1 of 4
padraig.oleary
1488 Views, 3 Replies

Place Family Instance

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 );
 
3 REPLIES 3
Message 2 of 4
saikat
in reply to: padraig.oleary

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

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

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!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community