Results 1 to 5 of 5

Thread: Simple Lisp To Insert Block

  1. #1
    I could stop if I wanted to
    Join Date
    2001-11
    Posts
    236
    Login to Give a bone
    0

    Default Simple Lisp To Insert Block

    I have spent the past three and quarter hours searching, finding, trying, modifying lisps and still not successful. Now I need some help!

    - I have this file 'EDL.DWG" located at "L:/AutoCAD/Template/EDL.dwg".
    - I have created a button in my personal toolbar.

    GOAL:
    1. Pick the created toolbar button,
    2. Pick desired insertion point,
    3. That's it! After #2 level, the function escapes and back to where I was before.

    Thanks in advance

  2. #2
    I could stop if I wanted to
    Join Date
    2015-10
    Location
    Colorado Springs, CO
    Posts
    369
    Login to Give a bone
    0

    Default Re: Simple Lisp To Insert Block

    You don't need a lisp, a macro in your button will suffice. You also don't need to include the path as long as the path is part of your support search paths.

    ^C^C-I;EDL;

    This will still prompt you for scale and rotation, but I know there is a way to fill those in also if they are static. I can't remember how off the top of my head though.

    OR you could use toolpalletes and have the desired functions with less coding.

  3. #3
    Active Member
    Join Date
    2015-09
    Location
    Québec (Bas-St-Laurent)
    Posts
    90
    Login to Give a bone
    0

    Default Re: Simple Lisp To Insert Block

    Here's a lisp I did many years ago, never tested past ACAD 2000. It basically inserts a block that is in your search path at a predetermined scale and includes the DimScale variable. I can't remember for the life of me why I did that. Anyway, its simple code, change to your needs.
    Just a clarification: the lisp inserts a drawing containing a block, and THEN inserts the block.

    Code:
    (DEFUN c:fleche	(/ sc clay)
      (setvar "cmdecho" 0)
      (COMMAND "INSERT"
    	   "Fleche01.dwg"
    	   "S"
    	   (SETQ sc (GETVAR "dimscale"))
    	   (GETPOINT)
    	   pause
      ) ;_ end of command
      (SETVAR "texteval" 0)
      (setvar "CLAYER" "Cote")
      (COMMAND "text" "J" "MC" pause (* 0.18 sc) 0.0 "A")
      (COMMAND "INSERT" "Fleche02.dwg" "S" sc (GETPOINT) pause)
      (setq clay (getvar "CLAYER"))
      (SETVAR "texteval" 1)
      (setvar "CLAYER" clay)
    ) ;_ end of defun
    Last edited by Opie; 2013-04-12 at 01:21 PM. Reason: [code] tags added ~Opie

  4. #4
    Member
    Join Date
    2012-11
    Posts
    14
    Login to Give a bone
    0

    Default Re: Simple Lisp To Insert Block

    Like Coloradomrg said, a lisp can be used but it not necessary.

    You would use one of these macros depending on how you block was created. If your block was created with the "Scale uniformly" option checked then use this one:
    Code:
    ^C^C-insert;L:/AutoCAD/Template/EDL.dwg;\;;
    Otherwise use this one:
    Code:
    ^C^C-insert;L:/AutoCAD/Template/EDL.dwg;\;;;
    Another question, do you want your block inserted at a scale other than 1? If so, use the following codes:
    Code:
    ^C^C-insert;L:/AutoCAD/Template/EDL.dwg;\<insert scale here>;;
    Code:
    ^C^C-insert;L:/AutoCAD/Template/EDL.dwg;\<insert x-scale here>;<insert y-scale here>;;

  5. #5
    I could stop if I wanted to
    Join Date
    2001-11
    Posts
    236
    Login to Give a bone
    0

    Default Re: Simple Lisp To Insert Block

    I sure appreciate everyone's help here. I appologize I should have clarified more on my need(s) which would have made it more easier for anyone to help me.

    For this block, I don't need to scale it to anything, all I need is the block in the currently opened file. It looks like I got more than I needed and will surely use the other codes for other issues I have at hand now.

    Thanks you all again, well appreciated!

Similar Threads

  1. Block Insert Lisp Problem
    By nturley369932 in forum AutoLISP
    Replies: 3
    Last Post: 2014-10-17, 05:41 PM
  2. insert block using pickbox (lisp)
    By mitchellvoss in forum AutoLISP
    Replies: 2
    Last Post: 2014-01-17, 12:10 PM
  3. insert block attribute lisp
    By john.237249 in forum AutoLISP
    Replies: 8
    Last Post: 2010-06-15, 02:25 PM
  4. Using LISP to insert a Dynamic block
    By Ferroequine in forum Dynamic Blocks - Technical
    Replies: 10
    Last Post: 2010-03-25, 02:23 PM
  5. Replies: 0
    Last Post: 2008-04-10, 12:58 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
  •