Remove Warning/message Duplicate Types

Remove Warning/message Duplicate Types

Anonymous
Not applicable
1,971 Views
3 Replies
Message 1 of 4

Remove Warning/message Duplicate Types

Anonymous
Not applicable

Hi

I am copying Objects from a linked Model, but I got a lot of "warnings" about Duplicate Types, I want to suppress this message.

I have tryied the legendary "WarningSwallower" from Mr, J. Tammik, but the "Duplicate Types" message is not a Warning.

How do I remove this message ?

Regards

Anders

0 Likes
Accepted solutions (1)
1,972 Views
3 Replies
Replies (3)
Message 2 of 4

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @Anonymous ,

Simple set the copy options to ignore such warning messages

 

CopyPasteOptions options = new CopyPasteOptions();
Options.SetDuplicateTypeNamesHandler(new MyCopyHandler());

The class MyCopyHandler is an implementation of the IDuplicateTypeNamesHandler

public MyCopyHandler : IDuplicateTypeNamesHandler
{
   public DuplicateTypeAction OnDuplicateTypeNamesFound()
   {
      return DuplicateTypeAction.UseDestinationTypes;
   }
}

 

I hope this helps.

If this helped solve your problem please mark it as solution, so other users can get this solutions as well

 

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 4

ed_sa
Enthusiast
Enthusiast
public MyCopyHandler : IDuplicateTypeNamesHandler
{
   public DuplicateTypeAction OnDuplicateTypeNamesFound()
   {
      return DuplicateTypeAction.UseDestinationTypes;
   }  this didn't sovle teh problem. it kept asking ok or cancel on duplicate type window

0 Likes
Message 4 of 4

laurenkschmidt
Participant
Participant

I just had this issue, and then realized I wasn't connecting the options in the copy command. Silly mistake, but easy to make if you already have your copy working. So, after you make the options, be sure that you're using them. 

CopyPasteOptions options = new CopyPasteOptions();
Options.SetDuplicateTypeNamesHandler(new MyCopyHandler());

ElementTransformUtils.CopyElements(source, elemIds, destination, transform, options);

 

0 Likes