See the top rated post in this thread. Click here

Page 4 of 9 FirstFirst 12345678 ... LastLast
Results 31 to 40 of 85

Thread: insert block (all predefined) break line inserted on

  1. #31
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: insert block (all predefined) break line inserted on

    Can you post the file you are trying it in? Not the whole thing ofcourse, but the portion with the line (or whatever you are trying to insert the block into). I'm curiouse now why it won't work for you. I will post it as a zip file, maybe you can download that.

    Tim
    Attached Files Attached Files

  2. #32
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Re: insert block (all predefined) break line inserted on

    I opened your drawing and it worked, but it won't work in mine.

    there must be some variable in the drawing that isn't right? Thanks for checking it out.

    the zip was downloadable thankfully, lol. weird.

  3. #33
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: insert block (all predefined) break line inserted on

    I think I know what is happening. You are working in a custom ucs, not world. I think when it grabs the points it is grabbing wcs points.
    Code:
    (defun c:InsertNBreak (/ Sel Ent InsPt LastEnt tmpObj tmpList)
    
    (vl-load-com)
    (if (setq Sel (entsel "\n Select object where you the block to be inserted: "))
     (progn
      (setq Ent (car Sel))
      (setq InsPt (cadr Sel))
      (initdia)
      (command "_.insert")
      (command InsPt)
      (while (> (getvar "cmdactive") 0)
       (command pause)
      )
      (setq LastEnt (entlast))
      (setq tmpObj (vlax-ename->vla-object LastEnt))
      (setq tmpList (vlax-invoke tmpObj 'Explode))
      (foreach i tmpList
       (if (= (vla-get-ObjectName i) "AcDbPolyline")
        (setq IntPts (vlax-invoke i 'IntersectWith (vlax-ename->vla-object Ent) acExtendNone))
       )
      )
      (command "_.break"
        Ent
        (trans (list (car IntPts) (cadr IntPts) (caddr IntPts)) 0 1) ; had to add trans to both points
        (trans (cdddr IntPts) 0 1) ; here is the second point
      )
      (foreach i tmpList
       (vla-Delete i)
      )
      (command ".ddatte" LastEnt)
     )
    )
    (princ)
    )
    This should work now. I should have asked that at the beginning. Brain fart, what can I say. =D

    Tim

  4. #34
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Re: insert block (all predefined) break line inserted on

    lol... hang on a sec let me try it!

    ha ha ha i was thinking the same but wasn't sure..... i was running out of rules that could be screwing it up.

  5. #35
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Re: insert block (all predefined) break line inserted on

    one last thing.

    how do you suppress the edite attribute dialogue box so it is at the command line instead of a dialogue box when editing attribute... can it treat it like a normal block insertion when you insert the block the command line prompts you for the attribute info and the question i made in the attdef?

  6. #36
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Re: insert block (all predefined) break line inserted on

    i notice it doesn't work on arcs? do i just add that to the lisp or can you?

    bye the way.... it worked great on straight line segments, and i saw the notes you added to the lisp routine. this is a great script!

    hopefully you can figure out the arc thing and the attribute thing, attribute is no big deal really but i'm just being being picky, lol.

    thanks again. YOU DA MAN!
    Last edited by 09silverado; 2005-12-30 at 08:52 PM.

  7. #37
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: insert block (all predefined) break line inserted on

    Try this one.
    Code:
    (defun c:InsertNBreak (/ Sel Ent InsPt LastEnt tmpObj tmpList tmpList2 tmpEntData BlkRefEnt tmpEnt)
    
    (vl-load-com)
    (if (setq Sel (entsel "\n Select object where you the block to be inserted: "))
     (progn
      (setq Ent (car Sel))
      (setq InsPt (cadr Sel))
      (initdia)
      (command "_.insert")
      (command InsPt)
      (while (> (getvar "cmdactive") 0)
       (command pause)
      )
      (setq LastEnt (entlast))
      (setq tmpObj (vlax-ename->vla-object LastEnt))
      (setq tmpList (vlax-invoke tmpObj 'Explode))
      (foreach i tmpList
       (if (= (vla-get-ObjectName i) "AcDbPolyline")
        (setq IntPts (vlax-invoke i 'IntersectWith (vlax-ename->vla-object Ent) acExtendNone))
       )
      )
      (command "_.break"
        Ent
        (trans (list (car IntPts) (cadr IntPts) (caddr IntPts)) 0 1) ; had to add trans to both points
        (trans (cdddr IntPts) 0 1) ; here is the second point
      )
      (foreach i tmpList
       (vla-Delete i)
      )
      (setq tmpList nil)
      (setq tmpEnt LastEnt)
      (while (= (cdr (assoc 0 (entget (setq tmpEnt (entnext tmpEnt))))) "ATTRIB")
       (setq tmpList (cons (cons (cdr (assoc 2 (entget tmpEnt))) tmpEnt) tmpList))
      )
      (setq BlkRefEnt (tblobjname "block" (cdr (assoc 2 (entget LastEnt)))))
      (while (setq BlkRefEnt (entnext BlkRefEnt))
       (setq tmpEntData (entget BlkRefEnt))
       (if (= (cdr (assoc 0 tmpEntData)) "ATTDEF")
        (setq tmpList2 (cons (cons (cdr (assoc 2 tmpEntData)) (cdr (assoc 3 tmpEntData))) tmpList2))
       )
      )
      (foreach i tmpList
       (setq tmpEntData (entget (cdr i)))
       (if (setq iList (assoc (car i) tmpList2))
        (entupd
         (cdr
          (assoc
           -1
           (entmod
            (subst
             (cons 1 (getstring (strcat "\n" (cdr iList) " ")))
             (assoc 1 tmpEntData)
             tmpEntData
            )
           )
          )
         )
        )
       )
      )
     )
    )
    (princ)
    )
    Let me know if this works for you.

    Tim

  8. #38
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Re: insert block (all predefined) break line inserted on

    that is awesome.

    awesome awesome awesome

    except... it didn't appear to fix the arc issue, how on earth are you goint to get it to recognize the arc, break command is funky on an arc!?

    where did you ever learn all this? wow.

    otherwise it's great!
    Last edited by 09silverado; 2005-12-30 at 09:49 PM.

  9. #39
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: insert block (all predefined) break line inserted on

    I don't see a problem with arc's on my computer even if I change the ucs, and use funky rotation. You might just have to live with that one, unless someone knows why it is happening.

    I am pretty much self taugh on lisp, I have had help from a lot of people on groups likes this, so I try to give back when I can.

    Good luck on you last test!! Happy new years.

    Tim

  10. #40
    AUGI Addict truevis's Avatar
    Join Date
    2004-07
    Location
    Massachusetts, USA
    Posts
    1,191
    Login to Give a bone
    0

    Default Re: insert block (all predefined) break line inserted on

    Always consider that OSNAPs may be on so unless you've set OSMODE to 0, make sure your code works in all cases by adding "non" before all points entered with the 'command' function. E.g.:

    (command "_.insert" "CL1-20.dwg" "non" InsPt "" "" )
    Last edited by truevis; 2005-12-30 at 10:29 PM.

Page 4 of 9 FirstFirst 12345678 ... LastLast

Similar Threads

  1. Insert block and break any line in its way
    By jgratton in forum AutoLISP
    Replies: 23
    Last Post: 2017-09-26, 08:12 PM
  2. LISP trim/break line inserting block
    By aldiyars1925 in forum AutoLISP
    Replies: 1
    Last Post: 2008-09-09, 01:33 PM
  3. VBA project - draw a line of polyline, then insert a block
    By jbortoli in forum VBA/COM Interop
    Replies: 0
    Last Post: 2007-05-14, 08:01 AM
  4. routine for insert block break line
    By Hammer.John.J in forum VBA/COM Interop
    Replies: 4
    Last Post: 2006-01-06, 02:55 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
  •