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: 

promptforfamilyinstanceplacement spacebar to rotate causes shortcut cycling?

5 REPLIES 5
Reply
Message 1 of 6
bxw
Enthusiast
1080 Views, 5 Replies

promptforfamilyinstanceplacement spacebar to rotate causes shortcut cycling?

I'm writing an addin to place family instances. The general idea is that a dialog pops up and listens for a key to be pressed & depending on the key that was pressed the user will be prompted to place an instances of a particular family.  

 

I call the addin command with a keyboard shortcut, press a key to select the family to be placed, when I press the space bar to rotate the family being placed the addin is called again & the dialog pops up again.  Based on what is displayed in the Revit status bar I believe revit is just launching the addin again from the beginning.  

 

If I wait a couple seconds then hit the spacebar, Revit is no longer listening for a keyboard shortcut or cycling.  

 

How can I make revit stop listenig for a keyboard shortcuts/ cycling while my addin is running?  

 

I've included a snip of the status bar of when I'm placing the family & the shortcut cycling is still in the status bar.  

 

Thanks,

 

Ben

5 REPLIES 5
Message 2 of 6
gopinath.taget
in reply to: bxw

Hello,

 

I need a little more information. Is your dialog modeless? When you hit the space bar, is your dialog still open and listening to events? What kind of family instance are you facing? Are you trying to replicate the native Revit command for placing the family instance?

 

Thanks

Gopinath

Message 3 of 6
bxw
Enthusiast
in reply to: gopinath.taget

Gopinath thanks for your reply.  

 

 

Is your dialog modeless?

No.  Once a a key is pressed, close the dialog box Dialog Result OK.

 

 

When you hit the space bar, is your dialog still open and listening to events?

No.  

 

 

What kind of family instance are you facing?

Its a level based family, Electrical fixture category.  

 

 

Are you trying to replicate the native Revit command for placing the family instance?


Not really.  The point of the addin is to place an instance of a particular family and avoid having to scroll through the types in the properties palette. The dialog displays a list of family types that could be placed, each one has a letter associated with it.  That letter passes the family type (FamilySymbol) to promptforfamilyinstanceplacement.  

 

 

 

Here is an example workflow (Key strokes in Bold😞

 

Revit keyboard shortcut: BS, Command is launched & dialog is shown.

 

X Key pressed to select a predefined family & type from my dialog box.  My dialog is closed by the key press event & promptforfamily instance placement is called.  

 

Spacebar pressed to rotate the family for placement.  This is where the problem occurs.  The spacebar starts the command over, the status bar is still displaying keyboard shortcut info even though the command is already running.  

 

If i wait a couple seconds before hitting the spacebar to rotate the family without issue.  After that couple seconds the status bar stops showing the keyboard shortcut info & displays info about placing a family.  

 

 

I guess the question is, why is revit still "listening" for a shortcut or shortcut cycling when a command is active?

 

I tried creating a transaction before the dialog was launched & closing the transaction before calling promptforfamilyinstanceplacement, since it can't be called from within a transaction.  But no luck.  

 

Thanks,

 

Ben

  

 

 

 

 

 

 

 

Message 4 of 6
haixdpro89
in reply to: bxw

Can you upload your code here ?

Message 5 of 6
PhillipM
in reply to: haixdpro89

This may not help in your situation but instead of using UIDocument.PromptForFamilyInstancePlacement()  to place the families how about you try "UIDocument.PostRequestForElementTypePlacement()"

 

It may work????

 

Cheers

 

Phillip

Message 6 of 6
PhillipM
in reply to: PhillipM

Oh this is a old Topic.  SOrry 🙂

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