PromptForFamilyInstancePlacement Disables Some Menu Options

PromptForFamilyInstancePlacement Disables Some Menu Options

muaslam
Enthusiast Enthusiast
906 Views
3 Replies
Message 1 of 4

PromptForFamilyInstancePlacement Disables Some Menu Options

muaslam
Enthusiast
Enthusiast

Hello,

 

I am trying to Place a FamilySymbol using PromptForFamilyInstancePlacement method using C# while developing an add-in for Revit. The placement of components using this method disables most of the menu options while placement (as shown in picture 1). While if I try to place the same component directly from Project Browser, the same menu options remain enabled (as shown in picture 2) . Can someone point out something that I should do to match the behavior with Project Browser?

 

 

Picture1Picture1Picture2Picture2

Here's my code snippet that I am using,

FamilySymbol symbol = HelperMethods.LoadFamilySymbol(familyFilePath, familySymbolName, revitUIApp.ActiveUIDocument.Document);

BCCSCore.Instance.RevitUIApp.ActiveUIDocument.PromptForFamilyInstancePlacement(symbol);

 

 

Any help in this regard would be much appreciated.

 

Thanks,

Umar

 

0 Likes
Accepted solutions (1)
907 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk
0 Likes
Message 3 of 4

muaslam
Enthusiast
Enthusiast

Hi Jeremy,

 

Thanks for replying. I have tried Activating the symbol as well. But the menu items still remain disabled. Then, I tried regenerating the document as well. But even this didn't fix the issue. The menu items are disabled while placing component through PromptForFamilyInstancePlacement command while they are enabled when we place from Project Browser. 

 

         static public FamilySymbol LoadFamilySymbol (string localFilePath, string symbolName, Document doc)
            {
            FamilySymbol symbol = null;
            using ( Transaction transaction = new Transaction(doc, "Load Transaction") )
                {
                try
                    {
                    transaction.Start();
                    doc.LoadFamilySymbol(localFilePath, symbolName, out symbol);
                    if (!symbol.IsActive)
                        {
                        symbol.Activate();
                        doc.Regenerate();
                        }
                    transaction.Commit();
                    }
                catch
                    {
                    transaction.RollBack();
                    }
                }
            return symbol;
            }
        }

Thanks,

Umar

0 Likes
Message 4 of 4

muaslam
Enthusiast
Enthusiast
Accepted solution

Hi Folks,

 

I found a solution for the item, previously as mentioned in previous post I had been using,

 

 

FamilySymbol symbol = HelperMethods.LoadFamilySymbol(familyFilePath, familySymbolName, revitUIApp.ActiveUIDocument.Document);

BCCSCore.Instance.RevitUIApp.ActiveUIDocument.PromptForFamilyInstancePlacement(symbol);

Instead of the above, now I am using,

 

 

FamilySymbol symbol = HelperMethods.LoadFamilySymbol(familyFilePath, familySymbolName, revitUIApp.ActiveUIDocument.Document);

ElementType elementType = symbol as ElementType;

BCCSCore.Instance.RevitUIApp.ActiveUIDocument.PostRequestForElementTypePlacement (elementType);

This way the execution does not stop at PostRequestForElementTypePlacement, I had to handle this workflow, but it does not disable any of the menus.

 

In my above codes BCCSCore is a singleton class and has an instance of UIApplication class (from Revit Api).

 

Thanks,

Umar