+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    Junior Member
    Using
    Mechanical 2009
    Join Date
    Sep 2009
    Posts
    11

    Default Block Insert Lisp

    Registered forum members do not see this ad.

    I am currently working for a cabinet company that provides drawings using over 250,000 different blocks. I am looking to see if anyone has written a lisp program that would make the insertion of these said blocks a lot easier...

    Currently I have just been using the AutoCAD insert command and then browsing to find the correct folder that stores the different kinds of cabinet styles, then looking for the specific block name. I worked for a previous cabinet company that had this same set up but they would type in a command and it would bring up a pop up menu where I could then type in the name of the block and it would insert it no matter what folder it was in.

    With having over 250,000 blocks I can't really use a pallette to pull from as I wouldn't know where to begin....

    Any help would be greatly appreciative, sorry I don't know much about lisp programming but trying to learn.

  2. #2
    Super Moderator rkmcswain's Avatar
    Computer Details
    rkmcswain's Computer Details
    Operating System:
    Windows 10
    Computer:
    HP Z240
    CPU:
    i7-7700k @ 4.20GHz
    RAM:
    64GB
    Graphics:
    Nvidia Quadro P1000
    Primary Storage:
    0.5TB SSD
    Secondary Storage:
    1TB SATA
    Monitor:
    Vizio 40"
    Discipline
    Civil
    Using
    Civil 3D 2019
    Join Date
    Sep 2005
    Location
    Houston
    Posts
    4,607

    Default

    Take a look at the Symbol Manager in Toolpac,
    http://dotsoft.com/toolpac.htm
    R.K. McSwain
    CAD Panacea | twitter

  3. #3
    Junior Member
    Using
    Mechanical 2009
    Join Date
    Sep 2009
    Posts
    11

    Default

    That is a very interesting add-on program that I might be able to try...Not sure how well it will work seeing how I don't really know the blocks other than by the names and not the pictures, I could try messing around with it. Is there no Autolisp code that I could manipulate to work with the multiple folders and blocks that I have?

    I currently manipulated a lisp file someone sent me that showed me how to use a command to insert a block, I started doing it for more cabinets but with 250,000+ blocks it would take too long....

    Code:
     
    (defun c: xxxxxxx ()
    (setq insertpt1 (getpoint "\nPick Lower Left Corner of the cabinet: "))
    (command "_insert" "G:\\DRAFTERS\\Casework\\yyyyyyy.dwg" insertpt1 "" "" "")
    (princ)
    )
    This code defines only one block....I want to be able to not have to change the command name (xxxxxxx) to access the entire folder of blocks and then type in the block name (yyyyyyy) in a second window to insert it.....
    Last edited by rkmcswain; 13th Jul 2010 at 02:23 pm. Reason: add CODE tags

  4. #4
    Forum Newbie
    Using
    AutoCAD 2010
    Join Date
    Apr 2010
    Posts
    5

    Default

    You could try something like this, but all of the blocks need to be in AutoCAD's support path

    Code:
    (defun c:xxxx ( / strBlockName insertpt1)
      (setq strBlockName (getstring "\nEnter Block Name: "))
      (setq insertpt1 (getpoint "\nPick Lower Left Corner of the cabinet: "))
      (if (and insertpt1 (findfile (strcat strBlockName ".dwg")))
        (command "_insert" strBlockName insertpt1 "" "" "")
        (prompt "\nBlock not found in support path! ")
      )
    (princ)
    )

  5. #5
    Junior Member
    Using
    Mechanical 2009
    Join Date
    Sep 2009
    Posts
    11

    Default

    Thank God someone was able to help me with this....Thank you mtaussie. I've been looking in a Visual Lisp programming book I received from an old co-worker. I was going to spend today trying to tackle DCL files and some how getting it to work with the Lisp code I already had, but this code that you have provided works perfectly. Thank you for the great help.

  6. #6
    Forum Newbie
    Discipline
    Civil
    Using
    AutoCAD 2017
    Join Date
    Apr 2018
    Posts
    3

    Default Help me

    Thank you for the answer, but is there any condition for the file saved in the support path?
    What is the location of the support path?

    Quote Originally Posted by mtaussie View Post
    you could try something like this, but all of the blocks need to be in autocad's support path

    Code:
    (defun c:xxxx ( / strblockname insertpt1)
      (setq strblockname (getstring "\nenter block name: "))
      (setq insertpt1 (getpoint "\npick lower left corner of the cabinet: "))
      (if (and insertpt1 (findfile (strcat strblockname ".dwg")))
        (command "_insert" strblockname insertpt1 "" "" "")
        (prompt "\nblock not found in support path! ")
      )
    (princ)
    )

  7. #7
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,800

    Default

    I think your approaching this from the wrong direction, it sounds like your just using a block for every combo ie 2x4 3x4 etc it would be much better if you spent a little bit of time looking at dynamic blocks you can have 1 block with a certain style but a multitude of variations that can be just simply adjusted, at the simplest a square, click on it enter length and width. The other way is to look at lips to draw the cabinets these can be a library of a few different styles again just ask questions and its drawn. To draw something complex may be just answer 8 questions the 9th is where do you want it.

    Have a search here for David Bethel and look at some of his images the equipment is drawn in full 3d just answering questions.
    A man who never made mistakes never made anything

  8. #8
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,800

    Default

    Have a look at this it will draw a simple table any size its only an example it could be expanded to a full cut list dimensioned and so forth. I really do think if you have that many blocks you are doing something wrong. Automation even if you have to pay will save thousands very quickly. There are plenty here who would be able to provide a couple of freebies and a price to seriously reduce your 250,00 std dwgs dependance and time savings accuracy etc.

    Code:
    (defun drawlegs (pt1 legL legw /  )
    (setq pt2 (polar pt1 0.0 legL))
    (setq pt3 (polar pt2 (/ pi 2.0) legw))
    (setq pt4 (polar pt3 pi legL))
    (command "pline" pt1 pt2 pt3 pt4 "C")
    )
    (defun c:tab-legs ( / l w pt thk l1 H)
    (setq oldsnap (getvar 'osmode))
    (setvar 'osmode 0)
    (setq l (getdist "Enter L"))
    (setq w (getdist "Enter W"))
    (setq thk (getdist "enter thickness"))
    (setq H (getdist "Enter height"))
    (setq l1 (getdist "Enter leg size"))
    (setq pt (getpoint "Pick start point"))
    (drawlegs pt l w)
    (command "extrude" "last" "" thk)
    (command "move" "L" "" (list 0.0 0.0 0.0) (list 0.0 0.0 H))
    (drawlegs pt l1 l1)
    (command "extrude" "last" "" H)
    (setq pt (polar pt 0.0 (- l l1)))
    (drawlegs pt l1 l1)
    (command "extrude" "last" "" H)
    (setq pt (polar pt (* pi 0.5) (- w l1)))
    (drawlegs pt l1 l1)
    (command "extrude" "last" "" H)
    (setq pt (polar pt pi (- l l1)))
    (drawlegs pt l1 l1)
    (command "extrude" "last" "" H)
    (command "-vpoint" '(1 1 1 ))
    (setvar 'osmode oldsnap)
    )
    (C:legs)
    PS just had a look and our library area etc has 777 dwgs some of these are just so old. We have 363 dwg images in our current menu's some more than others we use.

    Post a couple of blocks that are basicly the same thing but with different sizes etc and we could comment about how hard to reproduce asking size questions.
    Last edited by BIGAL; 10th Aug 2018 at 04:04 am.
    A man who never made mistakes never made anything

  9. #9
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    1,106

    Default

    I totally agree with Bigal that cleaning up & combining blocks is the way to go... 250,000 blocks...pfff how on earth did they end up with so many. Something that may give you a little help in at least get a sort of visual overview : http://www.cadtutor.net/forum/showth...light=rlxpaste
    Its not a very smart insert util , but you can at least get a visual on what your dealing with by using the add folder button. Its an oldie so hope it still works...


    gr. Rlx

  10. #10
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    949

    Default

    Registered forum members do not see this ad.

    You could also try something like this .. but agreed 250,000 blocks is insane.
    Code:
    (defun c:foo (/ p d)
      (cond	((and (setq d (getfiled	"\nPick a block to insert: "
    				(if (findfile "G:\\DRAFTERS\\Casework")
    				  "G:\\DRAFTERS\\Casework"
    				  (getvar 'dwgprefix)
    				)
    				"dwg"
    				8
    		      )
    	      )
    	      (setq p (getpoint "\nPick Lower Left Corner of the cabinet: "))
    	 )
    	 (command "_.insert" d p "" "" "")
    	)
      )
      (princ)
    )

Similar Threads

  1. Help with insert block LISP
    By Demesne in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 14th May 2010, 02:01 pm
  2. block insert lisp
    By flopo in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 27th Nov 2009, 04:42 pm
  3. Help For Lisp Divide And Then Insert Block
    By MR MAN in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 7th Jul 2009, 02:13 pm
  4. Need a Special Insert Block LISP
    By MikeP in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 15th Jan 2009, 05:48 pm

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