Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adjust Family Instance parameters BEFORE placement

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
2040 Views, 5 Replies

Adjust Family Instance parameters BEFORE placement

I am building an Addin which allows a user to place a Family Instance (a door) onto a wall. The user can specify the width and height (instance parameters) in a userform. I am using instance parameters as our doors are manufactured at the customer needs.

 

Right now I am placing the Family Instance and adjust the width and height (and sill height) AFTER the user has placed the elements. This seems a bit strange, because the default values are like 500x500, so when placing the elements they are 500x500, but when the user "ends" the placement, the elements are updated to their correct width and height.

 

What I would like to to show the user (while placing) the actual width and height. So I need to adjust those parameters BEFORE placement.

 

Here's a StackOverflow question with the same problem

5 REPLIES 5
Message 2 of 6
jeremytammik
in reply to: Anonymous

Dear Teun Ham,

Thank you for the query.

I looked at your stackoverflow thread and think the questions and answers in that thread are useful and relevant.

I do not see very much to add, and what I did have to say I said there.

Here is a shoprt recapitulation:

Yes, you can only change the family instance dimension parameter values after the instance has been placed.

Yes, you could define different types for different values, and then place the type.

You could create those types on the fly immediately before placing the instance.

In Revit 2015, you can define which family type is placed by PromptForFamilyInstancePlacement.

Where do the width and height etc. values come from?

Can you determine them immediately before the call to PromptForFamilyInstancePlacement?

If so, then you could create a new family type with those dimensions on the fly and set that to be the active type right before the call to PromptForFamilyInstancePlacement.

Cheers, Jeremy.



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

Message 3 of 6
Anonymous
in reply to: Anonymous

Hi Jeremy,

 

Thanks for your answer!

 

"Where do the width and height etc. values come from?"

 

The values are coming from an userform where the user can select which door/louver he wants to insert.

 

Right now I have adopted the "create type family on-the-fly" method. I am using the "duplicate" function to create a new type family (after checking if it doesn't already exists). Now the preview of the placement is showing the item at true size!

 

Ideally, I would also "include" the Sill Height in the preview, but I am afraid that those parameters are only accessible AFTER placement.

Message 4 of 6
jeremytammik
in reply to: Anonymous

Dear Teun Ham,

Thank you for your update.

I am very glad to hear it works.

Yes, I can indeed well imagine that the sill height parameter does not exist before the family instance has been inserted into the model..

Best regards,

 

Jeremy



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

Message 5 of 6
Anonymous
in reply to: jeremytammik

I could alo....

 

1) Create a new Type Family on the fly

2) Let the user place that new Type Family

3) Replace the placed Type Family with a "regular" Instance Family (and optionally remove the Type Family from the Family)

 

Down side is that the user needs to wait longer (as Revit needs to generate both the Type Family and the Instance Family members)

Message 6 of 6
saurav_dhir
in reply to: Anonymous

Hi Teun_Ham,

 

I am facing the similar issue, Can you please show a sample code to do so, Please?

 

Thanks

Saurabh Dhir

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community