Irne,Sorry, I think you misunderstood. I was using the 2 users working on the same thing as an analogy. The API sees 2 threads in the same light - that's why you sometimes get those issues where you can't edit something within a reactor (i.e. the reactor already has a read-lock on the entity, so your call-back function is not allowed to create a write-lock on the same entity when the reactor calls it).
I don't imagine the algorithm design would allow user interaction while the transaction was active.
Gut level feel ; I wouldn't allow the lisp to hold the transaction open between calls , even if it could be done simply. Cleaning up after an error may make it not worth the error.That is the main principle behind transactions: i.e. if an error occurs your lisp code should catch it through the *error* function and call the transaction's dispose method so it rolls-back any changes which has already been done. Else the transaction is committed when no error occurs, thus the database is updated only when the function has completed correctly.
Frankly, customisers currently don't make use of error trapping adequately .. I'd be bold enough to suggest that the majority don't understand how they work.I'm with you on that yes. Too many LSP's which cause stuff like OSMode / Highlight to go all wonky. Same thing could happen with these transactions I guess: i.e. user presses Esc, lisp fails to dispose/commit transaction ---->> user's unable to continue working in DWG as he's unable to modify anything until the transaction is ended (which will never end).
You're suggesting that another level of complication be added into the mix.
For me, it would be more beneficial adding .net functions that take lisp association lists of the keys,values to be changed and do all the grunt work in .net .. that way the complete operation can be wrapped without issue.That's a good idea too - though it's actually already implemented through ARX in the entmod routine for one entity at a time. This would basically be something like an entmod-multiple: i.e. send the function a list of dxf-data lists.
Command: (SetProps (car (entsel)) "Layer" "0" "ColorIndex" 4 "Radius" 10)
Select object: (0)
Command: (SetProps (car (entsel)) "Layer" "0" "ColorIndex" 4 "Radius" 10)
Select object: (nil)
I had several interesting conversations with other programming colleagues at AU last week and I brought up the conversation about using Transactions in LISP.
(setpropertyvalue (car (entsel)) "color" 1)
I just noticed that on autocad 2014 (windows - vanilla) you have some new autolisp (built-in) functions and in there is this one - btw:Louis, it is from 2012, History:
http://docs.autodesk.com/ACDMAC/2012/ENU/filesALRMac/GUID-ED406069-97F9-4552-BBEF-9A02D06E6C1-203.htm (http://docs.autodesk.com/ACDMAC/2012/ENU/filesALRMac/GUID-ED406069-97F9-4552-BBEF-9A02D06E6C1-203.htm)
So, one can use:Code: [Select](setpropertyvalue (car (entsel)) "color" 1)
irne, I understand the purpose of a transaction.
Frankly, customisers currently don't make use of error trapping adequately .. I'd be bold enough to suggest that the majority don't understand how they work.
You're suggesting that another level of complication be added into the mix.
For me, it would be more beneficial adding .net functions that take lisp association lists of the keys,values to be changed and do all the grunt work in .net .. that way the complete operation can be wrapped without issue.
I'd consider leaving transactions open for a period of time not under the designers control is asking for trouble.
//................
Peter,
If you're making changes to thousands of objects often enough that the time taken is an issue you're using the wrong language to start with.
... getting expectations and capability mixed up in my opinion.
I thinks it's just an interesting intellectual exercise.
Yes, me too :lol: ... that is the main thing isn't it?
I look forward to seeing the implementation and documentation.
I can make it so there are multiple transactions and subordinate transactions operating at the same time, and I can control them just like in .net.I do not know of anyway of doing that because you only can use the Top Transaction or most recent transaction created per document.
What is the main reason for wanting to use transactions?2 reasons: