Best approach to programmatically adjustable family

Best approach to programmatically adjustable family

lu_an_jie
Advocate Advocate
817 Views
3 Replies
Message 1 of 4

Best approach to programmatically adjustable family

lu_an_jie
Advocate
Advocate

I am new to Revit programming, got some basics, but experienced in Civil 3D programming. I am working an family that need to have a NURBS with knots and weights controlled by some instance parameters. I am not sure how to organize. 

Can I create an event handler on the change of the parameter triggering a redraw to family instance?

How to ensure that family and app are shipped together?

Would it be better to create the entire family programmatically or extending an existing family?

 

Thanks in advance

Andreas

Regards

Andreas Luka (Lu An Jie)

http://www.luka-consult.de

Creator of the LX-Stair App for Civil 3D
0 Likes
818 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk

Dear Andreas,

 

Thank you for your very valid query. 

 

I would strongly suggest that you gather some experience and knowhow creating Revit families manually before you try to start generating them programmatically.

 

Otherwise, the API will probably make absolutely no sense at all, nor the error messages or anything else either.

 

Figure out how to address your task manually through the user interface before addressing or even thinking about the programming aspects.

 

After that, take a look at some basics on family definitions from the API side of things:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#5

 

Good luck and have fun!

 

Jeremy

 



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

0 Likes
Message 3 of 4

lu_an_jie
Advocate
Advocate

Hi Jeremy,

 

thanks for the immediate reply and advice. I am new to the Revit API programming but experienced Revit user  and developer for Civil 3D add-ins.

I already have a solution with adaptive families (see picture). We already have this scrpted in Dynamo and a C# solution for Civil 3D. As you can see the form it is a complex form for parametric trees based on some major points defining ellipse quarters with interpolated height between for points at the widest perimeter of the crown and super-ellipse quarters between top and bottom point of the crown and points an the widest perimeter. In the family this curves are approximated by 6 points per quarter, but the family is already slow and with multiple instances may lead to really bad user experience. Therefore I rebuild to whole geometry with C# and the Revit API (thanks to your numerous examples in your blog)

My question is more organizational. I could think about several options, but have some unresolved problems

Option I: family is created and parameters changed thru an dialog of an add-in. Then I only need to ship the add-in.

Option II: a base family is provided but can be only changed thru dialog from an add-in.

Option III: base family is provided, using the  Dynamic Model Update framework  to change the model triggered by changed parameter. 

In both option I could set the parameter as shared parameter and than hide them,, Is there a way to change the visibility of the parameters via the API, so I could make them accessible on startup when the add-in is present and hide them on shutdown, so users without add-in getting not confused (parameter change without effect). 

Is there some kind of installer, that can install the add-in and base family? 

 

Thanks for suggestions.

Regards

Andreas Luka (Lu An Jie)

http://www.luka-consult.de

Creator of the LX-Stair App for Civil 3D
0 Likes
Message 4 of 4

jeremytammik
Autodesk
Autodesk

Thank you for your appreciation.

 

You can set the parameter visibility when you create it via ExternalDefinitionCreationOptions.Visible:

 

 

Unfortunately, you cannot switch it back and forth after creation.

 

For installers, please refer to various discussion by The Building Coder on the topic, e.g., this latest contribution on deployment:

 

     



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

0 Likes