Converting Existing Family File to Code Representation for Dynamic Regeneration

Converting Existing Family File to Code Representation for Dynamic Regeneration

Anonymous
Not applicable
616 Views
3 Replies
Message 1 of 4

Converting Existing Family File to Code Representation for Dynamic Regeneration

Anonymous
Not applicable

My whole difficulty here may lie in not knowing the right keywords to search and find an existing solution to this problem, but at the very least, hopefully a link from this post makes it easier for someone else to find later.

Scenario: I'm developing an add-in for in house use that requires a certain set of families present in order to function correctly. Currently for the sake of simplicity I've developed a couple families I'm using for testing, but after deploying it to departmental users, I know I will want to create more families compatible with the tool and make those available to users. I'm trying to think ahead now to build the tool in a way to keep it scalable and easy to maintain in parallel with revisions and additions to the families. It seems ideal to simplify this process by integrating the family content directly into the add-in rather than maintaining and distributing as a separate set of versioned family files. I imagine doing this by having routines in the add-in that can generate the families from scratch and (re)place them in project files. Since the families are dissimilar, limited in quantity, and because I may have users creating families and sending them to me for integration with the add in, it makes more sense to author them initially using the UI rather than programmatically.

 

Question: Is there a means to go from an existing family file to a programmatic representation? i.e. a chunk of code that can be used to generate that family from scratch?

0 Likes
Accepted solutions (1)
617 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk
Accepted solution

Good idea.

 

Very tricky, I would think.

 

In my book, creating a family or any other kind of hard-coded content in a proprietary format is a mistake to begin with.

 

When I create content, I do so in a parametrically driven and programming code based text format that can be stored in a database together with sets of driving parameters to generate content in any format you like using a back-end interpreter and generator, as described a couple of times by The Building Coder:

 

https://thebuildingcoder.typepad.com/blog/2017/01/happy-new-year-c-crypto-and-content.html#4

https://forums.autodesk.com/t5/revit-api-forum/remaking-cad-objects-necessary/m-p/6752234

 



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

Message 3 of 4

Anonymous
Not applicable

Jeremy, thanks for the prompt response. I was hopeful but it sounds like I was barking up the wrong tree.  Once one is aware of the possibility of creating platform-agnostic content using a database and the method you describe, it's obvious that it's superior. But if my limited experience is representative, few small and midsize design firms have staff with the technical background to implement that approach and their family content is often a grab-bag mix sourced from manufacturers, created manually in house, poached from former employers' libraries, etc.
Since half the families of relevance to my project are generic annotations and consequently should have fairly simple make-ups and little in the way of interdependencies, I may play around with a "reverse engineering" approach and at the least learn more about the Family Creation section of the API in the process. For the model components, I'll start working on a means to develop the rfa's programmatically as well as methods for validating and if needed modifying existing rfa's to make them compatible with the addin.
Links for others coming to this thread:

Family API Topics on the Building Coder

Revit Family API Labs on ADN-DevTech's GitHub

0 Likes
Message 4 of 4

jeremytammik
Autodesk
Autodesk

My pleasure entirely, and thank you for the appreciation.

 

You can certainly extract all the annotations, and also do a fair amount of reverse engineering.

 

One challenging task for reverse engineering would be to automate the understanding, extraction and programmatic regeneration of complex geometry. If your case is different, or in any case, you may very well be able to achieve all that you wish.

 

In any case, I recommend that you focus less on the RFA generation and more on a totally generic system for generating them that can also be used to generate other file formats as well.

 

I am very interested to hear where you end up taking this.

 

Good luck!

 



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