Found a bit of a bug and trying to 1) advance the bug report to Adesk and 2) find a valid way around it.
On this thread: http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Save-a-selection-window/td-p/4899926 we have been working on a routine to run the command line version of refedit on multiple objects. My current version of this is attached for reference.
Here is the problem: if you run the routine (or any of multiple versions that we have gone through) without having launched the dialog version of refedit there is a variable for the dialog box that has not been initialized (and boy has that caused some messes and headaches).
Yes, we have included reg editing to ensure that the setting is what we need it to be. Have even set the reg value and left Acad entirely, then came back and tried the routine again... same issues.
It ignores the value of "Lock Objects not in the working set".
If you launch the dialog version and get into the command, then close the refedit session, then run the routine... everything works fine.
So:
for number one, AutoDesk engineers, please address this
for number 2, does anyone know how to preinitialize the a built-in dialog command (and the associated reg values) as if the command has already been run?
Well, I now have a workaround until Adesk can fix the underlying issue. Simply put: I added another selection set of everything as it exists prior to entering the -refedit command, then remove that selection set from the "copy" operation while refediting. this works to remove the "native" objects that should be locked out but sometimes aren't due to lack of initialization of the option. It still works post initialization as well as it's treated as having selected something on a locked layer, which is to say, it ignores the "locked out" objects during selection:
;keep everything in line by line mode to overcome a few glitches (if XR (progn (setq EntyCount 0) (while (/= EntyCount (sslength XR)) (princ "\nStarting loop: \n") ;added this next line to counteract possible uninitialized variable ;"Lock Objects not in working set" from dialog version of refedit (setq RemoveSet (ssget "X")) (setq XREF (ssadd (ssname XR EntyCount))) (sssetfirst nil XREF) (command "_-refedit" "O" "N" "_CP") (foreach pt PointList (command pt)) (command "" "" "N") (command "_copy" "_CP") (foreach pt PointList (command pt)) ;to remove objects that should be locked out but sometimes arent ;does not throw any issues after initialization of dialog version ;because then they are filtered out and gets treated as a "missed" pick ;changed this: ;;; (command "" "" "0,0,0" "0,0,0") ;to this (command "" "R" RemoveSet "" "0,0,0" "0,0,0") (command "_refset" "R" "_CP") (foreach pt PointList (command pt)) (command "" "") (command "_refclose" "D") (setq XREF nil) (setq EntyCount (+ 1 EntyCount)) (princ "\nCompleted loop: ") (princ EntyCount) ); end while ) (princ "\nNothing Selected. Exiting Function") )
-G