Element ID - but not the ID?

OK… this is done in C# … BUT it’s still a Revit question :smile:

I have a model in place item (rectangle extrusion).
If I take the individual lines I get these IDs

If I take the extrusion inside the MIP family I get this ID:

This is the ID of the Model in Place within Revit:

So what on earth ID is my script logging??
image

        private void OnDocumentChanged(object sender, Autodesk.Revit.DB.Events.DocumentChangedEventArgs e)
        {
            Document doc = e.GetDocument();

            // Check added elements for in-place families
            foreach (ElementId id in e.GetAddedElementIds())
            {
                Element element = doc.GetElement(id);

                if (element is Family family && family.IsInPlace)
                {
                    // Exclude in-place masses
                    if (family.FamilyCategory.Id.Value != (int)BuiltInCategory.OST_Mass)
                    {
                        // Log the usage and include the ID number
                        LogModelInPlaceUsage(doc, id);
                    }
                }
            }
        }

Ah… It wasn’t the instance… Which is confusing because what else is model in place? :person_shrugging:

private void OnDocumentChanged(object sender, Autodesk.Revit.DB.Events.DocumentChangedEventArgs e)
{
    Document doc = e.GetDocument();

    // Check added elements for in-place families (instances)
    foreach (ElementId id in e.GetAddedElementIds())
    {
        Element element = doc.GetElement(id);

        if (element is FamilyInstance familyInstance)
        {
            // Check for in-place family
            if (familyInstance.Symbol.Family.IsInPlace)
            {
                // Exclude in-place masses
                if (familyInstance.Symbol.Family.FamilyCategory.Id.Value != (int)BuiltInCategory.OST_Mass)
                {
                    // Log usage
                    LogModelInPlaceUsage(doc, id);
                }
            }
        }
    }
1 Like