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: 

promptforfamilyinstance placement

1 REPLY 1
Reply
Message 1 of 2
Anonymous
419 Views, 1 Reply

promptforfamilyinstance placement

Hello.

Is there any way to isert only one instance of the family using promptforfamilyinstanceplacement? what it does is the user needs to insert multiple families. i just want to insert 1 instance of the family and then exit.

thanks...

1 REPLY 1
Message 2 of 2
saikat
in reply to: Anonymous

Hi:

 

One suggestion would be (I have not tried it on my own yet but it should work) to register for DocumentChanged event. So when your user inserts a family instance and it happens because of internal call to the PromptForFamilyInstance() method, it will fire off the DocumentChanged event. In the event handler for this method, you could maintain a count of the newly inserted instances and the moment a single instance has been placed you can cancel the active command using the windows API. The following two blog posts might help cover some ground on the workaround i have just mentioned:

 

http://thebuildingcoder.typepad.com/blog/2010/06/place-family-instance.html and

http://thebuildingcoder.typepad.com/blog/2010/11/launching-a-revit-command.html (for some ways to cancel the command).

 

I hope this gives some ideas on how to approach this task and do let us know if this helped. Or if you could come up with even better idea.

 

good luck!

Saikat



Saikat Bhattacharya
Senior Manager - Technology Consulting

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