Identify annotations coming from exploded cad file

Identify annotations coming from exploded cad file

Anonymous
Not applicable
491 Views
1 Reply
Message 1 of 2

Identify annotations coming from exploded cad file

Anonymous
Not applicable

Hi everyone,

 

Is there a way to identify if a line comes from a dwg file that has been exploded in the Revit document or if it is a genuine Revit line?

 

I was initially querying the name and checking if it was starting with the string "IMPORT" as it seemed consistently the case, but the I realised it's not.

 

In this case, I imported a .dwg file in an empty Revit model, I exploded it, and then I tried to collect the imported lines but my program found 3 or 4 of them. I then tried to see what was going on with the Revit Lookup (thanks Jeremy!) and I found out that:

- the name of the line didn't start with "IMPORT",

- I couldn't find any property whatsoever suggesting that that line wasn't created in Revit but in autocad and then imported.

 

To me it looks like once the cad file is exploded, Revit doesn't know anymore if the line is a Revit line or an imported one.

Or am I missing something?

 

Screenshot of the properties below:

image.png

 

Thanks for your suggestions!

 

Andrea

0 Likes
Accepted solutions (1)
492 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear Andrea,

 

Thank you for your query and appreciation.

 

I believe your analysis is correct, and "once the cad file is exploded, Revit doesn't know any more if the line is a Revit line or an imported one."

 

In fact, the explosion may simply generate genuine new Revit model curve elements, whereas the initial import does not.

 

If that is the case, then the new Revit model curve elements are added to the database during the process of explosion.

 

If that is so, then you can easily keep track of the by subscribing to the DocumentChanged event immediately before subscribing,. collecting all the added element ids in the event handler, and unsubscribing immediately afterwards.

 

'Afterwards' can be determined by subscribing to the Idling event as well.

 

That would lead to the following sequence:

 

  • Immediately before exploding, subscribe to the DocumentChanged and Idling events.
  • Trigger the explosion.
  • In the DocumentChanged event handler, collect all the added element ids.
  • In the Idling event handler, unsubscribe from both events and process the collected element ids as you please.

detonator.jpg

 

 

Here is an example of using the DocumentChanged event to collect elements added by PromptForFamilyInstancePlacement:

 

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

 

I hope this helps.

 

Best regards,

 

Jeremy

 



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