check multiple instances same place

check multiple instances same place

dante.van.wettum
Advocate Advocate
2,279 Views
5 Replies
Message 1 of 6

check multiple instances same place

dante.van.wettum
Advocate
Advocate

Within one transaction, i am placing multiple familyinstances.

 

After each placement i want to check if there might be a double instance in the same place, and if so, undo that last placement.

It is possible to watch for the exception warning, but this will only prompt on Transaction.Commit, so thats already too late.

 

I dont want to use a separate transaction for each placement either, because it can result in too many seperate transactions (and so too many undo steps).

 

1 workaround would be to get all familyinstances of the one that is getting placed, and each time check the location from the once getting placed with the ones already there, but i assume this will be dramatic for performance.

 

any other ideas ?

0 Likes
2,280 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

May be you can get all the coordinates first then remove duplicate coordinates before placing the instances.

 

Refer here for removing duplicate points:

 

https://forums.autodesk.com/t5/revit-api-forum/distinct-xyz/m-p/7443692#M25644 

0 Likes
Message 3 of 6

dante.van.wettum
Advocate
Advocate

Within my own list its relative easy to handle, and before placing i make sure the list of to-place elements are all on unique locations.

The problem is mostly the moment after placement, i want to buildin a check to make sure the same element wasnt already there. I could have been already placed by hand by the user.

 

Maybe i should just pull a list of all the specific familyinstances and its locations, and crosscheck that against the to-place list.

0 Likes
Message 4 of 6

Anonymous
Not applicable

May be you can share code on how to check unique location? I am looking for a simpler way to do it.

0 Likes
Message 5 of 6

Anonymous
Not applicable

Dear All,

I am currently working on a similiar problem. Did anyone find a solution to this issue? 

Best,

PA

0 Likes
Message 6 of 6

eason.kangEDLV4
Autodesk Support
Autodesk Support

Hi,

 

Before placing a FamilyInstance, you can make line segment based on the placement point of the FamilyInstance, then do Bounding Box Intersection to check if there is an existing element in the same place. Here is a blog reference for doing this:

http://thebuildingcoder.typepad.com/blog/2010/12/find-intersecting-elements.html

 

Hope it helps. 

 

Cheers,


Eason Kang
Developer Advocate
Developer Advocacy & Support Service
Autodesk Platform Service (formerly Forge)

0 Likes