+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Senior Member
    Using
    AutoCAD 2009
    Join Date
    Oct 2009
    Posts
    171

    Default Insert a block w/o inserting a block?

    Registered forum members do not see this ad.

    I am creating a lisp to use dimlinear to draw beams for structural drawings. What I'm doing is creating a custom user arrow to create a gap at the ends of the beams. For moment connections I am using Datum and Datum filled. I am also using DOT for drag connections and BOX for hinge ends. However the stock arrow heads do not come with a gap.

    At first I was going to create more custom ones for them. When I tried that I found it was not easy to edit the arrow heads with Quick Properties. If the arrow head is already "Userd arrow" I could not simply select it again and find it. I would have to click a stock one first THEN go back to "User arrow". So what I did was edit the stock ones to give me the gap I want. This would make it feel similar to what Revit does.

    This is where the LISP comes in. I wrote a lisp to draw a beam on the correct layer and skip text input. What I want my lisp to do is insert my edited "stock" arrow head blocks if they do not already exist. I knwo how to use tblsearch to find if they exist.

    What I want to do is insert the 5 blocks I want with out actually picking insertion points and then having to delete them after. I hope this makes sense. Below is a picture of what I am looking to do.

    beams.jpg

  2. #2
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,948

    Default

    Open your Template file (.DWT), and insert all of your custom arrow head blocks, then delete the instances shown in model space... be sure to leave the block references (i.e., do no purge the block references). Perhaps even setup your default Dimension Style(s). Save.

    Now every time you open a new drawing from your template, the custom arrow heads are already available.

    Hope this helps!
    "Potential has a shelf life." - Margaret Atwood

  3. #3
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2011
    Join Date
    Apr 2008
    Posts
    6,011

    Default

    For something like that, I'd keep them in the template, as RenderMan said, but I'd also put them in a separate DWG and have them inserted in the drawing at startup. That way, you can safely purge or open a drawing that wasn't created with the template and still have the desired arrowhead blocks.
    I use this method for dim/text/mleader styles.

    Here's the code I keep in our acaddoc.LSP file:
    Code:
      (command "_.insert" "CES-DIMSETUP=" nil)
      (command "_.purge" "_b" "CES-DIMSETUP" "_n")
    The first line will only insert the block definition, which brings in all styles and block definitions existing withing the DWG. The second line is optional, but it just purges the inserted block definition our, keeping everything that's actually wanted/needed.
    DropBox | finding the light...
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  4. #4
    Senior Member
    Using
    AutoCAD 2009
    Join Date
    Oct 2009
    Posts
    171

    Default

    Registered forum members do not see this ad.

    Awesome thanks for your help. The (command "...) line works great. apparently it doesn't work with (vl-cmdf "_.insert" "block nill). It kept giving me an error.

    I do have it in the template. I just wanted to program a failsafe into the lisp just incase it those blocks were purged in a maintenance process. The lisp looks like this.

    (defun C:BEAM (/ CRlayr CRecho *error* pt1 pt2)
    (setq CRlayr (getvar "CLAYER"))
    (setq CRecho (getvar "CMDECHO"))
    ;-------------------------------------------------------------------------
    (setq *error* ;;;resets sysvar incase of
    (lambda (msg) ;;;an error, esc, exit, cancel
    (setvar "CMDECHO" CRecho)
    (setvar "CLAYER" CRlayr)
    (princ msg)
    (princ)))
    ;---------------------------------------------------------------
    (setvar "CMDECHO" 0)
    (if
    (= (tblsearch "layer" "S-STEL-BEAM") nil)
    (vl-cmdf "_.layer" "new" "S-STEL-BEAM" "color" "4" "S-STEL-BEAM" "set" "S-STEL-BEAM" "")
    (setvar "CLAYER" "S-STEL-BEAM")
    );if
    (if
    (= (tblsearch "block" "_Beam") nil)
    (progn
    (command "_.insert" "_Beam" nil);;;;I figure if this block is not inuse the others have not been inserted either. I will probably chage this area and run a check for each block
    (command "_.insert" "_BoxBlank" nil)
    (command "_.insert" "_DatumBlank" nil)
    (command "_.insert" "_DatumFilled" nil)
    (command "_.insert" "_Dot" nil)
    );prong
    );if
    (if
    (= (tblsearch "dimstyle" "LPAS-BEAM") nil)
    (progn
    (vl-cmdf "_.dimstyle" "restore" "Standard")
    (_beam_setup);;;;;runs subroutine to set dimvars
    (vl-cmdf "_.dimstyle" "save" "LPAS-BEAM")
    )
    (vl-cmdf "_.dimstyle" "restore" "LPAS-BEAM")
    );if
    (setq pt1 (getpoint "\nSelect start of beam: "))
    (setq pt2 (getpoint "\nSlect end of beam: " pt1))
    ;(setvar "CLAYER" "S-STEL-BEAM")
    (vl-cmdf "_.dimstyle" "r" "LPAS-BEAM")
    (vl-cmdf "_.dimaligned" pt1 pt2 "t" " " pt1)
    (setvar "CLAYER" CRlayr)
    (setvar "CMDECHO" CRecho)
    (princ)
    )

Similar Threads

  1. how to delete a block from the Insert block list
    By Brantis in forum AutoCAD Drawing Management & Output
    Replies: 6
    Last Post: 26th Jul 2012, 09:16 am
  2. Insert a "sub"-block into existing block definition
    By Carsten Trolle in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 11th Jul 2010, 10:07 pm
  3. Insert a "sub"-block into existing block definition
    By Carsten Trolle in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 6th Jul 2010, 01:04 pm
  4. 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
  5. block in block insert attributes
    By johny4901 in forum AutoCAD Drawing Management & Output
    Replies: 0
    Last Post: 10th Jun 2010, 08:37 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