Results 1 to 5 of 5

Thread: allowing block preview with lisp

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

    Talking allowing block preview with lisp

    Hey yall,
    Here is a lisp that I wrote, I would like to know how to get the block to show up before I pick a pickpoint. (Much like the donut command works, or the normal insert block command works.) How do you do this? Here is the lisp. Im still new so if this is comical please feel free to laugh, I wont be offended.
    Thanks in advance everyone

    Code:
    (DEFUN C:S2  (/ Pt1) (while(setq Pt1 (getpoint "nSelect location of sleeve: "))
    		       (setq Pt2 (getpoint "Select location of sleeve label: "))(COMMAND "LAYER" "m" "SLV-SAN" "" "INSERT" "SL-2" Pt1 (/ 1 1)"" "" "LAYER" "m" "SLV-TEXT" "" "INSERT" "TEXT2" Pt2 (/ 1 1)"" "" "EXPLODE" "LAST" "" ""))
    (princ))
    [ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]
    Last edited by Opie; 2006-04-21 at 01:32 PM. Reason: [CODE] tags added, see moderator comment

  2. #2
    Member
    Join Date
    2006-04
    Location
    Dublin. Ireland
    Posts
    9
    Login to Give a bone
    0

    Default Re: allowing block preview with lisp

    I'm not too long at this kind of thing either but I'll give it a shot.



    Code:
    (setq cl (getvar "clayer"))
    
    (if (not (tblsearch "layer" "SLV-SAN"))
    (command "layer" "new" "SLV-SAN" "colour" "2" "SLV-SAN" "")
    )
    
    (setvar "clayer" "SLV-SAN")
    
    (command "._-insert" "SL-2" (getpoint (strcat "\nSelect location of sleeve: ")) "1" "1" "0")
    
    (if (not (tblsearch "layer" "SLV-TEXT"))
    (command "layer" "new" "SLV-TEXT" "colour" "2" "SLV-TEXT" "")
    )
    
    (setvar "clayer" "SLV-TEXT")
    
    (command "._-insert" "SLV-TEXT" (getpoint (strcat "\Select location of sleeve label: ")) "1" "1" "0")
    
    (setvar "clayer" cl)
    [ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]
    Last edited by Opie; 2006-04-21 at 01:32 PM. Reason: [CODE] tags added, see moderator comment

  3. #3
    Certifiable AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    3,508
    Login to Give a bone
    0

    Talking Re: allowing block preview with lisp

    Quote Originally Posted by ReachAndre
    Hey yall,
    Here is a lisp that I wrote, I would like to know how to get the block to show up before I pick a pickpoint. (Much like the donut command works, or the normal insert block command works.) How do you do this? Here is the lisp. Im still new so if this is comical please feel free to laugh, I wont be offended.
    Thanks in advance everyone

    Code:
    (DEFUN C:S2  (/ Pt1) (while(setq Pt1 (getpoint "nSelect location of sleeve: "))
    		       (setq Pt2 (getpoint "Select location of sleeve label: "))(COMMAND "LAYER" "m" "SLV-SAN" "" "INSERT" "SL-2" Pt1 (/ 1 1)"" "" "LAYER" "m" "SLV-TEXT" "" "INSERT" "TEXT2" Pt2 (/ 1 1)"" "" "EXPLODE" "LAST" "" ""))
    (princ))
    Here's a quick fix. This doesn't promt you for the "location of sleeve" or "sleeve label" but it allows you to see the block before you pick the insertion point.

    Also, if the block has attributes, it allows you to fill in the fields.
    Why do you explode the second block? When exploded, it reverts to it's original layer, and if you're using attributes, they become attribute "definintions", unless you're using nested blocks.

    Code:
    (DEFUN C:S2 ()
    (COMMAND "LAYER" "m" "SLV-SAN" "" "INSERT" "SL-2" pause (/ 1 1)"" "" "LAYER" "m" "SLV-TEXT" "" "INSERT" "SLV-TEXT" pause (/ 1 1)"" "" "EXPLODE" "LAST" "" "")
    (princ))
    Ted

    [ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]
    Last edited by Opie; 2006-04-21 at 01:33 PM. Reason: [CODE] tags added, see moderator comment

  4. #4
    Member
    Join Date
    2006-04
    Location
    Dublin. Ireland
    Posts
    9
    Login to Give a bone
    0

    Default Re: allowing block preview with lisp

    Woops, I just realised that what I suggested wont preview the block. The only other thing I can think of is to use pause as Ted suggested.

  5. #5
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: allowing block preview with lisp

    Check the command prompt options for the insert command
    Specify insertion point or [Basepoint/Scale/X/Y/Z/Rotate/PScale/PX/PY/PZ/PRotate]:

    Then just reorder the options like this :

    (command "._-insert" "MyBlock" "Rotate" 0 "Scale" 1 )

    . . . and preview the block before inserting it

    : ) Happy Computing !

    kennet

Similar Threads

  1. Block preview on cursor
    By seanjames in forum AutoCAD General
    Replies: 12
    Last Post: 2010-08-04, 08:02 PM
  2. Block Thumbnail Preview
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2010-06-15, 04:29 PM
  3. Bully Application not allowing lisp's to load
    By JSelf in forum AutoCAD Customization
    Replies: 3
    Last Post: 2008-11-04, 07:27 PM
  4. Block Preview
    By mulyadi_ibrahim in forum VBA/COM Interop
    Replies: 2
    Last Post: 2008-09-16, 07:37 PM
  5. Block preview not available
    By fat.mongrel in forum AutoCAD General
    Replies: 3
    Last Post: 2007-07-12, 07:31 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
  •