+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15
  1. #1
    Junior Member
    Discipline
    Electrical
    Using
    AutoCAD 2010
    Join Date
    May 2018
    Posts
    12

    Default Undefine, Redefine and localized version of Autocad

    Registered forum members do not see this ad.

    Hello. I can't complete a simple task which requires of using Undefine and Defun functions to cover builtin function in localized Autocad 2010.
    I need to replace PASTEBLOCK. In my version PASTEBLOCK function can be represented with two commands: WKLEJBLOK (localized) and _PASTEBLOCK (generic). Both do the same.
    Now, if I do "undefine WKLEJBLOK" (it is not proper command, just to show an issue), both functions (WKLEJBLOK, _PASTEBLOCK) are no longer valid.
    Now if I make a defun C:WKLEJBLOK, WKLEJBLOK works but _PASTEBLOCK is still not valid (unknown).
    The problem with WKLEJBLOK and shortcut or menu access are that both tries to launch _pasteblock, not WKLEJBLOK.
    So I have tried to do this in other way. After recovered both with "redefine" I did "undefine _PASTEBLOCK" and "defun C:_PASTEBLOCK". It didn't work - both commands are invalid now.
    What do I do to have both WKLEJBLOK and _PASTEBLOCK covered with custom lisp? WKLEJBLOK doesn't seem to be an alias (not in acad.pgp).
    Any idea? Or maybe it is not possible this way?

  2. #2
    Junior Member
    Discipline
    Electrical
    Using
    AutoCAD 2010
    Join Date
    May 2018
    Posts
    12

    Default

    Well, I couldn't find a way to cover the builtin command so I just created new command and customized menu and shortcut.

  3. #3
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO 64-bit
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x64
    CPU:
    Pentium(R) i5 4570 @ 3.2GHz
    RAM:
    8 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    2x ThinkVision 24"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2018
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    12,084

    Default

    I have moved your thread to the AutoLISP, Visual LISP & DCL Forum.
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



  4. #4
    Super Member
    Computer Details
    tombu's Computer Details
    Operating System:
    Windows 7 64-bit
    Computer:
    Dell
    Discipline
    Civil
    tombu's Discipline Details
    Occupation
    Design Analyst
    Discipline
    Civil
    Details
    Small Street & Stormwater projects. Traffic Calming and other issues.
    Using
    Civil 3D 2018
    Join Date
    Dec 2010
    Location
    Tallahassee, FL USA
    Posts
    810

    Default

    Not sure what your WKLEJBLOK and _PASTEBLOCK functions do, but the AutoCAD command PASTEBLOCK is commonly used and will be missed by your users. I added a Paste drop-down in our Ribbon with five options including "Paste as Group". You could simply add a drop-down that has all your Paste options in it.

    Have to wonder why you're using the underscore that way. As AutoCAD is used around the world and some of the command names are different in other places the underscore is used to "Translates commands and options that follow from the localized name to the global name." A period "Allows you to access a standard command even if it was undefined using the UNDEFINE command." So for me in AutoCAD PASTEBLOCK, _PASTEBLOCK, .PASTEBLOCK, and ._PASTEBLOCK all invoke the PASTEBLOCK command. Both my installed "Paste as Block" and Shortcut Keys macros use the underscore → ^C^C_pasteblock
    https://knowledge.autodesk.com/suppo...3A424-htm.html
    Layer 0 for ByBlock Block entities, everything else ByLayer. So many issues can be solved with good templates.

  5. #5
    Junior Member
    Discipline
    Electrical
    Using
    AutoCAD 2010
    Join Date
    May 2018
    Posts
    12

    Default

    WKLEJBLOK and _PASTEBLOCK do exactly what You have said - it pastes objects from clipboard as new randomly named block.
    PASTEBLOCK (without underscore) exists only in english version of Autocad, at least until 2010. Didn't use any newer version so I don't know if this policy changed or not. WKLEJBLOK is a genuine command in my localized version of Autocad, and it is the same as PASTEBLOCK in english version of Autocad. I am totally against translating commands if You ask me, it creates new issues, and divide people searching for help and make additional hardship for them.

    _PASTEBLOCK do the same as a PASTEBLOCK, and _.PASTEBLOCK do the same as PASTEBLOCK as well, with exception that You can't cover _.PASTEBLOCK.
    Shortcut ^C^C_pasteblock represented by CTRL+SHIFT+V is internally launching _PASTEBLOCK, but in command line it shows that WKLEJBLOK has been launched. Doesn't matter.
    If i undefine and redefine WKLEJBLOK as a new custom function then _PASTEBLOCK no longer works, so shortcut no longer works as well. I need to typing WKLEJBLOK each time from command line. I can't undefine _PASTEBLOCK, but can't redefine it. It doesn't show any error, but it doesn't work as well.

    As I said in my own reply, I couldn't fine any helpful article about this issue so I left _PASTEBLOCK and WKLEJBLOK intact, and created new function and changed shortcut for it.

  6. #6
    Junior Member
    Discipline
    Electrical
    Using
    AutoCAD 2010
    Join Date
    May 2018
    Posts
    12

    Default

    I don't know if this is common policy here, but I can't reedit my own posts ... I made a small mistake above:
    "I can't undefine _PASTEBLOCK, but can't redefine it.". Should be "I can undefine, but can't redefine".

  7. #7
    Super Member
    Computer Details
    tombu's Computer Details
    Operating System:
    Windows 7 64-bit
    Computer:
    Dell
    Discipline
    Civil
    tombu's Discipline Details
    Occupation
    Design Analyst
    Discipline
    Civil
    Details
    Small Street & Stormwater projects. Traffic Calming and other issues.
    Using
    Civil 3D 2018
    Join Date
    Dec 2010
    Location
    Tallahassee, FL USA
    Posts
    810

    Default

    Quote Originally Posted by Ryszard View Post
    I don't know if this is common policy here, but I can't reedit my own posts ... I made a small mistake above:
    "I can't undefine _PASTEBLOCK, but can't redefine it.". Should be "I can undefine, but can't redefine".
    Please read the AutoCAD Knowledge Base link:
    About Special Control Characters in Command Macros
    https://knowledge.autodesk.com/suppo...3A424-htm.html
    There's a use for those Control Characters, but they don't create new commands. You will find PASTEBLOCK, but not _PASTEBLOCK in AutoCAD Help's Command list:
    http://help.autodesk.com/view/ACD/20...=commands&q=P*
    It's not a separate command.

    You should be able to both undefine and redefine the PASTEBLOCK command. Assuming you're trying to avoid the bloat from users who explode these blocks and neglect to purge them educating them would be a better option.

    The custom macro "Paste as Group" solves that problem at: http://www.cadtutor.net/forum/showth...l=1#post699987
    It Pastes as Block, explodes the Block, creates a group of the exploded objects, then purges that block leaving only the group.
    Layer 0 for ByBlock Block entities, everything else ByLayer. So many issues can be solved with good templates.

  8. #8
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO 64-bit
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x64
    CPU:
    Pentium(R) i5 4570 @ 3.2GHz
    RAM:
    8 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    2x ThinkVision 24"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2018
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    12,084

    Default

    Quote Originally Posted by Ryszard View Post
    I don't know if this is common policy here, but I can't reedit my own posts ... I made a small mistake above:
    "I can't undefine _PASTEBLOCK, but can't redefine it.". Should be "I can undefine, but can't redefine".
    You can't edit posts until you have 10 relevant posts.
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



  9. #9
    Junior Member
    Discipline
    Electrical
    Using
    AutoCAD 2010
    Join Date
    May 2018
    Posts
    12

    Default

    Quote Originally Posted by tombu View Post
    There's a use for those Control Characters, but they don't create new commands. You will find PASTEBLOCK, but not _PASTEBLOCK in AutoCAD Help's Command list.
    It's not a separate command.
    I always have been convinced that command with _ special character is equivalent to a command without _. In english version both have the same name, let's say general name. In localized version the one without underscore has local name which differs from general name. I knew all that till now.
    That i still can't understand why does define method not work (described above).
    I see that WKLEJBLOK has made some mess here so I will use general name to repeat the issue.
    I have got script written by Kent Cooper for english version which is the replacement for original PASTEBLOCK that allows the client to give a name to a pasting block.
    So no longer random names like AC$AABBCC00FF.
    The author assumed that client will replace the original PASTEBLOCK with the new one.
    This script didn't work in my Autocad because there is no PASTEBLOCK here but WKLEJBLOK. So it just created new command PASTEBLOCK, which for Autocad was a completely new command.
    So i modified the script to replace WKLEJBLOK which is translated command to PASTEBLOCK. And connected to _PASTEBLOCK.

    Let's just say I have english version and run script without modification.
    Script undefined PASTEBLOCK, and defined it as custom. That is all, no additional steps.
    But it didn't work here as it should. I got covered version of PASTEBLOCK, ok, I can run it typing full name in CMDL, but _PASTEBLOCK is not working anymore. Autocad warns me that _PASTEBLOCK doesn't exists, command unknown etc. So the key shortcut is not working as well because it is connected to _PASTEBLOCK, not PASTEBLOCK (important underscore character here).
    The _PASTEBLOCK will be recognized as proper command again if I return to original PASTEBLOCK function with redefine command.
    I don't know if this is an issue in localized versions of Autocad, or maybe only 2010, but it seems that after undefine command has been used the connection beetween _PASTEBLOCK and PASTEBLOCK is shattered.

    Maybe it is possible to cover built-in function without undefine command, but I didn't test it. I have found a solution to just create separate command and modify user interface.

  10. #10
    Super Member
    Computer Details
    tombu's Computer Details
    Operating System:
    Windows 7 64-bit
    Computer:
    Dell
    Discipline
    Civil
    tombu's Discipline Details
    Occupation
    Design Analyst
    Discipline
    Civil
    Details
    Small Street & Stormwater projects. Traffic Calming and other issues.
    Using
    Civil 3D 2018
    Join Date
    Dec 2010
    Location
    Tallahassee, FL USA
    Posts
    810

    Default

    Registered forum members do not see this ad.

    Kent Cooper does some great code, he's #2 in the Top Solution Authors right now on AutoCAD's Lisp forum where he's been for a long time. Can you post the link where he posted the code? Seeing the code and what it was intended to do would help us understand what you're trying to do.
    Layer 0 for ByBlock Block entities, everything else ByLayer. So many issues can be solved with good templates.

Similar Threads

  1. Undefine and Redefine commands without using command /vl-cmdf
    By MastroLube in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 29th Dec 2015, 05:52 pm
  2. Localized AutoCAD – translated features
    By MSasu in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 7th Jan 2010, 11:42 am
  3. Undefine/Redefine Xref
    By cadprog in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 22nd Mar 2007, 11:44 am
  4. undefine
    By fuccaro in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 22nd Feb 2007, 09:22 pm
  5. Determining localized version of command
    By Autodesk in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 6th Nov 2006, 07:00 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts