Setting Workplane as host prior to Prompt For Family Instance Placement?

I could use some advice regarding how to set the default workplane to host elements placed using PromptForFamilyInstancePlacement prior to placing the elements. The tool I’m developing always defaults to vertical face (and won’t let me change that before placement) - until I place one element manually on the workplane, then that seems to become the new default when I use the tool.

Since I’m setting parameter values via xaml interface and then tagging them with the API after placement, PostRequestForElementTypePlacement is not a viable alternative.

Thanks!

@Texmati ,

can you share some code? do you have a script.py ?

XAML in general is used for WPF

KR

Andreas

Not really a XAML/WPF issue, it’s just that I can’t use PostRequestForElementTypePlacement which lets you select a workplane before placing the element because that method has a self-contained transaction and won’t let me gather the element IDs of the instances that I place in order to set parameters and tag them programmatically after the fact.

I can create my own transaction with PromptForFamilyInstancePlacement and do things with the elements afterward, but there’s no flexibility to select a different workplane before placing. It just defaults to vertical face and you’re stuck with that - unless you drag an element into the model from the project browser and then select the workplane. That seems to reset the default and then the app behaves as I want it to, but that extra step is a real pain.

1 Like

@Texmati ,

using a TransactionGroup?

tgroup = TransactionGroup(doc, "one and two")
tgroup.Start()
t1=Transaction(doc,"one")
t1.Start()
#Do something
t1.Commit()
#--------------------------------------------
t2=Transaction(doc,"two")
t2.Start()
#Do something
t2.Commit()
tGroup.Commit()

https://thebuildingcoder.typepad.com/blog/2015/02/using-transaction-groups.html

KR

Andreas

I’ve found that PromptForFamilyInstancePlacement is broken in Revit 2023 & 2024. In 2022 it respects the provided FaceBasedPlacementType but in later versions it ignores it and uses whatever placement option was used previously.

1 Like

:white_check_mark: Forcing “Place on Work Plane” in Revit 2025 with Python

Well, for what it’s worth, I finally figured this out — and it works in Revit 2025!

To force Revit to use “Place on Work Plane” instead of the default “Place on Face” when using PromptForFamilyInstancePlacement, you can use the PromptForFamilyInstancePlacementOptions class.

:wrench: Required Imports


from Autodesk.Revit.UI import PromptForFamilyInstancePlacementOptions, FaceBasedPlacementType

:jigsaw: Usage Example


options = PromptForFamilyInstancePlacementOptions()

options.FaceBasedPlacementType = FaceBasedPlacementType.PlaceOnWorkPlane

uidoc.PromptForFamilyInstancePlacement(e, options)

:memo: Notes

  • e should be a valid FamilySymbol (element type) that you want to place.

Note:
The solution above only works for work plane-based elements.
PostRequestForElementTypePlacement` allows the user to select work plane placement before placing, but does not allow collecting the elements afterward for setting parameters or tagging.

On the other hand, PromptForFamilyInstancePlacement allows setting parameters and tagging after collecting the new elements via a DocumentChanged event, but it defaults to the last placement option without letting the user choose from the ribbon.

To avoid requiring the user to manually place a family just to set the default placement option, the following code snippet enables changing that default when the user Shift-clicks—no need to place an element.

:jigsaw: Code Snippet

def windowmaker():
    # Create an interface
    global possum_window
    possum_window = WindowMaker(xamlfile)
    possum_window.ShowDialog()

if __shiftclick__:
    # Find the type selected in the interface
    for e in elems:
        if e.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM).AsString() == "Passthrough":
            break

    try:
        show_dialog("Select 'Place On Work Plane' in the ribbon to set the correct default placement option, then hit ESC.")
        uidoc.PostRequestForElementTypePlacement(e)
    except Exception as ex:
        pass
else:
    windowmaker()
1 Like

I’ll need to take a breath, not used to extensive answers like this one :grin: in here.
Nice and thank you @Texmati