Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Thread: .lsp vs .mnl

  1. #1
    100 Club
    Join Date
    2006-10
    Location
    Connecticut
    Posts
    158
    Login to Give a bone
    0

    Default .lsp vs .mnl

    What is the difference between these two file extensions? Are they both implemented the same way if for example I want a toolbar button to do a certain command?

    I set up my first custom toolbar last week and used a mnl file and created a cui file to link a command to a button. Is it the same process for a .lsp file where I have to customize a button and have the macro link to that file?

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,420
    Login to Give a bone
    0

    Default Re: .lsp vs .mnl

    A lsp file has to be explicitly loaded, whereas an mnl file is automatically loaded with the cui, provided it has the same base name as the cui. e.g. MyMenu.cui, MyMenu.mnl. The mnl can be used to load any lsp files it requires or the button macro can demand load the lsp.
    C:> ED WORKING....


    LinkedIn

  3. #3
    100 Club
    Join Date
    2006-10
    Location
    Connecticut
    Posts
    158
    Login to Give a bone
    0

    Default Re: .lsp vs .mnl

    Okay, so if I put the lsp file in the cad support file folder, similar to the mnl and cui files, I can create a customized button that when I click on it, it will run the lsp file?

  4. #4
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,420
    Login to Give a bone
    0

    Default Re: .lsp vs .mnl

    Yes, here is a typical button macro for demand loading.
    ^C^C^P(if (null c:cloud)(load "cloud"));cloud;
    C:> ED WORKING....


    LinkedIn

  5. #5
    100 Club
    Join Date
    2006-10
    Location
    Connecticut
    Posts
    158
    Login to Give a bone
    0

    Default Re: .lsp vs .mnl

    Sorry, still new to this stuff, what is demand loading?
    And would I need to create a new button for each lisp command I had? So if I found one on a forum that was for a layer delete, I would create a button with a giant L on it just for that. and then if i found one for say change all layers to 0, I would make another button for that. but within the macro for each button i had to have it specify which file I wanted it to link back to. Is this correct?

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

    Default Re: .lsp vs .mnl

    Pretty much.
    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

  7. #7
    100 Club
    Join Date
    2006-10
    Location
    Connecticut
    Posts
    158
    Login to Give a bone
    0

    Default Re: .lsp vs .mnl

    Okay, making a little more sense. What text has to go in the macro tab in the toolbar customizing? next to the ^C^C that is there by default?

    for example I am trying to add this lisp to a toolbar.

    Code:
    ;;; CADALYST 04/07  Tip 2200: ADX.lsp 	Aligned Multiple Line Text 	(c) 2007 David Harrington 
    
    (DEFUN DTR (Z)
      (* PI (/ Z 180.0))
    )
    (defun RTD (Z) (/ (* Z 180.0) PI))
    
    (defun text_angle (point1 point2 / point_angle)
      (setq point_angle (angle point1 point2))
      (if (or (>= point_angle (* pi 1.5)) (<= point_angle (dtr 91.0)))
        (setq l nil)
        (setq point_angle (angle point2 point1))
      )
      (setq point_angle (rtd point_angle))
    )
    (defun getnearpt ()
      (princ "\nSelect on object :")
      (setq	point1	 (cadr (nentsel))
    	textsize (* (getvar "dimtxt") (getvar "dimscale"))
      )
      (setvar "osmode" 512)
      (if point1
        (progn
          (command ".line"
    	       point1
    	       (polar point1 0.01 (* textsize 0.01))
    	       ""
          )
          (setq listvar (entget (setq ent (entlast)))
    	    p1	    (trans (cdr (assoc 10 listvar)) 0 1)
    	    p2	    (trans (cdr (assoc 11 listvar)) 0 1)
    	    ang	    (text_angle p1 p2)
          )
          (setq pt2 (polar point1 (+ (dtr ang) (* pi 0.5)) 10.0))
          (setq pt3 (inters point1 pt2 p1 p2 nil))
          (entdel ent)
          (command ".id" "mid" pt3)
          (setq lpt (getvar "lastpoint"))
          (if (< (distance lpt pt3) (* 2 textsize))
    	(setq pt3 lpt)
          )
        )
        (setq pt3 nil)
      )
    )
    (defun c:ADX (/ pt1 ts lst end p1 p2 ang spt JST ELST old1 oldosmode)
      (princ "\n   ADX - Add Mtext multiple times")
      (setvar "cmdecho" 0)
      (SETQ oldosmode (getvar "osmode"))
      (setvar "TSPACEFAC" 1.0)
      (getnearpt)
      (setvar "osmode" 0)
      (initdia 1)
      (command ".mtext" pt3	"j" "mc" "r" ang "l" "A" "1.25x" "w" "0")
      (setq val (cdr (assoc 1 (entget (entlast)))))
      (if (NOT (vl-string-search "\\P" VAL))
        (setq jst 2)
      )
      (if (= jst 2)
        (progn
          (setq elst (entget (entlast)))
          (setq old1 (assoc 1 elst))
          (setq elst (subst	(cons 1 (strcat (cdr (assoc 1 elst)) "\\P "))
    			(assoc 1 elst)
    			elst
    		 )
          )
          (entmod elst)
        )
      )
      (while pt3
        (princ "\nPick locations to place additional text :")
        (getnearpt)
        (if	pt3
          (progn
    	(IF JST
    	  (command ".mtext"
    		   pt3
    		   "j"
    		   "mc"
    		   "r"
    		   ang
    		   "l"
    		   "A"
    		   "1.25x"
    		   "w"
    		   0
    		   (STRCAT val "\\P ")
    		   ""
    	  )
    	  (command ".mtext" pt3 "j" "mc"	"r" ang	"l" "A"	"1.25x"	"w" 0
    		   val "")
    	)
          )
        )
      )(princ "\nPick locations to place additional text")
      (command ".mtext"
    	   (GETVAR "LASTPOINT")
    	   "l"
    	   "a"
    	   "1x"
    	   "w"
    	   "0"
    	   ""
      )
      (entdel (entlast))
      (setvar "osmode" oldosmode)
      (princ)
    )
    (princ "\nADX loaded.")
    (princ)
    Last edited by Opie; 2007-11-07 at 07:05 PM. Reason: [CODE] tags added

  8. #8
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,420
    Login to Give a bone
    0

    Default Re: .lsp vs .mnl

    Using the macro code I gave you earlier, you need to substitute "c:adx". That is the symbol name of the command, while "adx" is what you would type at the command line.

    The IF function checks to see if the symbol (c:adx) is defined, if not, it runs the (load) function. After that, the macro runs the command.
    C:> ED WORKING....


    LinkedIn

  9. #9
    100 Club
    Join Date
    2006-10
    Location
    Connecticut
    Posts
    158
    Login to Give a bone
    0

    Default Re: .lsp vs .mnl

    okay, so the macro would look like

    ^C^C^P(if (null c:adx)(load "adx"));adx;

    the lisp file itself can be named anything, right? or is it like the mnl file where it needs the same name as the cui?

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

    Default Re: .lsp vs .mnl

    The lisp file needs to be named the same as what you put in the load statement.
    Code:
    (load "adx")
    The above statement would load a file named adx.lsp. If it is not found, an error will occur. If you want it named something else, change the load statement to the same name.
    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

Page 1 of 3 123 LastLast

Posting Permissions

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