+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 17 of 17
  1. #11
    Senior Member
    Using
    AutoCAD 2011
    Join Date
    Jan 2014
    Posts
    169

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by Cad64 View Post
    The only things you have to edit in the code are the layer names. Everything else stays the same. You said you want your hatch layer at the very back, so that layer name should be at the bottom of the list, then arrange your other layers in the order you want them to display above the hatch layer. See below.

    Code:
    ;;; OrderByLayer.lsp 
    ;;; By 3wood 2015.12.24 
    ;;; Change the layer name and add more layers to suit. 
    ;;; The first layer will be sent to front and the last layer sent to back. 
    (defun C:OrderByLayer ()   
    (command "._DRAWORDER" (ssget "_A" '((8 . "Top_Layer"))) "" "_B")   
    (command "._DRAWORDER" (ssget "_A" '((8 . "Middle_Layer"))) "" "_B")   
    (command "._DRAWORDER" (ssget "_A" '((8 . "Hatch_Layer"))) "" "_B")
    )
    Nope, something is not right. I copy&pasted your code, substituted the layers name with my layers name and i ordered by descending order, wit HATCH being on the bottom.

    I loaded the LISP, and in fact it recognized the orderbylayer command, which appeared, so I did , enter, on that, and I got the following message:

    Enter object ordering option {Above project/Under object/Front/Back } <Back>: _B

    I couldn't interact, I gave ok and nothing happened... I tried by giving " Above" "Under".... but no feedback.

    What leaves me skeptic is that I shouldn't prompt anything, the code already organizes the layers that finds by the order in the code... so why it asks for other things?

    SOmething is wrong with the way the code is built then. I'd like something that after being run, it fixes the layers on the given order.. I don't want to give other instructions.

  2. #12
    Super Moderator Cad64's Avatar
    Computer Details
    Cad64's Computer Details
    Operating System:
    Windows 7 Profesional x64
    Computer:
    XI Computers
    Motherboard:
    Asus P8Z77-V Pro
    CPU:
    Intel Core I7 3770K 4.1 Ghz Quad Core 3rd Gen
    RAM:
    24GB DDR3 @ 1333MHz
    Graphics:
    Nvidia GeForce GTX 570 1280MB GDDR5
    Primary Storage:
    SATAII 500GB 7200 RPM
    Secondary Storage:
    Western Digital My Book Studio Edition II - 2TB capacity
    Monitor:
    HPf2105 21" LCD Widescreen & Cintiq 21ux
    Discipline
    Multi-disciplinary
    Cad64's Discipline Details
    Occupation
    Freelance Digital Artist
    Discipline
    Multi-disciplinary
    Details
    3D model building, texturing and rendering. Photoshop Color Graphics.
    Using
    AutoCAD 2014
    Join Date
    Feb 2006
    Location
    San Antonio, TX
    Posts
    10,313

    Default

    I already tested the code before posting it and it works perfectly. You shouldn't be prompted for anything. You should just type the command, hit enter and that's it.

    Here are some things to check:
    1. When you changed the layer names, did you remove the quotes around the names?
    2. Did you accidentally delete a parenthesis?
    3. Did you accidentally misspell any of the layer names? If the layer names in the code are not spelled exactly the same as the layer names in your drawing, or if the layer names in the code do not exist in the drawing, you will get an error. The layer names need to match exactly.

    Double check your layer name list and if you're still having problems, post your code in your next reply.
    Last edited by Cad64; 1st Mar 2018 at 04:37 pm.
    CGSociety Portfolio: http://rdeweese.cgsociety.org/
    Facebook:
    https://www.facebook.com/rdeweese67/


    "Work Smart, Not Hard"

  3. #13
    Senior Member
    Using
    AutoCAD 2011
    Join Date
    Jan 2014
    Posts
    169

    Default

    Quote Originally Posted by Cad64 View Post
    I already tested the code before posting it and it works perfectly. You shouldn't be prompted for anything. You should just type the command, hit enter and that's it.

    Double check your layer name list and if you're still having problems, post your code in your next reply.
    Thanks Cad64, well it doesn't work, so, something is not right
    Actually it got worse, it doesn't even recognize the name of the command.

    I checked everything, layer names are fine, i didn't change a thing from your code. Please see the attached drawing with the layer naming, and see how i applied your code, by simply substituting the layer names.

    If it works for you , please can you check the one I edeted for my layers and see if it works in the attached dwg? if it does, please can you upload it back with the working lisp?

    many thanks!
    Alex
    Attached Files

  4. #14
    Super Moderator Cad64's Avatar
    Computer Details
    Cad64's Computer Details
    Operating System:
    Windows 7 Profesional x64
    Computer:
    XI Computers
    Motherboard:
    Asus P8Z77-V Pro
    CPU:
    Intel Core I7 3770K 4.1 Ghz Quad Core 3rd Gen
    RAM:
    24GB DDR3 @ 1333MHz
    Graphics:
    Nvidia GeForce GTX 570 1280MB GDDR5
    Primary Storage:
    SATAII 500GB 7200 RPM
    Secondary Storage:
    Western Digital My Book Studio Edition II - 2TB capacity
    Monitor:
    HPf2105 21" LCD Widescreen & Cintiq 21ux
    Discipline
    Multi-disciplinary
    Cad64's Discipline Details
    Occupation
    Freelance Digital Artist
    Discipline
    Multi-disciplinary
    Details
    3D model building, texturing and rendering. Photoshop Color Graphics.
    Using
    AutoCAD 2014
    Join Date
    Feb 2006
    Location
    San Antonio, TX
    Posts
    10,313

    Default

    Ok, first things first. In order for a lisp routine to work, it has to be saved with a .lsp extension. You had it saved with a .txt extension. I have changed the file extension.

    Next, you added the word "Code:" at the top of the routine. You can't add comments to a lisp routine unless you precede the comment with at least one semicolon. I have removed the word "Code:" from the routine.

    You also removed the quotes from the layer names. All layer names must have quotes around them. I have added the quotes around the layer names.

    Try the attached. This should work.
    Attached Files
    CGSociety Portfolio: http://rdeweese.cgsociety.org/
    Facebook:
    https://www.facebook.com/rdeweese67/


    "Work Smart, Not Hard"

  5. #15
    Senior Member
    Using
    AutoCAD 2011
    Join Date
    Jan 2014
    Posts
    169

    Default

    Quote Originally Posted by Cad64 View Post
    Ok, first things first. In order for a lisp routine to work, it has to be saved with a .lsp extension. You had it saved with a .txt extension. I have changed the file extension.

    Next, you added the word "Code:" at the top of the routine. You can't add comments to a lisp routine unless you precede the comment with at least one semicolon. I have removed the word "Code:" from the routine.

    You also removed the quotes from the layer names. All layer names must have quotes around them. I have added the quotes around the layer names.

    Try the attached. This should work.
    Yes it works very well thans when i write the command, it gets executed right away but it still comes up with the attached request... anyway, as far as it works, it's great.

    Little problem now that i didn't think about before... can we make the lisp to function within a specific block of the drawing?
    See the DWG i sent you, and on which the LISP works fine, it is a file background that gets cut and inserted by a software to a chart, which will be the main drowing. I tried to use the lisp on the chart and it didn't work, so i had to open up the block and execute it from within the block.
    Problem is that the cad i have is particularly rusty, or maybe is the PC.. it takes minutes for the block to load. Now, I don't have time to fix the PC or CAD, ( and maybe these are not fixable ) so the easiest way is to make the LISP to work on a specific block within the main drawing. is this possible?
    Attached Images

  6. #16
    Super Moderator Cad64's Avatar
    Computer Details
    Cad64's Computer Details
    Operating System:
    Windows 7 Profesional x64
    Computer:
    XI Computers
    Motherboard:
    Asus P8Z77-V Pro
    CPU:
    Intel Core I7 3770K 4.1 Ghz Quad Core 3rd Gen
    RAM:
    24GB DDR3 @ 1333MHz
    Graphics:
    Nvidia GeForce GTX 570 1280MB GDDR5
    Primary Storage:
    SATAII 500GB 7200 RPM
    Secondary Storage:
    Western Digital My Book Studio Edition II - 2TB capacity
    Monitor:
    HPf2105 21" LCD Widescreen & Cintiq 21ux
    Discipline
    Multi-disciplinary
    Cad64's Discipline Details
    Occupation
    Freelance Digital Artist
    Discipline
    Multi-disciplinary
    Details
    3D model building, texturing and rendering. Photoshop Color Graphics.
    Using
    AutoCAD 2014
    Join Date
    Feb 2006
    Location
    San Antonio, TX
    Posts
    10,313

    Default

    Quote Originally Posted by cat3appr View Post
    can we make the lisp to function within a specific block of the drawing?
    Now you're going beyond my ability. I do ok with simple routines but if you need to add more functionality like working inside a block, you will need to consult with one of the programmer's in the lisp section. You should start a new thread here: http://www.cadtutor.net/forum/forumd...l-LISP-amp-DCL and tell them what you're trying to do. You might also want to provide a link back to this thread so they can see what has already been discussed.
    CGSociety Portfolio: http://rdeweese.cgsociety.org/
    Facebook:
    https://www.facebook.com/rdeweese67/


    "Work Smart, Not Hard"

  7. #17
    Senior Member
    Using
    AutoCAD 2011
    Join Date
    Jan 2014
    Posts
    169

    Default

    Registered forum members do not see this ad.

    ok thank you!

Similar Threads

  1. Alter draw order of selection set on different layers
    By cletero in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 31st Aug 2014, 08:17 pm
  2. Draw Order
    By Squirltech in forum AutoCAD Bugs, Error Messages & Quirks
    Replies: 3
    Last Post: 13th Oct 2010, 06:27 pm
  3. Draw Order?
    By criehle in forum AutoCAD Beginners' Area
    Replies: 6
    Last Post: 17th Mar 2009, 08:16 am
  4. Draw Order
    By lenback in forum AutoCAD General
    Replies: 1
    Last Post: 21st Nov 2008, 02:35 pm
  5. Draw order
    By johnengineer in forum AutoCAD Beginners' Area
    Replies: 7
    Last Post: 3rd Aug 2007, 09:21 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