0

I am controlling the event "application.ControlledApplication.ElementTypeDuplicated" and this event raise after the name of the new type is imputed, but after that I would like to override the result of the dialog box ( ID: "IDD_SYMBOL_ATTRIB") that were raised before the event ElementTypeDuplicated. I already try to get a Object Args and override the result inside the method that is suubscribing the event ElementTypeDuplicated, but is not working. Is there a way of doing this?

Example:

    public void OnElementTypeDuplicated(object o, ElementTypeDuplicatedEventArgs args)
    {
        //doing things 
        duplicatingTypeArgs.OverrideResult(0);

            }
        }
    }

    public void OnDialogDuplicatingELement(object o, DialogBoxShowingEventArgs args)
    {

        if (args.DialogId=="IDD_SYMBOL_ATTRIB")
        {
                    duplicatingTypeArgs = args;
        }
    }

2 Answers2

0

Haven't tested this yet, but how about implementing IUpdater with "Element.GetChangeTypeElementAddition" instead subscribing to the duplicating type event

  • I try to use this, but it seems to produce the same result because the DialogBox "IDD_SYMBOL_ATTRIB" remain open and do not let me make any transaction. I need a way to make a transaction after my Wall Type duplicated. – Tiago Cerqueira Apr 07 '18 at 14:46
  • I use this framework and add a Subtransaction to deal with the changes in the database of the document. I was using the Transaction class and the class was gettig a exception. Therefore we must use this adding a subtransaction too. – Tiago Cerqueira Apr 13 '18 at 13:21
0

You could subscribe to the DocumentChanged event before duplicating the symbol. That will provide you with the element ids of all newly created elements. An example of using that is provided by the place family instance sample.

After the duplication, unsubscribe again.

You can use the Idling event to be notified when the duplication has terminated.

Jeremy Tammik
  • 7,333
  • 2
  • 12
  • 17