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: 

Prompt Wall Placement

3 REPLIES 3
Reply
Message 1 of 4
ryanpdaley
304 Views, 3 Replies

Prompt Wall Placement

I'm trying to load a WallType from another .rvt file, and prompt the user to place the wall wherever they want.  Jeremy Tammik describes how to Transfer a Wall Type from another .rvt file.   However, I still can't figure out how to prompt the user to place said new WallType.  It should behave in the same way that uiDoc.PromptForFamilyInstancePlacement() functions.  Anybody have any ideas?

 

I suppose I could use the Wall.Create() method.  Then, I need a way to prompt the user to draw the Curve that defines the wall.  So, the only way I can figure out how to do that is to use the Selection.PickPoint() twice, then use the two defined points to create a straight curve to make a straight wall.           

 

There, unfortunately, seems like no way to mimic the native Revit UI behavior of creating a wall from scratch.  Or am I missing something here?

3 REPLIES 3
Message 2 of 4
architect.bim
in reply to: ryanpdaley

Hi!

To promt the user to create a Wall you can use PostCommand:

uiapp.PostCommand(
    RevitCommandId.LookupPostableCommandId(PostableCommand.ArchitecturalWall)
);

To make sure that the right WallType is selected when you call it, a workaround is needed. One that comes to mind is to open a transaction before calling PostCommand, create a wall using the Wall.Create method with the desired WallType, close the transaction and delete created wall using doc.Delete(). After that, when PostCommand is called, the desired wall type will be selected by default. Maybe there are other ways to make it.

 


Maxim Stepannikov | Architect, BIM Manager, Instructor
Message 3 of 4
GaryOrrMBI
in reply to: architect.bim

Assuming that post command can be applied in the OP's situation then, off the top of my head, I believe that setting the newly created wall type to the "default" wall type prior to posting the wall command should complete the setup...

Document.SetDefaultElementTypeId(ElementTypeGroup, ElementId)

where ElementTypeGroup is WallType from the ElementTypeGroup enum and ElementId is the ID of the newly created wall type.
Gary J. Orr
GaryOrrMBI (MBI Companies 2014-Current)
aka (past user names):
Gary_J_Orr (GOMO Stuff 2008-2014);
OrrG (Forum Studio 2005-2008);
Gary J. Orr (LHB Inc 2002-2005);
Orr, Gary J. (Gossen Livingston 1997-2002)
Message 4 of 4
architect.bim
in reply to: GaryOrrMBI

Nice! I felt there was some kind of setting that was responsible for this. I just couldn't find it. 😃


Maxim Stepannikov | Architect, BIM Manager, Instructor

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

Post to forums  

Rail Community


Autodesk Design & Make Report