• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Revit API

    Reply
    Contributor
    Posts: 15
    Registered: ‎07-01-2012

    API Newbie - Family 'Signature' functionality

    143 Views, 1 Replies
    08-20-2012 05:45 PM

    Hi all,

     

    I'm a very green beginner working my way through the Introduction to the Revit API. I have a little bit of programming experience (dangerous! - Does Commodore 64 BASIC count?) so I have some ideas about how I might go about what I want to acheive.

     

    Firstly - are there any API plugins out there that do what I want to do? (I haven't seen any, so I'm asking here)

     

    Goal:

    1. A 'signature' field within a family / family:type that shows the family is 'official'.
    2. This field should be something like a concatenation of the %username% from Windows and the current Date.
    3. The field should ONLY be updated by an API command - ie, something you click on the Ribbon.
    4. This API command is  only visible for certain users (me in this case!) - easy to do, don't install the plugin on workstations that dont need it
    5. The field should be invisible to un-blessed users
    6. The field should be active for a view filter - so you can create a view with 'un-blessed' (unsigned) families shaded in colour to highlight them
    7. The field should be BLANK if a user edits any family in any way - even a previously 'blessed' family

    We're not trying to track who is creating crap families (we know who they are, anyway) we are just trying to sift the wheat from the chaff.

     

    I can think of ways to do items 1-4 that are not much beyond what you can do 'by hand' with a Shared Parameter.

    Point 5 makes me think the Data Storage Object might be the way to go...

    Point 6 - this would likely have to be a purely API thing - check for DSO from point 5, apply shade-by-element in a new view.

    Point 7 - this is what stumps me. I can't think of a way to do this except a 'silent' API function that captures an 'un-blessed' user performing a family edit (which in itself is a bit tricky to define) and clearing the DSO field (if it exists).

     

    I'm a bit hesitant to use an API function like that due to my low skill level; 'script-like' functions I think I can cope with, but 'triggered' functions make me feel like I am treading in far deeper water...

     

    Some alternative to the above I have thought of:

     

    • Using GUIDs - are the Revit GUIDs based on a trackable seed (such as MAC address) that could be filtered? Would any family edit result in an 'unblessed' GUID being inserted into the family?
    • Lockable Family Parameters - that vanish on edit if not done by a 'blessed' user?

    We have currently implemented a system of putting hashed MD5 keys into the Type Comments field of each family, generated from a concatenation of family:typename:salt. This is entirely manual, with family:typenames exported, converteed to Excel, hashed, copied by hand back into families. The checking process is similar - export family:typename, import to Excel, compare MD5 key saved with family to 'correct' MD5 key - a mismatch indicates a high probablity of a user-created family. Users aren't going to know how to generate a valid MD5 key, as I 'salt' the keys with another secret value as well.

     

    It works, to a point - if the user modifies a family:type but leaves the typename unchanged edits can slip through  - but mostly this process works, as most people seem to do a 'duplicate type' which results in a family:typename1 which then fails the MD5 check.

     

    The problem is that this entire process is

    1. tedious
    2. boring
    3. difficult
    4. imprecise
    5. all of the above.

    The API seems to be the way to go, but it's a big step to learn it!

     

    By the way, we have a library of 4,500 objects we are trying to maintain which is why user-created itmes are such a big problem.

     

    I have thought about completely disabling the ability to create/edit families but that seems a little bit too restrictive, and besides that we do (oddly enough) allow in-place families - they are easy to spot and filter out.

     

    Any suggestions, or is there an App put there that does all this for me?

     

     

    Please use plain text.
    ADN Support Specialist
    Posts: 142
    Registered: ‎08-20-2007

    Re: API Newbie - Family 'Signature' functionality

    08-23-2012 03:24 AM in reply to: aesdaile.w

    Dear aesdaile.w,

     

    Please take a long and deep look at the ample getting started material, and then come back and ask again:

     

    http://thebuildingcoder.typepad.com/blog/2012/07/obj-model-exporter-with-transparency-support.html#4

     

    Thank you!



    Jeremy Tammik
    Developer Technical Services
    Autodesk Developer Network
    The Building Coder

    Please use plain text.