The Revit SDK Contents

The Revit SDK or Software Developer Kit is included in every Revit product installation CD. You can search the installation for a file named sdk.zip. In Revit 2009, it is named ‘Revit 2009 SDK.zip’ and located in a subdirectory ‘Utilities\Common\Software Development Kit’. It can also be downloaded from the public Revit developer center which can be reached via http://www.autodesk.com > Communities > Developers > Products & Technologies > Revit Architecture and Revit Structure, or from the members-only ADN web site .

The contents of the Revit SDK are basically for documentation purposes only. All that is really needed to allow a Revit plug-in to run is the Revit API .NET assembly RevitAPI.dll, which is always present in every Revit installation and located in the Program subfolder, the same place as Revit.exe itself. Additionally, you need a development environment to compile your plug-in. The standard development environment we normally use is Microsoft Visual Studio. You can also use the free Visual Studio express version with reduced functionality, or any other .NET development environment. Alternatively, in Revit 2009, you can use the Visual Studio Tools for Application or VSTA environment which is included with the Revit product instead of compiling an external .NET plug-in assembly.

Let us look at the contents of the Revit SDK in more detail. Here are the documents present in the top level directory

  • Read Me First.doc
  • Getting Started Revit API 2009.doc
  • Add-On Applications and Non-Power Users.doc
  • Revit API Diagram.dwf
  • Revit SDK License.rtf
  • Revit VSTA User Manual.pdf
  • RevitAPI.chm

‘Read Me First.doc’ provides a brief overview over the SDK contents and is the first place to start exploring. The next step is ‘Getting Started Revit API 2009.doc’, which explains the basic paradigms and architecture, how to create a Revit plug-in, and many further details. A graphical overview of the API class hierarchy is provided by ‘Revit API Diagram.dwf’. The license is provided in a separate file, and a detailed user manual for VSTA, the Visual Studio Tools for Applications, which can be used to create macros inside of Revit instead of loading them as external plug-ins separately compiled in an external development environment.

The main help file is RevitAPI.chm, which lists all the classes provided in the API and their properties and methods. It does not do much to explain how these classes work together to solve specific programming tasks. For that, the best source of information is the collection of samples, which we will discuss in detail later.

There are two more documents to mention in this context, even though they are not present in the standard SDK release:

  • Guide to placing Family Instances with the API.doc
  • Revit_2008_api_user_manual.pdf

The guide to placing family instances is a recent addition to the Revit SDK update. Unfortunately, it did not make it into the Revit 2009 web update 1 in June 2008, so it will be added to the next version of the SDK. Currently, it is available from the ADN web site in the Revit knowledgebase or in the updated version of the Revit SDK web update 1 which was posted to ADN after the public release of the Revit product web update 1. For non-ADN members, I have also added a copy of it right here for 2009 and here for 2008.

The Revit API user manual is a work in progress and is also planned to be included in the standard SDK at some future point in time. Currently, the draft version is available from the ADN web site Revit 2008 Samples and Documents page. Again, here is a copy of it for non-ADN members.

In addition to the documents listed above, the SDK root folder also includes the following subdirectories:

  • API Changes
  • Add-in Manager
  • Revit Structure
  • VSTA Samples
  • Samples

API Changes lists the changes between the current and the previous version of the API and is useful for migrating existing applications. The changes are documented in an xml file Added.xml and displayed through an XSLT generated view. XSLT stands for XSL Transformation or eXtensible Stylesheet Language Transformation. An XSL style sheet transforms the XML data into a specific view in the browser.

The Add-in Manager is a utility application for loading and managing plug-ins and is accompanied by its own documentation.

A set of additional documentation is provided specifically for Revit Structure in an own folder. Some VSTA samples are provided.

Finally, we have the largest component of the SDK by far, the SDK samples. The SDK samples provide over a hundred real live examples of how the API classes work together to solve specific programming tasks, ranging from the very simple to pretty complex.


Comments

