PDA

View Full Version : command Reactor and condtional processing


rklee
2009-07-14, 09:20 PM
I need to prevent the users from using refedit command on xref files that are in a controlled folder. I want them to be able to use it to edit blocks in the drawing. I have looked at redefining the command, and trying to look at a command reactor, just not sure which is the easier and more secure method of doing this. I plan on using the (setq PATHCHECK (vlax-property-available-p VLAOBJ 'path)) method of determing if the item selected is an external reference.

I have not worked with a reactor so this method is also a learning experience.

Any suggestions or pointers on this?

dgorsman
2009-07-15, 01:15 AM
Redefining the command is *much* easier. I think the reactor may not be capable of veto-ing the function, either. The downside is users who like to prefix their commands e.g. ".REFEDIT", cannot be caught this way.

RobertB
2009-07-16, 08:28 PM
If the users have RO permissions in the "controlled" folder, it doesn't matter if they attempt a RefEdit.

rklee
2009-07-17, 09:26 PM
I am working on redefing the command for a selected group of users. They have RW rights to the folder due to our document manager program. The issue is they like to do things their way, so I have to find ways of closing the door. This involves 10 out of 200 autocad users. The routine will check the log in and redefine the command based on that.

rklee
2009-07-23, 08:17 PM
I need some help, the command refedit gets redefined if they edit a block. As long as it is used on xref, things stays redefined. Any suggestions? This is located in the S::Startup section of acaddoc.lsp. I have everything global while I am debugging this off the network.

(defun C:refedit ();(/ BLOCKENT1 VLAOBJ PATHCHECK)
(setq BLOCKENT1 (entsel)
BLOCKENT2 (car BLOCKENT1)
BLOCKPOINT (cdr BLOCKENT1)
VLAOBJ (vlax-ename->vla-object BLOCKENT2)
PATHCHECK (vlax-property-available-p VLAOBJ 'path)
)
(if (= PATHCHECK T)
(progn
(setq d (rtos (getvar "CDATE") 2 6)
;get the date and time and convert to text
hr (substr d 10 2)
;extract the hour
m (substr d 12 2)
;extract the minute
s (substr d 14 2)
;extract the second
);setq
(setq CTIME(strcat hr ":" m ":" s)
USERID (getvar "loginname")
FILE_LOG (open "\\\\servername\\usr2\\usr2\\acad-log\\refedit.txt" "a")
C_TIME (menucmd "M=$(edtime,$(getvar,date),DDDD\",\" D MONTH YYYY)")
FILE_NAME (getvar "dwgname")
USERID (strcat "User Login: " USERID " File: " FILE_NAME " Date: " C_TIME " Time: " CTIME " Xrefblock.lsp ")
)
(write-line USERID FILE_LOG)
(close FILE_LOG)
(alert "This has be disabled.\nUse Adept and Sign out the file.")
);close PATHCHECK PROGN then statement
(progn ;PATHCHECK ELSE START
(command ".refedit")
(prompt "\nReselect the object.")
);close PATHCHECK ELSE PROGN
);close if PATHCHECK
);CLOSE DEFUN refedit
);close tech check progn then statement
);close if techcheck statement

RobertB
2009-07-24, 12:04 AM
You are not calling the original ARX-loaded RefEdit in your posted code. You need to use this (sample only):

(command "._Undefine" "RefEdit")

(defun C:RefEdit ()
(alert "My RefEdit")
(command "._Acad_RefEdit.RefEdit")
(princ))

rklee
2009-07-24, 01:42 PM
Thank you, I had not realized that was an ARX or how to call it. It looks like that worked, I will do some more testing and then roll it out. Thank you everyone for your assistance and especially to Robert.