Revit family preview update instance parameters

Revit family preview update instance parameters

Anonymous
Not applicable
1,034 Views
2 Replies
Message 1 of 3

Revit family preview update instance parameters

Anonymous
Not applicable

Hi,

 

I have a family in which instance parameters control the geometry. This means that during placing (with UIDocument.PromptForFamilyInstancePlacement for example) I see the preview of the family with the default values for parameters. I update the values of the instance parameter after placing and then the geometry changes.

 

How can I improve this behavior to get the correct preview with the updated instance parameters already when placing?

0 Likes
1,035 Views
2 Replies
Replies (2)
Message 2 of 3

RPTHOMAS108
Mentor
Mentor

If they were type parameters you could use Document.SetDefaultFamilyTypeId however as they are instance and the instance doesn't exist before it is placed I believe they just take (default) values set in family parameters, you could try the following:

 

Prior to placing instance get the family document to edit via Document.EditFamily

Get FamilyManager of family document, set the current type to something and then change the parameter values to what you want them to be on insert. If there isn't any types in the family then the FamilyManager methods for setting parameters (even instance ones) are largely useless (you then have to create a type).

 

unrelated:

I'm always loosing the location of this EditFamily method, the obvious place for it is on the Family class. Would be good if there was an extension method on Family:

 

Module RvtExtMethodsModule
    <Extension()> _
    Public Function EditFamily(ByVal Family As Autodesk.Revit.DB.Family) As Autodesk.Revit.DB.Document
        Return Family.Document.EditFamily(Family)
    End Function
End Module
Message 3 of 3

Anonymous
Not applicable

Hmm, could be a solution. But I don't like to edit families just for the sake of placement because it slows things down. Will try it and provide feedback.

0 Likes