Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Acaddoc.lsp routine "if" test for loading aeccland.lin

  1. #1
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Acaddoc.lsp routine "if" test for loading aeccland.lin

    i need to do an "if" expression to determine "if" the linetypes called "TREELINE_R", "TREELINE_L" & "STONEWALL" are loaded into every drawing i open.

    Then, if they exist i want to reload them.

    If they do not exist i want to load them for the first time. here is the code i have to date in my acaddoc.lsp file but it is automatically activating the _help command for some reason, can somebody check this code out? thanks

    Code:
    ;loads the aeccland tree lines to your drawing
    (command "-linetype" "load" "TREELINE_R" "AeccLand.lin" "" "")
    
    (command "-linetype" "load" "TREELINE_L" "AeccLand.lin" "" "")
    
    (command "-linetype" "load" "STONEWALL" "AeccLand.lin" "" "")
    the reason i have the double quotes, is because when the linetypes exists it prompts to determine if you want to reload them, so i put in a "" to act as an "enter" for "yes" and then another "" to exit the routine.

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Acaddoc.lsp routine "if" test for loading aeccland.lin

    Check the LTYPE table with the tblsearch function.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Re: Acaddoc.lsp routine "if" test for loading aeccland.lin

    so here some similar code to see if layers exist but i'm not sure if that is right either and where to put LTYPE in the routine, where do i put that phrase? thanks!

    Code:
    (if (tblsearch "LAYER" "defpoints");;test if layer exists
    (command "-layer" "thaw" "defpoints" "on" "defpoints" "") ;do this if exists
    (command "-layer" "n" "defpoints" "c" "63" "defpoints" "");do this if not
    )
    code that needs work:

    Code:
    ;loads the aeccland tree lines to your drawing
    (command "-linetype" "load" "TREELINE_R" "AeccLand.lin" "" "")
    
    (command "-linetype" "load" "TREELINE_L" "AeccLand.lin" "" "")
    
    (command "-linetype" "load" "STONEWALL" "AeccLand.lin" "" "")

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Acaddoc.lsp routine "if" test for loading aeccland.lin

    Code:
    (foreach n '('("TREELINE_R" "AeccLand.lin")
    	     '("TREELINE_L" "AeccLand.lin")
    	     '("STONEWALL" "AeccLand.lin")
    	    )
      (if (tblsearch "LTYPE" (car n))
        (command "-linetype" "load" (car n) (cadr n) "")
      )
    )
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  5. #5
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Re: Acaddoc.lsp routine "if" test for loading aeccland.lin

    pure genius.

    Code:
    bows down to master, princ
    EDIT
    OOOOH, wait, I tried that on a blank template supplied in the "templates" folder from autodesk and it did not load the linetypes? did i miss something?

    i copied it just like you pasted it above, do i have to put your code after mine someplace?

  6. #6
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Re: Acaddoc.lsp routine "if" test for loading aeccland.lin

    See message above, i edited my post but wasn't sure if emailed you so i posted again, for some reason it isn't loading the linetypes when they do not exist in, say, a blank drawing.

    I probably missed something there, do i need to add your code to mine some how your just replace mine with yours?

  7. #7
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Acaddoc.lsp routine "if" test for loading aeccland.lin

    Quote Originally Posted by 03xtreme View Post
    See message above, i edited my post but wasn't sure if emailed you so i posted again, for some reason it isn't loading the linetypes when they do not exist in, say, a blank drawing.

    I probably missed something there, do i need to add your code to mine some how your just replace mine with yours?
    You asked for it to reinsert the linetypes if they were already loaded. Are the linetypes loaded in the blank template?
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  8. #8
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Re: Acaddoc.lsp routine "if" test for loading aeccland.lin

    mmmm.... no, the blank templates and many drawings do not have or use all linetypes from our .lin files. I guess i should load all the linetypes into each MMI template. You did what I asked for, but i forgot to ask you to load them if they didn't exist like my layer example does, which i think works??? It works on drawings but i doubt the code is great on that.

    past princ, defun, and a few other code lingo is all i got, and i can read through the routine i just don't understand what forevery n is and cadr is, etc. i'm ignorant... but getting better. I guessed that n was "instance" and that you are using '(' as the search item?

    anyways:
    i'd like to silent load my MMI.lin file and a few aeccland.lin also, i could go and re-insert the tree linetypes and stone wall from aeccland.lin into my MMI.lin file if that makes this easier....

    i know this is a catch 22, because purge is a favorite for drawing cleanup, but if i can force load linetypes then I don't have to worry about ignorant people looking for stuff that experts purge out. We have 45 people pulling licenses in 5 different states, so it's hard to keep track.

    if this is a big deal, don't worry about it. I just really wanted to have the linetypes reloaded if they existed like you did... but since i cought your ear

  9. #9
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Acaddoc.lsp routine "if" test for loading aeccland.lin

    Then take out the if statement and just reload the linetypes.
    Code:
    (foreach n '('("TREELINE_R" "AeccLand.lin")
    	     '("TREELINE_L" "AeccLand.lin")
    	     '("STONEWALL" "AeccLand.lin")
    	    )
      (if (tblsearch "LTYPE" (car n))
        (command "-linetype" "load" (car n) (cadr n) "")
      )
    )
    Remove the items in blue.
    Last edited by Opie; 2008-06-26 at 09:12 PM. Reason: Changed color to blue
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  10. #10
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Re: Acaddoc.lsp routine "if" test for loading aeccland.lin

    can't see the red and i KNOW i'm not color blind, lol.

Page 1 of 2 12 LastLast

Similar Threads

  1. 2015: "New" doesn't load acaddoc.lsp
    By DaveP in forum AutoCAD General
    Replies: 3
    Last Post: 2014-07-29, 06:23 PM
  2. Issue on Loading "acaddoc.lsp"
    By BeKirra in forum AutoLISP
    Replies: 6
    Last Post: 2012-11-29, 12:38 AM
  3. Replies: 0
    Last Post: 2012-06-06, 11:54 AM
  4. Replies: 5
    Last Post: 2008-02-19, 11:33 PM

Posting Permissions

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