Get the element created by postcommand

Get the element created by postcommand

SimonaQQ
Advocate Advocate
651 Views
2 Replies
Message 1 of 3

Get the element created by postcommand

SimonaQQ
Advocate
Advocate

Hello,

I used postcommand to create an element, such as revision cloud.
How can I get this?
The way I can think of is to use idling to get the ID of all revision clouds before postcommand, after postcommand, get the ID of all revision clouds again. The complement between them is the ID of the element just created.
I tried this idea and succeeded.
But when the drawing is large enough and there are enough elements, idling will constantly check the elements. Will it affect the performance or efficiency?
Is there any other way?
How do you get the primitives created by postcommand?

0 Likes
Accepted solutions (1)
652 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni
Accepted solution

Yes, there are several other and more efficient ways.

 

One simple solution is to subscribe to the DocumentChanged event before calling PostCommand, like I did when exercising PromptForFamilyInstancePlacement:

 

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

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 3

SimonaQQ
Advocate
Advocate
That is great!
This not only solves the performance problem of idling,
More importantly, it solves the problem that family symbol cannot be specified when postcommand arranges instances.
0 Likes