+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Forum Newbie
    Using
    AutoCAD 2014
    Join Date
    Jan 2016
    Posts
    5

    Default Create sample LISP to insert block

    Registered forum members do not see this ad.

    Hi,

    I search for Lisp for insert block faster.

    Ex.: if a write "1" on keyboard, i can insert "block 1" in my drawing. I can insert "block 1" until a stop the LISP

    if a write "2" on keyboard, i can insert "block 2" in my drawing. I can insert "block 2" until a stop the LISP

    All my block are in the same drawing.

    Thanks a lot

  2. #2
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro K4200, 4GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2018
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    46,357

    Default

    Do you really think using a number as a way to invoke a lisp routine for inserting a block is a good idea? What happens after you have loaded and run the lisp routine 1.lsp the first time you actually need to use the number "1" in your drawing as an actual number?
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

    I'm now a full member of the Society for the Promotion of Mediocrity in CAD. Standards? We don't need no stinkin' standards! Take whatever advice I offer and do the opposite.

  3. #3
    Luminous Being RobDraw's Avatar
    Using
    MEP 2017
    Join Date
    Apr 2007
    Location
    Connecticut, USA
    Posts
    5,161

    Default

    With all of the ways available for inserting blocks, LISP is hardly necessary.

    Are you maybe looking for something that will insert the same block multiple times without needing to use the COPY command?
    Drafting is a breeze.

  4. #4
    Super Moderator Cad64's Avatar
    Computer Details
    Cad64's Computer Details
    Operating System:
    Windows 7 Profesional x64
    Computer:
    XI Computers
    Motherboard:
    Asus P8Z77-V Pro
    CPU:
    Intel Core I7 3770K 4.1 Ghz Quad Core 3rd Gen
    RAM:
    24GB DDR3 @ 1333MHz
    Graphics:
    Nvidia GeForce GTX 570 1280MB GDDR5
    Primary Storage:
    SATAII 500GB 7200 RPM
    Secondary Storage:
    Western Digital My Book Studio Edition II - 2TB capacity
    Monitor:
    HPf2105 21" LCD Widescreen & Cintiq 21ux
    Discipline
    Multi-disciplinary
    Cad64's Discipline Details
    Occupation
    Freelance Digital Artist
    Discipline
    Multi-disciplinary
    Details
    3D model building, texturing and rendering. Photoshop Color Graphics.
    Using
    AutoCAD 2014
    Join Date
    Feb 2006
    Location
    Southern California
    Posts
    10,139
    CGSociety Portfolio: http://rdeweese.cgsociety.org/
    Facebook:
    https://www.facebook.com/rdeweese67/


    "Work Smart, Not Hard"

  5. #5
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,716

    Default

    Remark (defun c:39 () (setvar "osmode" 39))

    LINE pick point drag mouse with ortho on type 39 no probs line is 39 long.

    But yeah insert blocks palette, slides, menu etc lots of ways.
    A man who never made mistakes never made anything

  6. #6
    Super Member hanhphuc's Avatar
    Using
    AutoCAD 2007
    Join Date
    Apr 2013
    Location
    Happy Garden
    Posts
    555

    Default

    Quote Originally Posted by BIGAL View Post
    Remark (defun c:39 () (setvar "osmode" 39))

    LINE pick point drag mouse with ortho on type 39 no probs line is 39 long.

    But yeah insert blocks palette, slides, menu etc lots of ways.
    Using defun c:39 just need one step, simply invoke command 39

    Alternative,
    If blocks exist in drawing, i prefer a simple defun using initget & getkword
    just setq bn (eg: block name is 39) etc..
    (command "insert" bn pt 1)

    But this requires 2 steps, invoke command , then 39
    lambda not optimized.. ( apply '= "hp" "happy" "hạnh phúc" "ハッピー" "幸福" "행복" ) ; error: too many arguments

  7. #7
    Super Moderator Cad64's Avatar
    Computer Details
    Cad64's Computer Details
    Operating System:
    Windows 7 Profesional x64
    Computer:
    XI Computers
    Motherboard:
    Asus P8Z77-V Pro
    CPU:
    Intel Core I7 3770K 4.1 Ghz Quad Core 3rd Gen
    RAM:
    24GB DDR3 @ 1333MHz
    Graphics:
    Nvidia GeForce GTX 570 1280MB GDDR5
    Primary Storage:
    SATAII 500GB 7200 RPM
    Secondary Storage:
    Western Digital My Book Studio Edition II - 2TB capacity
    Monitor:
    HPf2105 21" LCD Widescreen & Cintiq 21ux
    Discipline
    Multi-disciplinary
    Cad64's Discipline Details
    Occupation
    Freelance Digital Artist
    Discipline
    Multi-disciplinary
    Details
    3D model building, texturing and rendering. Photoshop Color Graphics.
    Using
    AutoCAD 2014
    Join Date
    Feb 2006
    Location
    Southern California
    Posts
    10,139

    Default

    I have moved this question to the Autolisp section: http://www.cadtutor.net/forum/forumd...l-LISP-amp-DCL
    CGSociety Portfolio: http://rdeweese.cgsociety.org/
    Facebook:
    https://www.facebook.com/rdeweese67/


    "Work Smart, Not Hard"

  8. #8
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,716

    Default

    B29 B43 B56 it can be done look at this http://www.cadtutor.net/forum/showth...-radius./page3 just add a "B" option.
    A man who never made mistakes never made anything

  9. #9
    Super Member hanhphuc's Avatar
    Using
    AutoCAD 2007
    Join Date
    Apr 2013
    Location
    Happy Garden
    Posts
    555

    Default

    Quote Originally Posted by BIGAL View Post
    B29 B43 B56 it can be done look at this http://www.cadtutor.net/forum/showth...-radius./page3 just add a "B" option.
    That's great idea by reactor
    im sure many draft persons love this!!

    p/s : ive seen many draft using number defun (c:30 c:40 etc..) as snapang etc..
    may conflict? due to defun is global variable
    lambda not optimized.. ( apply '= "hp" "happy" "hạnh phúc" "ハッピー" "幸福" "행복" ) ; error: too many arguments

  10. #10
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,716

    Default

    Registered forum members do not see this ad.

    I may add the "B" option it may rain this weekend. So long as the block name has no spaces it should work. So thats "B" "C" "O" & "F" used, any other ideas anyone.
    A man who never made mistakes never made anything

Similar Threads

  1. Create & Insert block - by grabbing info from another dwg to user specified XY
    By loveboatcaptain in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 29th Jan 2014, 09:11 am
  2. Insert a block by lisp: _.insert or another way?
    By MarcoW in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 3rd Nov 2010, 10:40 am
  3. Insert block, add circle, exlode, create block
    By rookie37 in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 29th Jun 2010, 10:40 pm
  4. Create & Insert Block Through Macro
    By comcu in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 18th Nov 2007, 05:04 pm
  5. How to create/insert a 'block' via an icon?
    By Ste1978 in forum AutoCAD Drawing Management & Output
    Replies: 14
    Last Post: 30th Jan 2007, 12:22 pm

Tags for this Thread

Bookmarks

Posting Permissions

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