Please, does anyone knows why this simple routine crashes AutoCAD 2014 when user rotates any object ?!?
All other "modify category" commands work with no problems.
(And AutoCAD 2011 does not have this issue ?!?)
(defun tst ()
(vl-load-com)
(vlr-acdb-reactor nil '((:vlr-objectModified . RBS_ObjectModified)))
)
(defun RBS_ObjectModified (rctr objct)
(print (cdr (assoc 0 (entget (cadr objct)))))
)
Thank you !
Solved! Go to Solution.
Solved by dbroad. Go to Solution.
Works fine for me on a small drawing. It might help to post your drawing.
Thank you for the response,
I'm testing this in AutoCAD 2014 in a new drawing with just one line (!?!), so I beleive it would make no sense to send you that kind of dwg.
This is what and how I do:
I draw a line, then I load this lisp procedure and execute it by typing (tst) on command line.
After that when I rotate the line AutoCAD crashes.
Did you do the same, and AutoCAD 2014 is not crashing ?
(if lisp is active then after each "modify command" it writes type of entity that was modified...)
Look below, this post is made invalid with further testing
Worked fine I think.
Command: (tst) #<VLR-AcDb-Reactor>
Command: _rotate
Current positive angle in UCS: ANGDIR=counterclockwise ANGBASE=0.00000000
1 found
Specify base point:
Specify rotation angle or [Copy/Reference] <0.00000000>:
"ATTRIB"
"ATTRIB"
"ATTRIB"
"ATTRIB"
"ATTRIB"
"ATTRIB"
"ATTRIB"
"ATTRIB"
"ATTRIB"
"ATTRIB"
"ATTRIB"
"SEQEND"
"INSERT"
"LAYOUT"
And then about 30 seconds later ACAD stopped responding.
I take it back!
I'm glad that I'm not getting crazy, but not glad that problem indeed exist.
There must have been some hidden change in AutoCAD object model, since this worked fine in AutoCAD 2011 (did not have an oportunuty to use it in 2012 & 2013)
Yes I can confirm for you that there were huge changes to the object model after 2011.
This has prevented another much-desired routine from continued performance. The visibility-add-eng routine for adding more than one visibility state to a dynamic block was destroyed by these changes to the object model and the complexity of the routine has hindered anyone else from completing it under the new object model specifications.
In summary- you're not the only one who's had an existing routine smashed due to the object model upgrades.
Sorry, but hopefully that helps your sanity some 🙂
As far as fixing your reactor, you'd need to find someone experienced with coding them. I am not that person unfortunately, else I'd help ya.
1)Avoid acdb reactors. Use them as last resorts only and remove them as soon as the need has been fullfilled. That has been the advice since vlr reactors have been added.
2)Avoid duplicating acdb reactors. They are very active. They will slow autocad down. It is entirely possible for them to crash AutoCAD if left running.
One method would be to decide what you want to track and only track that. For example, if you are trying to track the rotate command, use a command reactor to set up the acdb reactor at the command's start point. Then remove the addb reactor after the command is finished.
I want to keep track on handles of block instances of certain kind upon which were aplied move, copy, mirror, rotate, align events, so I could perform some actions in command_ended.
Any suggestions ?
And I would really apreciate the example of removing the reactor as I could not find any in AutoCAD 2014 help !?!
Maybe aplied on the code I presented in my question.
Thank you !
Use object reactors to track specific objects. Use xdata to help setup the reactors when the drawing is opened. Xdata is owned by a particular application. Register your application so that you can access which objects are "owned" by the application.
The code example below is just an adaptation of your code to show you how to remove a reactor. In general avoid, acdb reactors.
(if myreactor (vlr-remove myreactor));remove your reactors on load to avoid duplication.
(defun tst () (vl-load-com) (setq myreactor (vlr-acdb-reactor nil '((:vlr-objectModified . RBS_ObjectModified)) ) ) ) (defun RBS_ObjectModified (rctr objct) (print (cdr (assoc 0 (entget (cadr objct))))) ) (defun untst () ;to turn your reactor off (untst) (vlr-remove myreactor))
You can also remove all reactors with (vlr-remove-all)
BTW, you should use one login name for all your threads.
Thank you !
With your help I made it work !
PS
I have only one login name on this forum, maybe one of my friends which I asked for help posted similar question.