preset choices in the dialog brought up by PostRequestForElementTypePlacement

preset choices in the dialog brought up by PostRequestForElementTypePlacement

thomier
Explorer Explorer
637 Views
6 Replies
Message 1 of 7

preset choices in the dialog brought up by PostRequestForElementTypePlacement

thomier
Explorer
Explorer

I am using the following code to bring up the placement dialog for conduit:

var typeToPlace = new FilteredElementCollector(_document)
.OfClass(typeof(ConduitType))
.Cast<ConduitType>()
.Where(x => x.Name == "Rigid Nonmetallic Conduit (RNC Sch 40)")
.FirstOrDefault();

_uiDocument.PostRequestForElementTypePlacement(typeToPlace);

it works but I want to preset the diameter based on the user's choices in a previous dialog and I cannot figure out how to do this through the API.

The screenshot's attached highlight exactly what I am trying to pre-populate

0 Likes
638 Views
6 Replies
Replies (6)
Message 2 of 7

jeremytammik
Autodesk
Autodesk

I believe you can achieve what you wish using SetDefaultFamilyTypeId:

 

https://apidocs.co/apps/revit/2019/1f0d5aac-4602-b479-82b4-dc54a030c0a3.htm

 

Some further discussion with more details on this happened here:

 

https://forums.autodesk.com/t5/revit-api-forum/change-the-placement-option-for-promptforfamilyinstan...

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 7

thomier
Explorer
Explorer
public void SetDefaultFamilyTypeId(
	ElementId familyCategoryId,
	ElementId familyTypeId
)

doesn't seem to help me b/c both conduit runs with a 2" and a 4" diameter have the same exact familyTypeId.

And looking at the other link I wasn't able to see how that would help me either.

 

If I have to I can just leave it up to the user but I would much rather set the values as I already know what they need to be.

Thanks,

Tony 

0 Likes
Message 4 of 7

jeremytammik
Autodesk
Autodesk

One simple and effective thing you could do would be to post-check the conduits after the user has finished placing them and display a warning if the dimension they selected does not meet your expectations...
 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 5 of 7

mastjaso
Advocate
Advocate

Wouldn't that mean that the diameter is not a type property but is instead an instance property?

0 Likes
Message 6 of 7

thomier
Explorer
Explorer

It is an instance property that the dialog presets as the conduit is placed, I was just hoping there was a way i could control the values the dialog presents to the userValue I wish to prepopulate.PNG

0 Likes
Message 7 of 7

mastjaso
Advocate
Advocate

Oh yeah, I see what you mean, I think that's similar to this thread about pipes:
https://forums.autodesk.com/t5/revit-api-forum/change-the-system-type-for-pipe-creation-via-ui/td-p/...

 

But the general long and short of it is that I don't think you can entirely do what you want to do easily ...

0 Likes