Page 3 of 3 FirstFirst 123
Results 21 to 29 of 29

Thread: Lisp routines don't work

  1. #21
    I could stop if I wanted to
    Join Date
    2015-05
    Location
    West Des Moines
    Posts
    306
    Login to Give a bone
    0

    Default Re: Lisp routines don't work

    Yeah, I knew about the acadiso.lin file as well, we just don't do metric. Using the acad.lin file sounds fine on a personal level, but if you're trying to do it on a company wide level I'm not sure I understand how you set it up so that everyone is looking at the server acad.lin file. So I guess my question is if you're going to have everyone in a company point to a particular file (whether it be lisp, LT, or whatever) that you can then update as you see fit how do you go about doing that?

    As for templates, yeah we have everything in them, but about a month or two ago I helped update their LT file, they wanted them renamed, and then I put them into commands. For the time being the new linetypes aren't in any template, but they will get added eventually when we have some downtime.

  2. #22
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Lisp routines don't work

    Quote Originally Posted by Varlth View Post
    .... When I was first playing around with linetypes I was under the impression that CAD would load any linetypes from any file it saw in the search file support path, but eventually I realized that CAD doesn't (seem to) care about any linetype file not called "acad.lin". .
    AutoCAD does not care about the name of any .LIN file, nor where it's located. It doesn't even have to be in the support file search path, and AutoCAD never loads linetype definitions from a .LIN file without user interaction. IOW, it's not "autoloaded".
    Since they are super lightweight (does not add bloat to a DWG), we just load the 30 or so we use in our template(s) and rarely ever have to load them from a LIN file.
    R.K. McSwain | CAD Panacea |

  3. #23
    I could stop if I wanted to
    Join Date
    2015-05
    Location
    West Des Moines
    Posts
    306
    Login to Give a bone
    0

    Default Re: Lisp routines don't work

    If I'm understanding you properly RK I don't think you're correct on the LT files, here's what I say that

    When I was playing with the idea of referencing an acad.lin file on the server I tested to see if it worked by putting the file on the server, adding it to my support path, and then putting it at the top of my list so it overrode my computer's acad.lin file. After doing that I was able to use my lisps to draw lines with the correct linetypes, whereas previously I couldn't because it wasn't in the drawing or the acad.lin file on my computer. The way I understand it is that when you tell CAD to change to a linetype (or get any setting that could be in multiple places) it looks at the drawing first for it, if it doesn't have it it checks the acad.lin file, and if it can't find it in either place it errors out. I've seen this happen before when you update a block on the server, and try to run a lisp to insert that new block in a drawing that already has it, and instead it will just grab that old block out of the drawing because it says, "Oh I have that right here, I don't need to go look for it in any other file."

    Pretty much everything is in our template though, but we have an LT file that they were created from on the server (cause they had to be made somewhere before they were in the template). So someday the new LTs that I made will be saved in the template as per normal.

    However, as unconventional as my method may be, the one thing I do like about it is that if someone came to me and said "I need a new linetype not in our template" I can pretty quickly create the linetype, create the lisp command/add it to the linetype loader, and they could restart CAD to get it right away whereas if the drawing was already created they couldn't do that as smoothly. I'll still be keeping your method in mind though (even if I don't fully understand it yet). When I first started doing this stuff I was in a company that, at its largest, had like 8 people CADing and using the LTs, lisps, etc. Now I'm at a new job with 4 offices, and still growing. If it becomes to big to manage I may have to rethink my strategy.

  4. #24
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Lisp routines don't work

    Quote Originally Posted by Varlth View Post
    The way I understand it is that when you tell CAD to change to a linetype (or get any setting that could be in multiple places) it looks at the drawing first for it, if it doesn't have it it checks the acad.lin file, and if it can't find it in either place it errors out.
    Primarily, linetype definitions are stored in the DWG file.

    How can you "tell CAD to change to a linetype" if the linetype definition does not exist in the drawing? You can't, without loading it from some LIN file, and AutoCAD doesn't care about the name or location of the LIN file.

    There is an advantage to having the file named "acad.lin" and having it in the support file search path, because AutoCAD will search for this file and default to it when you run the LINETYPE or -LINETYPE command. But you are free to choose any file from any location once you get in the command.
    R.K. McSwain | CAD Panacea |

  5. #25
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Lisp routines don't work

    I should add that linetype definitions can be added to drawings via DesignCenter, pasting in/inserting entities from other drawings, creating entities defined in Tool Palettes, and probably a few more ways I can't recall at the moment.
    R.K. McSwain | CAD Panacea |

  6. #26
    I could stop if I wanted to
    Join Date
    2015-05
    Location
    West Des Moines
    Posts
    306
    Login to Give a bone
    0

    Default Re: Lisp routines don't work

    How can you "tell CAD to change to a linetype" if the linetype definition does not exist in the drawing?
    Code:
    (DEFUN C:SAS()
    	(setq cancel *error*)
    	(setq *error* trapUP)		
    	(setq oldlayer (getvar "clayer"))
    	(setq oldgen (getvar "plinegen"))
    	(setq oldwid (getvar "plinewid"))
    	(setvar "plinegen" 1)
    	(setvar "plinewid" 0.0)
    	(COMMAND "-LAYER" "MAKE" "UP-SS" "COLOR" "72" "" "Ltype" "U-SS" "" "" "")
    		(COMMAND "-linetype" "SET" "U-SS" "")
    		(COMMAND "PLINE" )
    		(while (> (getvar "CMDACTIVE") 0) (command pause))
    	(setvar "clayer" oldlayer)
    	(setvar "plinegen" oldgen)
    	(setvar "plinewid" oldwid)
    	(command "-linetype" "set" "Bylayer" "")
    	(setq *error* temperr)
       (princ)
    )
    I use the "-linetype" command in the lisp to change it to the linetype I want while still keeping it on the right layer. If the linetype definition doesn't exist CAD will stop halfway through the routine because it can't set it to a linetype that doesn't exist. That is what I meant by telling it to change since you can manually input anything you want in that field.

    But you are free to choose any file from any location once you get in the command.
    Yeah, but who has time for that

    I think this is where the confusion might lie. Yeah, I'm aware of the "linetype" command where you can go to any file and load any linetype you want. When I'm testing linetypes I go in there a lot to reload them to see how they turn out. My problem was that you couldn't create a file called "Utility Linetypes.lin", throw it on the server, throw it in the support path, and run the lisp like you see above and have it work since CAD would not, on its own, look for it in that file. Probably could write a lisp to look in that file though, but I never looked into it.

  7. #27
    AUGI Addict
    Join Date
    2015-12
    Posts
    2,095
    Login to Give a bone
    0

    Default Re: Lisp routines don't work

    Yes, you can have it look for any given linetype definitions file. All of our linetypes specify a source file to load from for automation, including those linetypes assigned as layer settings. Assumptions over which file to load from has caused too many problems in the past.

  8. #28
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Lisp routines don't work

    Quote Originally Posted by Varlth View Post

    I use the "-linetype" command in the lisp to change it to the linetype I want while still keeping it on the right layer.
    I gotcha now. I was not aware that the "SET" option of the LINETYPE command (and the LType Option of the Layer command) would search for, and load, the requested linetype.
    FWIW, we do use "acad.lin" and it is in the support file search path.

    One question about your lisp routine. You're creating a layer and assigning it the UP-SS linetype, then hardcoding the same linetype into the polyline you're creating. Why not just let the polyline's linetype be bylayer?
    R.K. McSwain | CAD Panacea |

  9. #29
    I could stop if I wanted to
    Join Date
    2015-05
    Location
    West Des Moines
    Posts
    306
    Login to Give a bone
    0

    Default Re: Lisp routines don't work

    One question about your lisp routine. You're creating a layer and assigning it the UP-SS linetype, then hardcoding the same linetype into the polyline you're creating. Why not just let the polyline's linetype be bylayer?
    I have about 30 commands total for each size/utility combo to where I type 15SS and I get a line with 15" SS linetype, 18SS gives 18" SS, etc. The end result is that every sanitary, storm, or water is on their respective layer with the undefined linetype as the "master" linetype, but none of them use that bylayer setting. This makes it easy to isolate a utility if needed.

    But now that I look at that one yeah, it is redundant haha. I made the commands starting with size first and worked my way down to an undefined command and was just going through the motions.

Page 3 of 3 FirstFirst 123

Similar Threads

  1. LISP routines
    By dawn.pedersen309807 in forum AutoLISP
    Replies: 25
    Last Post: 2012-08-28, 07:36 PM
  2. how do you call other lisp routines with lisp?
    By moises.y969653 in forum AutoLISP
    Replies: 1
    Last Post: 2011-02-06, 01:01 PM
  3. Torrent Reactor Routines Will Not Work Together
    By playerdraft in forum AutoLISP
    Replies: 33
    Last Post: 2010-08-06, 05:34 PM
  4. Lisp Routines
    By Shadrak in forum AutoCAD Customization
    Replies: 4
    Last Post: 2009-10-08, 01:32 AM
  5. Lisp Routines
    By jsnow in forum AutoCAD General
    Replies: 2
    Last Post: 2009-04-16, 05:07 AM

Posting Permissions

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