Retrieving Newly Created Element Ids

An add-in will often need to retrieve the elements that it just created for further processing.

Frequently, the Revit API method used to create them will return their element ids.

Sometimes, that is not the case.

We already discussed a simple and effective method to retrieve all newly created elements following a call to the PromptForFamilyInstancePlacement method by subscribing to the DocumentChanged event just beforehand in the discussion on placing family instances.

Now this topic arose again in a couple of cases and brought some other aspects to mind:

Using the Element Lister

The element lister provides an easy way to discover element relationships between related objects that are added to Revit by certain operations.

It is included in AdnRevitApiLabsXtra, the ADN Revit API Training Labs including Xtra.

All it does is grab all elements in the entire database and list whatever properties you are interested in, e.g., element id, category, level, .NET class, etc.

Then you can use a Unix diff tool to compare states before and after doing your thing.

It can be well combined with the built-in parameter checker BipChecker to explore the properties in further depth.

Of course, the most intimate database exploration requires a live read-evaluate-print console.

Consecutive Element Ids

Using any of the techniques listed above, you will quickly determine that Revit element ids are basically consecutive numbers.

There is no guarantee for this, of course, and they can be mixed up by work-sharing operations.

They can only be used to identify an element within one single Revit document.

Because they are assigned consecutively, Revit automatically generates many undocumented ElementId relationships.

For more persistent identification, a UniqueId is recommended.

For the sake of completeness, Revit elements have two identifiers:

We discuss their uses in lots of places, e.g., understanding the use of the UniqueId.

For connecting with an external database, I would suggest using the UniqueId.

One simple sample that shows the whole connection strategy is provided by the FireRatingCloud add-in.

Retrieving Recently Added Elements

So let us summarise the above again to answer the Revit API discussion forum thread on how to get a merged part after merging with some parts and the StackOverflow question on Python Revit Part.Utils how to get append the results out:

Question 1: I have merged some parts using PartUtils.CreateMergedPart.

The output is not a Part, but a PartMaker.

I need a part output.

Is there any way to get a merged part object?

Question 2: I am using PartUtils.CreateParts to create parts and would like to collect the results as a list of element ids.

How can I achieve that, please?

Answer: As said above, you can subscribe to the DocumentChanged event just before calling CreateParts, and unsubscribe just afterwards.

That will tell you all the element ids added to the database during the call.

This is demonstrated in the discussion on retrieving newly placed family instances.

Merge parts

AEC Job Openings in Munich and Elsewhere

I see Autodesk offering several AEC related job openings.

Below are two located in Munich, Germany, for offsite and home office.

For more, please check the Autodesk job search site.

Industry Program Manager, AEC

Requisition ID: 18WD26910

Are you interested in a marketing job at Autodesk and wondering if this is the right one? Start by answering these five questions:

If you said yes to all these questions, you may be the perfect fit for the role of Industry Program Manager for AEC (Architecture, Engineering, and Construction).

Position Overview

This is a unique individual contributor position at Autodesk. Your job is to make the EMEA cross-functional marketing teams (Account-based Marketing, Lead Gen Marketing, Digital Direct, Channel Marketing) successful by being the interface between them and the global industry strategy teams. You will coordinate industry strategy, programs and assets across the different sales channels (ABM, Digital Direct, Territory).

You will work with smart, global industry teams that are responsible for building and managing marketing programs and campaigns for our AEC industries. It will be your mission to:

It requires a unique combination of marketing experience, business acumen, industry know-how, project management, communication, and leadership skills. And at the heart of it, you have love to get things done.

Responsibilities

Minimum Qualifications

BIM Implementation Consultant

Requisition ID: 17WD25466

Position Overview

As a BIM Technical Consultant, you will be essential for working directly with our customers and developing/contributing to their BIM implementation strategy (in collaboration with our sales, consulting delivery and business development teams) for our major account customers.

The position combines your pre-sales and post-sales consultancy skills, your construction industry experience, your technical and professional know-how, and your passion for educating customers on Autodesk’s Construction BIM solutions.

Responsibilities

Minimum Qualifications

Preferred Qualifications