Jump to content

Creating undeletable object - possible?


the-trooper

Recommended Posts

If it was invisibility you were looking for:

*couldn't resist*

 

:) No problem, this is good to know, also.

 

 

But as for undeletable.... hmm, thats a bit trickier.

 

Undeletable, uneditable, unmovable. Maybe, locked, is a better way of saying it.

Link to comment
Share on other sites

  • Replies 61
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    22

  • the-trooper

    16

  • alanjt

    11

  • ReMark

    5

Top Posters In This Topic

Posted Images

what about placing it on a locked layer, then just have a command reactor that checks to make sure layer is locked at beginning of command.

 

vlr-command-reactor and vlr-lispWillStart could do the trick

Link to comment
Share on other sites

How secure do you want this to be? Anything that the Brilliant minds (I'm not part of that group) here come up with - unless it somehow has a password protection - would be able to be removed by a sufficiently smart and or motivated cad operator. Heck they might even wind up here on the board looking for a way to delete a pesky object (leaving out the fact that it is a copyright / watermark type of thing).

 

If you can put it on/in the drawing, eventually it can be removed from the drawing - it just depends on how much work you want to cause your opponent.

 

Glen

Link to comment
Share on other sites

Judging by the number of requests we see here about getting rid of normal AutoCAD entities I would say that chances are the average user is not going to have a clue.

Link to comment
Share on other sites

Something like this Alan - nice idea:

 

(defun c:water ( )
 (vl-load-com)
 (if (not *wMark*)
   (progn
     (setq *wMark*
       (vlr-command-reactor nil
         (list
           (cons :vlr-commandWillStart 'Lock))))
     (if (not (tblsearch "LAYER" "WMark"))
       (vla-add
         (setq *lay
           (vla-get-layers
             (vla-get-ActiveDocument
               (vlax-get-acad-object)))) "WMark"))
     (princ "\n** Reactor Initiated **"))
   (princ "\n** Reactor Already Running **"))
 (princ))

(defun Lock (Reac Args)
 (if (not
       (wcmatch
         (strcase (car Args)) "*ZOOM*,*PAN*"))
   (vla-put-Lock (vla-item *lay "WMark") :vlax-true))
 (princ))

(defun c:drain ( )
 (vl-load-com)
 (if (and *wMark* (vlr-added-p *wMark*))
   (progn
     (vlr-remove *wMark*)
     (setq *wMark* nil *lay nil)
     (princ "\n** Reactor Deactivated **"))
   (princ "\n** Reactor Not Running **"))
 (princ))

Link to comment
Share on other sites

precisely what i had in mind. only thought i could come up with. sorry i didn't have a chance to hash something out, glad you took the initiative. :)

 

Something like this Alan - nice idea:

 

(defun c:water ( )
 (vl-load-com)
 (if (not *wMark*)
   (progn
     (setq *wMark*
       (vlr-command-reactor nil
         (list
           (cons :vlr-commandWillStart 'Lock))))
     (if (not (tblsearch "LAYER" "WMark"))
       (vla-add
         (setq *lay
           (vla-get-layers
             (vla-get-ActiveDocument
               (vlax-get-acad-object)))) "WMark"))
     (princ "\n** Reactor Initiated **"))
   (princ "\n** Reactor Already Running **"))
 (princ))

(defun Lock (Reac Args)
 (if (not
       (wcmatch
         (strcase (car Args)) "*ZOOM*,*PAN*"))
   (vla-put-Lock (vla-item *lay "WMark") :vlax-true))
 (princ))

(defun c:drain ( )
 (vl-load-com)
 (if (and *wMark* (vlr-added-p *wMark*))
   (progn
     (vlr-remove *wMark*)
     (setq *wMark* nil *lay nil)
     (princ "\n** Reactor Deactivated **"))
   (princ "\n** Reactor Not Running **"))
 (princ))

Link to comment
Share on other sites

interesting.

vlr-editor-reactor is a new one to me.

 

yeah, I've never really used it either - but after investigating the amount of Callbacks for it, I think I will from now on!

Link to comment
Share on other sites

How secure do you want this to be? Anything that the Brilliant minds (I'm not part of that group) here come up with - unless it somehow has a password protection - would be able to be removed by a sufficiently smart and or motivated cad operator.

 

I know, but considering how hard it is to create such object, and knowing how "much" average operator knows, i think very, VERY, few of them would be able to do that.

Half of them don't even know how to appload a lisp...

Link to comment
Share on other sites

just out of curiosity, what's so important that you must protect it like the holy grail?

 

Well, our dynamic blocks started appearing in other firms drawings. We send drawings to our associates, so, if they want to use them, one tiny, itsy bitsy line of text saying who and when made that block is in order. Right?

Nothing that would prevent from using it, or even get in the way of normal work.

Link to comment
Share on other sites

Something like this Alan - nice idea:

(defun c:water ( )

 

Lee Mac, this is fantastic!!! Exactly what i wanted! 8.gif

Thanks very, very much!

 

Just one more thing :oops: is it possible to make "Wmark" layer unplottable by default? You wouldn't believe how many people are unaware this is possible, and i don't want to make blocks unusable.

Link to comment
Share on other sites

Lee Mac, this is fantastic!!! Exactly what i wanted! 8.gif

Thanks very, very much!

 

Just one more thing :oops: is it possible to make "Wmark" layer unplottable by default? You wouldn't believe how many people are unaware this is possible, and i don't want to make blocks unusable.

 

Thanks, but it was Alan's idea... o:)

 

I still think the Keep.lsp is a more elegant solution, but as you say, I can't guarantee its security in a block.

 

btw, bear in mind that the reactor will only need to be called once in a drawing session, and also, that once the drawing is closed the reactor will be deactivated, unless made persistent.

 

Here it is with the layer made unplottable:

 

[b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:water [b][color=RED]([/color][/b] [b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]not[/color][/b] *wMark*[b][color=RED])[/color][/b]
   [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b]
     [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] *wMark*
       [b][color=RED]([/color][/b][b][color=BLUE]vlr-command-reactor[/color][/b] [b][color=BLUE]nil[/color][/b]
         [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b]
           [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [color=Blue][b]:vlr-commandWillStart[/b][/color] [b][color=DARKRED]'[/color][/b]Lock[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
     [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]not[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]tblsearch[/color][/b] [b][color=#ff00ff]"LAYER"[/color][/b] [b][color=#ff00ff]"WMark"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
       [b][color=RED]([/color][/b][b][color=BLUE]vla-put-plottable[/color][/b]
         [b][color=RED]([/color][/b][b][color=BLUE]vla-add[/color][/b]
           [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] *lay
             [b][color=RED]([/color][/b][b][color=BLUE]vla-get-layers[/color][/b]
               [b][color=RED]([/color][/b][b][color=BLUE]vla-get-ActiveDocument[/color][/b]
                 [b][color=RED]([/color][/b][b][color=BLUE]vlax-get-acad-object[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=#ff00ff]"WMark"[/color][/b][b][color=RED])[/color][/b] [b][color=Blue]:vlax-false[/color][color=RED])[/color][/b][b][color=RED])[/color][/b]
     [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n** Reactor Initiated **"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
   [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n** Reactor Already Running **"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]

[b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] Lock [b][color=RED]([/color][/b]Reac Args[b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]not[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]wcmatch[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcase[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] Args[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=#ff00ff]"*ZOOM*,*PAN*"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
   [b][color=RED]([/color][/b][b][color=BLUE]vla-put-Lock[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-item[/color][/b] *lay [b][color=#ff00ff]"WMark"[/color][/b][b][color=RED])[/color][/b] [b][color=Blue]:vlax-true[/color][color=RED])[/color][/b][b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]

[b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:drain [b][color=RED]([/color][/b] [b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]and[/color][/b] *wMark* [b][color=RED]([/color][/b][b][color=BLUE]vlr-added-p[/color][/b] *wMark*[b][color=RED])[/color][/b][b][color=RED])[/color][/b]
   [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b]
     [b][color=RED]([/color][/b][b][color=BLUE]vlr-remove[/color][/b] *wMark*[b][color=RED])[/color][/b]
     [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] *wMark* [b][color=BLUE]nil[/color][/b] *lay [b][color=BLUE]nil[/color][/b][b][color=RED])[/color][/b]
     [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n** Reactor Deactivated **"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
   [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n** Reactor Not Running **"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]

Link to comment
Share on other sites

The problem will be that the callback data associated with the reactor (if made persistent) will need to be loaded upon opening the drawing for the reactor to successfully function.

 

Not quite sure how you are going to get around that one... o:)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...