50 responses to “The Revit SDK Contents”

  1. Jeremy Tammik,
    I am new for Autodesk Revit, But i have 4 yrs of exp in Autocad Vlisp, VBA, C#.Net, ObjectArx. Now i want to create new family in revit using .Net API, i don’t know it can be done or not?
    i searched in the Revit SDK samples, But i did’t found the samples program. Please help me “How to create new family in Revit using .Net API”.
    Thanks in advance.
    Senthil Prabu B R

  2. Hi Senthil,
    Thank you for your suggestion. Unfortunately, I am sorry to say that the Revit API currently does not provide any functionality for creating families.
    Best regards,
    Jeremy

  3. Senthil Prabu Avatar
    Senthil Prabu

    Is there any other alternate way to create Revit family at runtime and utilize that in the active project? Please give me some idea.
    Thanks,
    Senthil Prabu B R

  4. Hi Senthil,
    Revit currently provides no API at all within the family editor. This feature is very high on the developer wish list. You can generate a new family document using app.NewFamilyDocument(), and you can populate it from a command running within another document using code like the following:
    public void createProfileFamilyDoc()
    {
    Application app = mRevit;
    Autodesk.Revit.Creation.Application creApp = app.Create;
    // draw some lines forming a unit square in the XY plane:
    CurveArray curves = new CurveArray();
    XYZ startPt = new XYZ();
    XYZ endPt = new XYZ();
    startPt.X = 0.0;
    startPt.Y = 0.0;
    startPt.Z = 0.0;
    endPt.X = 10.0;
    endPt.Y = 0.0;
    endPt.Z = 0.0;
    curves.Append( creApp.NewLineBound( startPt, endPt ) );
    startPt.X = 10.0;
    endPt.Y = 10.0;
    curves.Append( creApp.NewLineBound( startPt, endPt ) );
    startPt.Y = 10.0;
    endPt.X = 0.0;
    curves.Append( creApp.NewLineBound( startPt, endPt ) );
    startPt.X = 0.0;
    endPt.Y = 0.0;
    curves.Append( creApp.NewLineBound( startPt, endPt ) );
    Plane basePlane = creApp.NewPlane( XYZ.BasisZ, XYZ.Zero );
    mFamilyDoc.BeginTransaction();
    Autodesk.Revit.Creation.Document creDoc = mFamilyDoc.Create;
    SketchPlane plane = creDoc.NewSketchPlane( basePlane );
    ModelCurveArray mc = creDoc.NewModelCurveArray( curves, plane );
    mFamilyDoc.EndTransaction();
    mFamilyDoc.SaveAs( mFamilyFileName );
    mFamilyDoc.Close();
    }
    However, you will probably run into some severe limitations very quickly. For a deeper discussion, I would suggest trying the Revit API discussion group at http://discussion.autodesk.com.
    Best regards,
    Jeremy

  5. Senthil Prabu Avatar
    Senthil Prabu

    Hi Jeremy,
    Thanks for the instant replay, I am able to draw model lines in the family editor using API. But now i want to draw Solid Extrusion in family editor. Please help me.
    Thanks & Regards,
    Senthil Prabu B R

  6. Hi Senthil,
    Glad you liked it! Unfortunately, as said, there is basically no support for drawing anything at all through the API in the family editor. Regarding extrusions, the situation is even more limited … the Extrusion class is read-only, so to speak. It is derived from GenericForm, which can be queried for a generic form for use in family modelling and massing. The Revit API currently provides no methods at all for creating these kinds of shapes. So I am completely unable to help you any further in this. Sorry about that. Good luck finding an alternative solution!
    Best regards,
    Jeremy

  7. Hi Jeremy Tammik
    Hi i am new in revit sdk. Now i want to different between lenght and cutlenght. and also need a actual lenght of the family object, i don’t know it can be done or not?
    i searched in the Revit SDK samples, But i did’t found the samples program. Please help me “How to find the family object lenght. e.g., family library include the more than two material. In material takeoff display the common parameter list. I need actual start and end point of each material. Please help me”.
    Thanks in Advance.
    Dharanidharan R

  8. Hi Dharanidharan,
    I’m aftraid I do not know of any solution offhand. All I can think of is to explore the geometrical representation in detail. Maybe different materials are represented on separate faces, and you can query and analyse the dimensions of each face.
    Good luck and best regards, Jeremy.

  9. Dharanidharan Avatar
    Dharanidharan

    Hi Jeremy Tammik
    Thanks for your replay. One additional question. How to retrirve the current display unit (Like Feet and Fractionaly inch its display 1′-5 1/2″) how to display this. and how to change the current display unit in api.
    I have the project unit sample. But it can raise some error. “RiseRunOrAngleType does not exist in the Enum Namespace”. I am straggle this point. please guide me.
    Regards
    Dharanidharan R

  10. Dear Dharanidharan,
    Sorry, I cannot answer your query offhand. Right now I am travelling and have no possiblity to explore it in depth.
    Best regards, Jeremy.

  11. Dharanidharan Avatar
    Dharanidharan

    Hi Jeremy Tammik
    I Hope you can return your trip. How to duplicate the family type name in revit sdk.
    Regards
    Dharanidharan R

  12. Dear Dharanidharan,
    Thank you, I returned, and now I am on the road once again … I am not completely clear on the meaning of your question … if you are asking how to duplicate a family symbol, then the question is answered by
    http://thebuildingcoder.typepad.com/blog/2008/11/creating-a-new-family-symbol.html.
    Best regards, Jeremy.

  13. Dharanidharan Avatar
    Dharanidharan

    Hi Jeremy Tammik
    Thanks for your replay. Its my previous query. I Can retrieve the current display unit. but i dont know how to change unit (i.e., Project Units -> Format -> Units -> Decimal feet to some other). set command posible to change the units? help me.
    Regards
    Dharanidharan R

  14. Dear Dharanidharan,
    Please refer to the ProjectUnit SDK sample mentioned in
    http://thebuildingcoder.typepad.com/blog/2008/09/units.html
    It lists and sets units and format options. In more detail, it implements an external command which lists all the units in the current project and displays their format information; displays the decimal symbol type of the current project units, which can be set to comma or dot; and displays the slope type of current project units, which can be either rise or angle.
    Cheers, Jeremy.

  15. Hi Jeremy,
    I’m just starting with the revit api/ide, so maybe a trivial question, how would you write a ‘purge unused materials’ program. My project files often get overloaded with all sorts of unwanted materials from loaded families or pasted elements so that it becomes a hassle to find and select those materials needed.If its easy for you could you provide the code for this?
    Thanks, Michael

  16. Hi Michael,
    Sounds like a sweet little project. I’ll make a note of it. If anyone has a contribution to make, feel free to do so and I will be happy to publish it. It will probably be a while before I get around to it … unless I use it right here and now as an example in the current training … I wonder whether there is one single parameter that is used to store the current material of an element? If so, it would be a simple matter of implementing a filter that selects all elements with an entry for that parameter and identifying all unique values. All other material definitions can be eliminated. Maybe.
    It would help if you could provide a good sample project as a starting point and list what materials are used in it and which should be eliminated.
    Cheers, Jeremy.

  17. Hi Jeremy,
    I would like to create a solution which searches the current .rvt for any/all in-place families and produce an html report of these items. Is there a way to use the filtering capabilities for this?
    The reason for this is because it’s our experience that in-place families seriously degrade performance. We’d like to identify in-place instances and see if they can be recreated as external families.
    Thank you.

  18. Hi Michael,
    Sounds like another great idea for a sweet and doable little project. I’ll make a note of this as well. If anyone has a contribution to make, please feel free to do so and I will be happy to publish it. It will probably be a while before I get around to it. It would help if you could provide a sample project as a starting point with a couple of in-place families and a specification of what the list that you expect as a result should look like. Actually, even better than a sample project would be a journal file that creates such a project from scratch.
    Cheers, Jeremy.

  19. Hello,
    I have both a sample file and the journal file. What’s the best way to send it to you?

  20. Hi Jeremy Tammik,
    Now i am create sheets for all drafting view at runtime. i can do it. but it has raised one problem. for. e.g. Drafting view (E20) it create the only one sheet at a time then i can create the another sheet with same Drafting view (E20) it show the error (“The View E20 is not appropriate, or it was placed in another sheet”). Then i can change the Drafting view
    i.e. E20->right click-> Duplicate view-> duplicate with detailing.
    change E20 -> E20-A. Then i can create the sheet it will be create. Right now i will create Drafting view (Duplicate with detailing ) at run time. How do i will make change this. pls guide me.
    I can create 50 sheet at runtime with same Drafting View (E20) and different operation and cut length.
    Regards,
    Dharanidharan R

  21. Hi Michael,
    I got the following feedback about determining if a family is in-place or not:
    You can use the fact that the doc.EditFamily throws exception for in-place families. For other elements either EditFamily will return a valid document or fi will be null.
    System..::.ArgumentException is thrown when the input argument-“loadedFamily”-is an in-place family.
    foreach (Autodesk.Revit.Element e in collection)
    {
    FamilyInstance fi = e as FamilyInstance;
    if (fi != null)
    {
    try
    {
    Document famDoc = doc.EditFamily(fi.Symbol.Family);
    }
    catch
    {
    MessageBox.Show(“In Place Family”);
    }
    }
    }
    Cheers,
    Adam

  22. Dear Dharanidharan,
    I am glad the creation of sheets for drafting views works for you. I understand that you have a problem when you try to create multiple sheets displaying the same view. You can work around this problem by duplicating the view manually using the context menu. You are now asking how to duplicate the view through the API to avoid the manual step. Is that correct?
    I do not know offhand whether it is possible to duplicate a view through the API. How have these views been generated? If they were generated through the API as well, it might be simpler to generate all the required copies of them right from the beginning to avoid the need to duplicate them later.
    Cheers, Jeremy.

  23. Hi Jeremy Tammik,
    Do you have any idea about duplicate a view through API. If its possible pls guide me.
    Regards,
    Dharanidharan R

  24. Dear Dharanidharan,
    I assume you are aware of the various methods available to create new views on the Autodesk.Revit.Creation.Document class, e.g.
    ViewDrafting NewViewDrafting()
    ViewSheet NewViewSheet( FamilySymbol titleBlock )
    View3D NewView3D( XYZ viewDirection )
    ViewPlan NewViewPlan( string viewName, Level, ViewType )
    ViewSection NewViewSection( BoundingBoxXYZ )
    There are also some samples in the Revit SDK demonstrating how to make use of some of these methods, e.g. AllViews, CreateViewSection, and FrameBuilder.
    However, none of these exactly address your need of exactly duplicating an existing view. I asked the development team for advice on this issue, and their reply is that unfortunately there is currently no way to duplicate a view through the API, and there is no known work-around to do it either (duplicate/duplicate with detail/duplicate as dependent). Sorry for the bad news.
    Cheers, Jeremy.

  25. Hi Jeremy Tammik
    Thanks for your suggestion, now i’d hold that process. I need another help to you. How to bring the View (3D viwe or detail view) in Picture box (Front End Form). You have any idea about that. please guide me.
    Thanks in Advance
    Dharanidharan R

  26. Dear Dharanidharan,
    Do you mean how to redraw some of the Revit model geometry in your own dialogue’s picture box? There is no direct support for that in the Revit API, but some of the Revit SDK samples demonstrate rudimentary approaches. Some of them are mentioned in the discussions on geometry viewers and workarounds for picking a point:
    http://thebuildingcoder.typepad.com/blog/2008/09/geometry-viewer.html
    http://thebuildingcoder.typepad.com/blog/2008/10/picking-a-point.html
    Cheers, Jeremy.

  27. Hi Jeremy Tammik,
    How can i get Material properties (Identity). Now i want to create, edit or remove the materials names on runtime. and also share the material identity property. you have any idea about this, help me.
    Dharanidharan R

  28. Justin Avatar
    Justin

    Jeremy,
    After looking through the documentation, I am correct in stating that it is not possible with the API to create new ViewTypes? This appears to be possible in the UI (by renaming the type in the type properties dialog). Thanks!
    Justin

  29. Dear Justin,
    In the API, the ViewType is an enumeration. You cannot add new entries to that except by recompiling Revit.
    Cheers, Jeremy.

  30. Hi Jeremy Tammik,
    How to export current view in image (jpg or bmp) you have an idea. pls share with me.
    Regards
    Dharanidharan

  31. Dear Dharanidharan,
    Thank you for your query. The export options provided by the Revit API currently include gbXML, DGN, DWF, DWG and FBX, as you can see from the list of overloads of the Document.Export method. Screen snapshots and bitmap formats are not included.
    One option that comes to mind, however, is that you can easily implement your own screen snapshot utility as part of your Revit plug-in. I googled for the search keys “.net screen snapshot”, and the following first two hits which appeared both include source code for a screen snapshot utility:
    http://www.developerfusion.com/code/4630/capture-a-screen-shot/
    http://www.vbdotnetheaven.com/Uploadfile/mgold/ScreenCaptureUtilityVB11162005063518AM/ScreenCaptureUtilityVB.aspx
    Cheers, Jeremy.

  32. Hi Jeremy Tammik,
    Now i am create “Detail item” in Elevation view (East, West, North or South). But i am not able to create the that view, its created only on level (Plane View Level 1). And i am also try Model Line (2009 sdk sample) it also create in Level based view only. Not in Elevation view.
    Now i’m using “Detail items” based on
    (i) First Create the mLine = Model line (geo_info,current Sketch(Elevation South).
    (ii) Newfamilyinstance(mLine.geomentrycurve,symbol,level, nonstructuraltype)
    In this method correct or not. advice me.
    Another question. How can i create the Dimension, between the two stuctural column
    dynamically. and I’m not understand the “Arrayreference”. how is handle that references. and how to add two column information on Arrayreference.
    Regards,
    Dharanidharan

  33. Dear Dharanidharan,
    I think there is currently a problem creating detail items in anything but plan views, so I am afraid I cannot help you with that. I don’t know off-hand about the detail lines either.
    To create dimensioning, you need to provide references to the underlying geometry. These are obtained from the standard get_Geometry call, where the options argument needs to have the ComputeReferences set to true. Here is an example for a wall element:
    Options opt = app.Create.NewGeometryOptions();
    opt.ComputeReferences = true;
    opt.DetailLevel = Options.DetailLevels.Fine;
    GeoElement geoElement = wall.get_Geometry( opt );
    Look at the external command CmdAddDimensionForRacWall in the geometry portion of the Revit API tips and tricks sample code provided in rac_tips_20090303.zip in the post
    http://thebuildingcoder.typepad.com/blog/2009/03/back-again.html
    Cheers, Jeremy.

  34. Hi Jeremy,
    I see that there was another request for “Purge Unused”. I tried doing that in VSTA but iterating though unused Families and Family Types is a daunting task.
    Thanks, Samir

  35. Dear Samir,
    Looking through previous comments and posts for purge, I discovered that I have actually already mentioned a very simple solution to this which is readily available:
    ‘Purge Unused’ is listed as one of the functions that have been made accessible using AutoHotkey for Revit 2009. That is mentioned in
    http://thebuildingcoder.typepad.com/blog/2009/01/autohotkey.html
    I hope that a similar approach is usable in Revit 2010 as well.
    Cheers, Jeremy.

  36. hi Tammik,
    Autodesk Design Review 2010 chm found in autodesk site. But it don’t any Documentation and pdf.ADR 2010 introduce the Markup api. but i don’t know how it is use(create, retrieve the property of markup dynamically). I know this is not your subject. if you have any idea about this pls tell me. its very urgent.
    Thanks in advance
    Dharanidharan R

  37. Dear Dharanidharan,
    Sorry, no idea whatsoever. Good luck in your search!
    Cheers, Jeremy.

  38. Hi Jeremy Tammik,
    I need some clarification. In CreateBeamsColumnsBraces sample. I give the information on column, beam and etc.
    on external application(Not in revit application, its a stand alone project), and click submit. That information stored in some other database (mdb or txt) file.
    Now i will open the Revit application, fetch the value from that database, load the library family files (initially i have stored in family path(structural column, or beam)), and create Frame or elevation.
    Today onward im start this task. i tried this method onDocumentopen events. it is usefull for me. i need some idea about this task. pls guid me.
    Regards & thanks in advance
    Dharanidharan R

  39. Dear Dharanidharan,
    I think your approach sounds fine. Store the creation data externally, start Revit, fetch the data, load the required families and create the framing. It would be easier to implement this as an external command, though, rather than using the document open event. In any case, I wish you good luck with your project!
    Cheers, Jeremy.

  40. Hi Jeremy Tammik,
    how to call iExternal command on Iexternal application. In earlier post i was said Document open even handler. it not to provider application and when i call any family at runtime. its call repeatedly call that event.
    Simplly im said. i’m open the revit application and click the revit file (its already load the families, like template) then run external commands without any click. it’s make possible, pls guid.
    Regards,
    Dharanidharan R

  41. Vasco Granadeiro Avatar
    Vasco Granadeiro

    Dear Jeremy,
    I need a tool capable of drawing, by programming, parametric models of buildings. By parametric I mean drawing objects (e.g beams) which parameters (e.g. dimensions) are not fixed but depend on another parameters, of the same object or of other objects. Hence, changing one parameter of one object affects other parameters, of the same object or of other objects.
    Can I do this with Revit? If yes, is using VSTA the easier way?
    Thank you.
    Best regards,
    Vasco Granadeiro

  42. Dear Dharanidharan,
    I am sorry to say that you cannot call an external command directly from the OnStartup event handler method of an external application. You can however inside of the OnStartup method set up an event handler for the OnDocumentOpened event, and then install some code implementing your required functionality inside of that. One sample that may be of interest to you in this context is the AutoExecuteOnOpen example described in
    http://thebuildingcoder.typepad.com/blog/2009/07/journal-file-replay.html
    Cheers, Jeremy.

  43. Dear Vasco,
    Yes, you can definitely do this with Revit, and it is exactly what Revit and its API are intended for.
    VSTA is good for learning and experimenting and testing, and also for implementing little personal macros, but for a serious application such as you are suggesting, I would prefer to work in a full-fledged programming environment and create a .NET plug-in instead as described in
    http://thebuildingcoder.typepad.com/blog/2009/04/getting-started-with-the-revit-2009-api.html
    http://thebuildingcoder.typepad.com/blog/2009/09/getting-started-with-the-revit-2010-api.html
    For a simple starting point of creating an entire though minimal parameterised BIM through the Revit API, you can have a look at Lab2_0_CreateLittleHouse in the Revit API introduction labs. It is briefly described in and can be downloaded from
    http://thebuildingcoder.typepad.com/blog/2008/09/selecting-all-w.html
    http://thebuildingcoder.typepad.com/blog/2009/01/walls-and-doors-on-two-levels.html
    Cheers, Jeremy.

  44. Hi Jeremy,
    Now i’m creating the family creation in revit 2010. It’s successfully created. But it could create only for when family document (.rfa) are opened.
    In the same way i can open document(.rvt) -> External Command -> click. Internally i can call “m_revit.OpenDocumentFile(Generic Model.rft)” and m_familyDocument = m_revit.NewFamilyDocument(Generic Model.rft). it can be created. don’t make error.
    My quary is how to load or how to bring family file (.rfa) in project document during run time (without save).
    Regards,
    Dharanidharan

  45. Dear Dharanidharan,
    I assume you are trying to open a document so that it is displayed in the Revit user interface. Unfortunately, that is currently not possible. We have an open wish list item to be able to set the active document through the API.
    Cheers, Jeremy.

  46. Hi Jeremy,
    I could try to this way,
    PrjDoc = m_revit.ActiveDocument // First Active Document
    FmyDoc = m_revit.NewFamilyDocument(“Generic Model.rft”); // Second Active Document
    CreateGenericModel() // FmyDoc create rectangle mode.
    FmyDoc.save()
    string Fname = FmyDoc.Title.Tostring();
    if (FmyDoc.IsFamilyDocument)
    PrjDoc.LoadFamily(Fname);
    Once you have save the family, then it can be loaded on project.
    My query is how to save the perticular path (static or predefined). The user won’t know the path.
    How to create the Model In-place family in revit sdk.
    Regards,
    Dharanidharan

  47. Dear Dharanidharan,
    If you do not want to specify a path for the document, there is no need to do so at all. You can use the overload of the Document.LoadFamily method taking a Document argument instead of a string pathname to a file.
    In-place families are currently not supported by the API at all.
    Cheers, Jeremy.

  48. Hi Jeremy,
    Now i am create (or) modify the family by using Editfamily method. When i was create the Extrusion then stored the each Extrusion Id value (Extrusion.Id.value.tostring()) to the database or notepad. Then i modify the same family, just find the existing extrution with represent id value. it doesn’t find. because each id value differ from database value.
    The different is -1 for each value. i don’t know how it changed the id value. Then i can manually check the RibbonMenu -> Modify -> Element id that value is match with database value. when i was open the family on runtime it will show the -1 different. pls clarify.
    Next, I can create the Extrusion then assign the material name (Glass).
    Materials materials=m_familyDocument.Settings.Materials;
    Autodesk.Revit.Elements.Material GlassMaterial = null;
    GlassMaterial = materials.get_Item(“Glass”);
    foreach (Autodesk.Revit.Elements.Material material in materials)
    if (“Glass” == material.Name)
    GlassMaterial = material; break;
    I’m find the material, but i don’t know how to assign the family(Extrusion) Material parameter.
    Regards,
    Dharanidharan R

  49. Dear Dharanidharan,
    The issue with the element id sounds mysterious to me. The element id should and does retain its value between sessions. There must be something strange in your code there. If you save the integer value of an element id and later reconstruct the element id again, the Document.Element( ElementId ) method should retrieve the specified element from the database again.
    You might also try using the unique if provided by the Element.UniqueId property and provided as an argument to the Document.Element( String ) method, which retrieves an element from the document given a unique id string.
    For setting the material on the extrusion element, you might have a look at the Revit Family Creation API Lab 3, Add Formulae and Materials:
    http://thebuildingcoder.typepad.com/blog/2009/10/revit-family-creation-api-labs.html#3
    Cheers, Jeremy.

Leave a Reply to Jeremy TammikCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading