Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Disable PASTEBLOCK?

18 REPLIES 18
SOLVED
Reply
Message 1 of 19
DanSingleton
757 Views, 18 Replies

Disable PASTEBLOCK?

Is there a way to globally disable PASTEBLOCK (and CTRL+SHIFT+V) to prevent it from being used?

 

The randomly named blocks are a major pain in the butt for us to troubleshoot, especially when they're nested within other randomly named blocks.

 

We have a stubborn user that refuses to take the two seconds it takes to give blocks meaningful names before cutting and pasting them into another drawing, so I'd like to simply remove their ability to use PASTEBLOCK at all.

 

Edit: If anyone from Autodesk reads this, you could fix this by making PASTEBLOCK optionally ask for a block name on insert.

18 REPLIES 18
Message 2 of 19
hmsilva
in reply to: DanSingleton

A way that occurs to me is "UNDEFINE" command...

 

HTH

Henrique

EESignature

Message 3 of 19
Kent1Cooper
in reply to: DanSingleton

For situations where that has already happened, you can give them meaningful names without needing to keep track of which oddball names PasteBlock gave to which Blocks, by using the RenameBlock.lsp routine here, with its RB command [which stands for, as you might expect, Rename Block].  But I agree it would nice if PasteBlock asked for a name in the process.

Kent Cooper, AIA
Message 4 of 19
rkmcswain
in reply to: DanSingleton

DanSingleton wrote:
We have a stubborn user that refuses to....

Reminds me of a favorite quote...

 

"Don't let a management problem become a technology problem"
        -Mark Kiker, caddmanager.com

 

R.K. McSwain     | CADpanacea | on twitter
Message 5 of 19
DanSingleton
in reply to: rkmcswain

Believe me... If I could have I would have "managed" this person right out of the company years ago. The amount of frustration this individual causes to the rest of the designers is ridiculous.

 

I guess I'll try the undefine command and see how that works out. He'll probably just redefine it using a private LISP function though.

Message 6 of 19
Kent1Cooper
in reply to: hmsilva


@hmsilva wrote:

A way that occurs to me is "UNDEFINE" command...

....


And let's not stop there -- let's define a new PasteBlock command!  The attached PasteBlockWithName.lsp Undefines the original PASTEBLOCK command, and Redefines it in such a way that the User is required to supply a name before pasting in the Block.  It then lets them paste it in, and immediately Renames it with the name they supplied, so that the wacky name is no longer present.  It will work whether they type the PasteBlock command name or pick it from a menu or use Ctrl+Shift+V.

 

Put the .lsp file [unzipped out of the attachment] in some folder in the Support File Search Path list, and put

 

(load "PasteBlockWithName")

 

into your acaddoc.lsp file, and it will always be redefined.

 

The original command will, of course, always be available, if you really have a need for it [or for a knowledgeable-enough troublemaker User], by preceding the typed command name with a period.  Alternatively, you could follow the instructions in the file to retain the original definition, and make this a command with a different name.

Kent Cooper, AIA
Message 7 of 19
DanSingleton
in reply to: Kent1Cooper

That'll work perfectly. 🙂 Thanks!

Message 8 of 19
Kent1Cooper
in reply to: DanSingleton


@DanSingleton wrote:

That'll work perfectly. 🙂 Thanks!


Thank you for triggering the idea.  It's not a difficult concept, and if I used PasteBlock more than I do, I might have thought of it sooner.  [Maybe there's a similar redefinition already out there somewhere, because you'd think someone must have thought of it.]  But I like the idea well enough, even if I probably won't use it very much, that I've already put it into my acaddoc.lsp file.

Kent Cooper, AIA
Message 9 of 19
hmsilva
in reply to: Kent1Cooper


@Kent1Cooper wrote:

@hmsilva wrote:

A way that occurs to me is "UNDEFINE" command...

....


And let's not stop there -- let's define a new PasteBlock command! 

...


Nicely done!

 

Henrique

EESignature

Message 10 of 19
Kent1Cooper
in reply to: hmsilva


@hmsilva wrote:
....

Nicely done!

....


Thank you, but use the attached updated version instead.  It asks again if you give it a Block name that's already in use [otherwise, the Rename would fail, and the wacky name would remain].  And it does the Renaming differently, so it doesn't need to deal with the CMDECHO System Variable at all.

Kent Cooper, AIA
Message 11 of 19
DanSingleton
in reply to: Kent1Cooper

Even better. Thanks!

Message 12 of 19

I've not studied the posted code, but what is preventing the user from simply entering a bunch of gibberish when prompted for a name?  I suspect if this user is as lazy as you say, that is exactly what will happen.  Just because user input is required, doesn't make it meaningful.

Message 13 of 19

You're correct. There is nothing is stopping him from entering jibberish.

 

However, he no longer has the excuse, "I didn't have to give blocks a name because that's how the software works".  If jibberish block names start appearing, I can present management with proof that he's not following our standards requiring using meaningful names for blocks, as well as being a lazy designer with no consideration for others that use his files later.

Message 14 of 19
Kent1Cooper
in reply to: Jason.Piercey


@Jason.Piercey wrote:

I've not studied the posted code, but what is preventing the user from simply entering a bunch of gibberish when prompted for a name?  I suspect if this user is as lazy as you say, that is exactly what will happen.  Just because user input is required, doesn't make it meaningful.


You don't need to study it -- nothing prevents that.  I can't imagine a way to check what they enter for gibberishiosity, but it can't be any worse than AutoCAD's wacky names.  And if they need to put something in, it's in their own best self-interest [whether they realize it or not] to make it mean at least something, so they can Insert the same Block again, knowing which one it is in a list of Block names.  After all, if they're not going to use it as a Block more than once, then there's no point in using PasteBlock rather than just Paste -- it uses more memory to have a defined Block that's Inserted only once than not to have it defined as a Block at all.  But a knowledgeable-enough User can get around whatever you set up, including the "nuclear" option of simply undefining the PasteBlock command, which would also greatly and unnecessarily inconvenience less-knowledgeable Users.

Kent Cooper, AIA
Message 15 of 19


@DanSingleton wrote:

You're correct. There is nothing is stopping him from entering jibberish.

 

However, he no longer has the excuse, "I didn't have to give blocks a name because that's how the software works".  If jibberish block names start appearing, I can present management with proof that he's not following our standards requiring using meaningful names for blocks, as well as being a lazy designer with no consideration for others that use his files later.


I'm not trying to change your mind, but it seems to me that if meaningful names are company standards, then this user is already in violation.  Guess I just don't see the difference between meaningless names regardless if they are software or user generated.

Message 16 of 19
rkmcswain
in reply to: DanSingleton

If I'm your "stubborn user", I just start using ".pasteblock" or maybe I have my own function (defun c: pb () (vl-cmdf ".pasteblock")).......

I'm being facetious obviously, but it is possible if "stubborn user" knows a little bit about lisp.





R.K. McSwain     | CADpanacea | on twitter
Message 17 of 19
Kent1Cooper
in reply to: rkmcswain


@rkmcswain wrote:

If I'm your "stubborn user", I just start using ".pasteblock" or maybe I have my own function (defun c: pb () (vl-cmdf ".pasteblock")).......

I'm being facetious obviously, but it is possible if "stubborn user" knows a little bit about lisp.


Well if I was that stubborn user, my approach would be (command "_.redefine" "PASTEBLOCK").  Then I could use Ctrl+Shift+V again instead of needing a command name.  Also facetious, but they're all part of what I meant by a knowledgeable-enough User.  Another thought -- maybe a Reactor could be made that would watch for something like that, and change it back, or watch for that command name and always return to the require-a-Block-name version, but I haven't worked with Reactors, and don't know enough about what they're capable of doing.  In any case, I suppose a knowledgeable-enough User could also get around one of those.

Kent Cooper, AIA
Message 18 of 19
rkmcswain
in reply to: Kent1Cooper

Kent1Cooper wrote:
........I haven't worked with Reactors, and don't know enough about what they're capable of doing.

I believe a reactor could be used to detect the REDEFINE command and stop it.

 

I seem to recall reading that it's possible to create a "replacement" command using (??? .NET maybe?) that physically replaces the core command so that even the period prefix will not bring back the original. Anyone out there know if that is true or not?

 

 

 

 

R.K. McSwain     | CADpanacea | on twitter
Message 19 of 19
DanSingleton
in reply to: rkmcswain


@rkmcswain wrote:

If I'm your "stubborn user", I just start using ".pasteblock" or maybe I have my own function (defun c: pb () (vl-cmdf ".pasteblock")).......

I'm being facetious obviously, but it is possible if "stubborn user" knows a little bit about lisp.


Thing is if they're too lazy to name a block in the first place, do you think they'll bother to take the time to write a routine to get around it, or simply just comply?

 

Like I said before, if it was my choice I'd have dealt with this person's repeated non-conformance to company standards years ago by allowing them the opportunity to seek employment at another company that would let them do whatever they wanted. 😉

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost