MMS Posted October 10, 2010 Posted October 10, 2010 Can we create some block where we can use just at local machine. If the block is opened in other machine, user can't copy block or can't print the block ? Maybe we can create some coding ? Quote
Lee Mac Posted October 10, 2010 Posted October 10, 2010 For any coding you do, the person who opens the drawing will also have to have the code on their system. Quote
MMS Posted October 10, 2010 Author Posted October 10, 2010 @Lee Can you give me a sample code ? Thanks, MMS Quote
Lee Mac Posted October 10, 2010 Posted October 10, 2010 It would use reactors to control what could be selected/manipulated - but its a lot of work for not much gain. Quote
Lee Mac Posted October 10, 2010 Posted October 10, 2010 Example here: http://www.cadtutor.net/forum/showthread.php?52412-Stick-entity-in-a-dwg&p=355243&viewfull=1#post355243 (Try deleting/exploding) Quote
MMS Posted October 10, 2010 Author Posted October 10, 2010 Example here: http://www.cadtutor.net/forum/showthread.php?52412-Stick-entity-in-a-dwg&p=355243&viewfull=1#post355243 (Try deleting/exploding) @Lee Thanks for your explanation I will learn the code Quote
MMS Posted October 11, 2010 Author Posted October 11, 2010 Hi lee, This code just only for one session / temporary. If we closing the drawing and opening again the code is not effect. So could you tell me how to create code if we close and open again the code it's still work. (defun c:LockObjects ( / ss ) (vl-load-com) ;; © Lee Mac 2010 (if (setq ss (ssget "X" (list(cons 0 "insert")))) ( (lambda ( i / e hand ) (while (setq e (ssname ss (setq i (1+ i)))) (if (not (vl-position (setq hand (vla-get-Handle (vlax-ename->vla-object e)) ) *locked* ) ) (setq *locked* (cons hand *locked*)) ) ) (if (not (vl-some (function (lambda ( reactor ) (eq "ObjectLock" (vlr-data reactor)) ) ) (cdar (vlr-reactors :vlr-editor-reactor)) ) ) (vlr-editor-reactor "ObjectLock" (list (cons :vlr-commandEnded 'ObjectLockCallBack) ) ) ) ) -1 ) ) (princ) ) (defun c:UnLockObjects ( / ss ) (vl-load-com) ;; © Lee Mac 2010 (if *locked* (if (setq ss (ssget)) ( (lambda ( i / e hand ) (while (setq e (ssname ss (setq i (1+ i)))) (if (vl-position (setq hand (vla-get-Handle (vlax-ename->vla-object e)) ) *locked* ) (setq *locked* (vl-remove hand *locked*)) ) ) ) -1 ) ) (princ "\n** No Objects Locked **") ) (princ) ) (defun c:DisableLock ( / reactor ) (vl-load-com) ;; © Lee Mac 2010 (if (setq reactor (vl-some (function (lambda ( reactor ) (if (eq "ObjectLock" (vlr-data reactor)) reactor) ) ) (cdar (vlr-reactors :vlr-editor-reactor)) ) ) (vlr-remove reactor) (princ "\n** Object Lock not Running **") ) (princ) ) (defun ObjectLockCallBack ( reactor arguments ) (if (wcmatch (strcase (car arguments)) "ERASE,EXPLODE") (mapcar (function (lambda ( handle ) (or (entget (handent handle)) (entdel (handent handle))) ) ) *locked* ) ) (princ) ) Thanks, MMS Quote
Lee Mac Posted October 11, 2010 Posted October 11, 2010 Yes, the reactor/information is lost when the document is closed. To make the reactor function between sessions, you would need to store the entity handle information in the drawing, perhaps in a dictionary/xdata. Then either rebuild the transcient reactor, or use a persistent reactor ( I would advise against that ). Quote
MMS Posted October 11, 2010 Author Posted October 11, 2010 Yes, the reactor/information is lost when the document is closed. To make the reactor function between sessions, you would need to store the entity handle information in the drawing, perhaps in a dictionary/xdata. Then either rebuild the transcient reactor, or use a persistent reactor ( I would advise against that ). Could you tell me where I can find the tutorial about transcient reactor / persistent reactor ? Thanks Quote
Lee Mac Posted October 12, 2010 Posted October 12, 2010 AfraLISP has some info on reactors, and they are also documented in the VLIDE Help Docs. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.