Revit API Assembly members validation

Revit API Assembly members validation

h.nijboerWAJKH
Explorer Explorer
766 Views
2 Replies
Message 1 of 3

Revit API Assembly members validation

h.nijboerWAJKH
Explorer
Explorer

Hello,

 

I encountered some strange behavior when adding elements to an assembly. 

In Revit when I try to add an element to an existing Assembly which has Phase 'Created', and the element which I try to add has a different Phase I get a message: 

 

Selected Element(s) cannot be added to the assembly. Elements must have the same phases as the assembly to be included in the assembly.

 

However when I am updating the same AssemblyInstance with new members using AddMemberIds method on the AssemblyInstance it works:

assemblyInstance.AddMemberIds(elementIdsToAddToAssembly);

 

When I am selecting the elements in the UI I see different phases for elements in the same assembly.

This shouldn't be possible I think?

 

Greetz,

0 Likes
767 Views
2 Replies
Replies (2)
Message 2 of 3

jeremytammik
Autodesk
Autodesk

That sounds as if it should not be possible, indeed.

 

Please submit a minimal reproducible case that we can share with the development team for analysis and possible rectification:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 



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

0 Likes
Message 3 of 3

h.nijboerWAJKH
Explorer
Explorer

Here you have my Revit test file with some specific test code for the attached Revit file..

 

        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            var document = commandData.Application.ActiveUIDocument.Document;

            // Assembly instance with CreatedPhase: Phase 1
            var assemblyInstance = (AssemblyInstance)document.GetElement(new ElementId(296092));

            using (var transaction = new Transaction(document))
            {
                transaction.Start("Combine walls");

                // Wall with CreatedPhase: Phase 2
                assemblyInstance.AddMemberIds(new[] { new ElementId((296124)) });

                transaction.Commit();
            }
            return Result.Succeeded;
        }

 

0 Likes