Results 1 to 4 of 4

Thread: Block Insert Lisp Problem

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2013-04
    Posts
    1
    Login to Give a bone
    0

    Default Block Insert Lisp Problem

    I want this lisp to insert the block to dimscale and set the rotation to 0. The insertion works with the scale but I am prompted for a rotation rather than defaulting me to 0 rotation. Could use a more advanced users help. Thanks in advanced!

    Code:
    ;;; Lisp for Symbol-Blocks insertion 
    ; Uses insert command to insert selected Symbol Blocks
    (defun symblkinsertscale (/ NAME)
       (setq NAME (strcat "Z:/_ACAD Library/2014 Custom Menu/stdlib/" symblkname))
       (setq LTSCA (getvar "dimscale"))  
       (command "insert" NAME pause LTSCA "" PAUSE "")
    )
    
    
    ;;
    ; Sets BLOCK name (SYMBLKname)
    (defun c:drop () (setq symblkname "Concrete Drop") (SYMBLKINSERTSCALE))    ;;;;;;;; SCALE
    (defun c:mc () (setq symblkname "mc") (SYMBLKINSERTSCALE))    ;;;;;;;; SCALE
    (defun c:vbarrow () (setq symblkname "vb-arrow") (SYMBLKINSERTSCALE))    ;;;;;;;; SCALE
    (defun c:slmk () (setq symblkname "slmk") (SYMBLKINSERTSCALE))    ;;;;;;;; SCALE
    (defun c:ctrln () (setq symblkname "ctrln_stl ln") (SYMBLKINSERTSCALE))    ;;;;;;;; SCALE
    Last edited by Opie; 2014-10-16 at 01:40 PM. Reason: [code] tags added

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

    Default Re: Block Insert Lisp Problem

    In your code, do you see where it is running the "insert" command? On that line, there are two pauses, which are asking for user input. The first pause is asking for the insertion point. The second is asking for the rotation.

    Can you handle it from there?
    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
    Member
    Join Date
    2006-07
    Location
    Currently Vancouver BC
    Posts
    47
    Login to Give a bone
    0

    Default Re: Block Insert Lisp Problem

    (command "insert" NAME pause (getvar "dimscale") (getvar "dimscale") 0)

  4. #4
    I could stop if I wanted to
    Join Date
    2015-12
    Posts
    385
    Login to Give a bone
    0

    Default Re: Block Insert Lisp Problem

    I have coded below 2 different ways of doing it. My style then a single line style that is more similar to your posted code.
    Code:
    ;ReachAndre method___________________________________________
    (defun c:drop (/ bn bs rl cqaflags)  
      (setq bn "Concrete Drop"); sets block name
      (setq bs (getvar "Dimscale")); set block scale to dimscale
      (if (= (getvar 'cvport) 1)(setq bs 1)); if in paperspace set block scale to 1
      
      (command "-insert" bn "S" bs "R" 0 pause);inserts block with rotation of 0
      (princ))
    
    
    
    ;nturley369932_ish method___________________________________________
    (defun sym_blk_insert_scale ()
      (setq blk_insert_scale (getvar "Dimscale"));set blk_insert_scale to dimscale
      (princ (strcat "\" blk_insert_scale = " (rtos blk_insert_scale))) ;display scale in command line 
      (princ))
    
    (defun c:drop (/ sym_blk_name) (sym_blk_insert_scale) (setq sym_blk_name "Concrete Drop") (command "-insert" sym_blk_name "S" blk_insert_scale "R" 0 pause)(princ))

Similar Threads

  1. insert block using pickbox (lisp)
    By mitchellvoss in forum AutoLISP
    Replies: 2
    Last Post: 2014-01-17, 12:10 PM
  2. HELP......With Insert Block Lisp From Excel File
    By CADdancer in forum AutoLISP
    Replies: 1
    Last Post: 2013-06-25, 08:47 PM
  3. Simple Lisp To Insert Block
    By omorah in forum AutoCAD Customization
    Replies: 4
    Last Post: 2013-04-12, 09:06 PM
  4. insert block attribute lisp
    By john.237249 in forum AutoLISP
    Replies: 8
    Last Post: 2010-06-15, 02:25 PM
  5. Using LISP to insert a Dynamic block
    By Ferroequine in forum Dynamic Blocks - Technical
    Replies: 10
    Last Post: 2010-03-25, 02:23 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
  •