How to get a merged part after merging with some parts?

Soulless_ik
Contributor
Contributor

How to get a merged part after merging with some parts?

Soulless_ik
Contributor
Contributor

I have merged some parts with this code.

 

 

 

var findParts = PartUtils.FindMergeableClusters(Doc, PartIDs);

 

findParts.ToList().ForEach(p =>
{
    if (p.Count == 1) return;
    PartUtils.CreateMergedPart(Doc, p);
});

 

 

But output of 'PartUtils.CreateMergedPart' is not a Part. It's a  'PartMaker'

 

I need a part output.

 

Is there any way to get a merged part object?

 

Thank you.

 

0 Likes
Reply
Accepted solutions (1)
799 Views
1 Reply
Reply (1)

jeremytammik
Autodesk
Autodesk
Accepted solution

You can subscribe to the DocumentChanged event just before callingCreateMergedPart, and unsubscribe just afterwards:

 

http://www.revitapidocs.com/2018.1/988dd6cf-fcaa-85d2-622d-c50f13917a13.htm

 

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

 

This is demonstrated here:

 

http://thebuildingcoder.typepad.com/blog/2010/06/place-family-instance.html

 

Cheers,

 

Jeremy



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