Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Soulless_ik
797 Views, 1 Reply

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

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.

 

1 REPLY 1
Message 2 of 2
jeremytammik
in reply to: Soulless_ik

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report