LocationPoint.Point not setting the location

LocationPoint.Point not setting the location

sensiblehira
Advocate Advocate
374 Views
4 Replies
Message 1 of 5

LocationPoint.Point not setting the location

sensiblehira
Advocate
Advocate

I am trying to update the the location of my Family Instance by using the following line of code:

LocationPoint.Point = point

but it is not updating the location.

I know I can use other methods to move it but I wanted to know why does this one does not work.

Note: I am trying to update the location using a DocumentChangedEventArgs

and I tried doing this inside a transaction as well, I am not sure if I should use a transaction in DocumentChangedEvent

0 Likes
Accepted solutions (1)
375 Views
4 Replies
Replies (4)
Message 2 of 5

TripleM-Dev.net
Advisor
Advisor

Seems the Point property is a Get/Set, but the doc. states it doesn't support this for each element that has a LocationPoint as location.

 

I actually consider it a "read-only" value, as setting the Z-value what should change the offset from the level of change the level, same for X/Y values for a hosted element, they should then be correctly calculated so it stays hosted??

 

see: https://www.revitapidocs.com/2023/8d81892a-7863-cbec-9148-a0311f3bf2b6.htm 

0 Likes
Message 3 of 5

sensiblehira
Advocate
Advocate

It is not a host based element, and this is working now in update events but it didn't work in document changed. I wanted to know the reason why it works in one and not the other?

0 Likes
Message 4 of 5

TripleM-Dev.net
Advisor
Advisor
Accepted solution

The info in de documentation states it clearly, it's read-only, to update revit object themself use IUpdater.

 

Remarks
This event is raised whenever a Revit transaction is either committed, undone or redone. This is a readonly event, designed to allow you to keep external data in synch with the state of the Revit database. To update the Revit database in response to changes in elements, use the IUpdater framework.

 

https://www.revitapidocs.com/2023/988dd6cf-fcaa-85d2-622d-c50f13917a13.htm 

0 Likes
Message 5 of 5

sensiblehira
Advocate
Advocate

you mean that the document changed event is read only? I am using IUpdater framework and the same bit of code is working there but it was not working under DocumentChanged framework.

0 Likes