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