Results 1 to 10 of 10

Thread: Leader Lisp With Tag

  1. #1
    All AUGI, all the time BCrouse's Avatar
    Join Date
    2003-04
    Location
    Bethlehem, PA
    Posts
    980
    Login to Give a bone
    0

    Question Leader Lisp With Tag

    Can someone help me out with a lisp the uses a leader and it has a tag attached at the end ot the tail. The tags are attribute. Can the lisp please apply the leader to this layer (A-Anno-Note)?

    Thank you,

    Brad
    Attached Files Attached Files

  2. #2
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Leader Lisp With Tag

    Quote Originally Posted by BCrouse
    Can someone help me out with a lisp the uses a leader and it has a tag attached at the end ot the tail. The tags are attribute. Can the lisp please apply the leader to this layer (A-Anno-Note)?

    Thank you,

    Brad
    Hi Brad

    There is idea only, but maybe this will help to you
    Make blocks with name "SQUARE-NUMBER" "TRIANGLE-NUMBER" and "ROUND-NUMBER"
    and than run this routine (of course it's very quick and dirty)
    No warranty

    Thank you

    f.

    Code:
    (defun set-lay	(cdoc l_name lt_name col / alrs alts nl tbl tblt tmp tmp1)
      (setq	alrs (vla-get-layers cdoc)
    	alts (vla-get-linetypes cdoc)
    	tbl  (vlax-for l_item  alrs
    	       (setq tmp (cons (vla-get-name l_item) tmp)))
    	tblt (vlax-for lt_item	alts
    	       (setq tmp1 (cons (vla-get-name lt_item) tmp1)))
    	)
      (if (not (member lt_name tblt))
        (vla-load alts (strcase lt_name) "acadiso.lin")) ;or acad.lin
      (if (member l_name tbl)
        (progn
          (if (/= (vla-get-name (vla-get-activelayer cdoc)) l_name)
    	(setq nl (vla-put-activelayer cdoc (vla-add alrs l_name)))
    	(setq nl (vla-get-activelayer cdoc))
    	)
          (vla-put-color (vla-item alrs l_name) col)
          (vla-put-linetype nl lt_name)
          )
        (progn
          (setq nl (vla-add alrs l_name))
          (vla-put-activelayer cdoc nl)
          (vla-put-color (vla-item alrs l_name) col)
          (vla-put-linetype nl lt_name)
          )
        )
      (if (/= (vlax-variant-value
    	    (vla-getvariable cdoc "CECOLOR"))
    	  "BYLAYER")
        (vla-setvariable cdoc "CECOLOR" "BYLAYER")
        )
      (if (= (vla-get-layeron nl) :vlax-false)
        (vla-put-layeron nl :vlax-true)
        )
      (if (= (vla-get-freeze nl) :vlax-true)
        (vla-put-freeze nl :vlax-false)
        )
      (if (= (vla-get-lock nl) :vlax-true)
        (vla-put-lock nl :vlax-false)
        )
      (princ)
      )
    
    (prompt "\n\t\t>>> Type TLD to run routine")
    
    (defun C:tld (/ acsp adoc anno_blk atts clr lead mtpt nmb
    	      oclr oexp otm pt ptlist tmparray tmpvar)
      (vl-load-com)
    
      (setq oclr (getvar "CLAYER"))
      (setq otm (getvar "ORTHOMODE"))
      (setq oexp (getvar "EXPERT"))
      (setvar "ORTHOMODE" 0)
      (setvar "EXPERT" 0)
      (setq	adoc (vla-get-activedocument
    	       (vlax-get-acad-object)))
      (setq acsp (vla-get-modelspace adoc))
      (vla-endundomark adoc)
      (vla-startundomark adoc)
      (setq nmb (getstring "\nEnter block number : \n"))
      (initget "S T R")
      (setq ans (getkword "\nChoose block type [S]quare [T]riangle [R]ound <S>"))
      (if (not ans) (setq ans "S"))
      (setq blk_name
      (cond ((eq ans "S") "SQUARE-NUMBER")
    	((eq ans "T") "TRIANGLE-NUMBER")
    	((eq ans "R") "ROUND-NUMBER")
    	))
      (setq pt (getpoint "Specify leader start point: "))
      (setq ptlist (cons pt ptlist))
      (while (setq pt (getpoint "Specify next point: " pt))
        (setq ptlist (cons pt ptlist)
    	  )
        )
      (setq mtpt (car ptlist))
      (setq ptlist (reverse ptlist))
      (setq ptlist (apply 'append ptlist))
      (setq	tmparray
    	 (vlax-make-safearray
    	   vlax-vbdouble
    	   (cons 0 (- (length ptlist) 1))
    	   )
    	)
    
      (vlax-safearray-fill tmparray ptlist)
      (setq tmpvar (vlax-make-variant tmparray))
      (setq	anno_blk (vla-insertblock
    		   acsp
    		   (vlax-3d-point mtpt)
    		   blk_name
    		   1
    		   1
    		   1
    		   0))
      (set-lay adoc "A-ANNO-NOTE" "Continuous" "32")
      (vla-put-layer anno_blk "A-ANNO-NOTE")
      (setq atts (vlax-invoke anno_blk 'Getattributes))
      (foreach at  atts
        (if	(eq (vlax-get at 'Tagstring) "NUMBER")
          (progn
    	(vlax-put at 'Textstring nmb)
    	(vla-update at))))
      (setq lead (vla-addleader acsp tmpvar anno_blk aclinewitharrow)) ;change by suit
      (vla-put-arrowheadsize lead 0.0625) ;change by suit
      (vla-update lead)
      (vlax-release-object lead)
      (vla-regen adoc acactiveviewport)
      
      (setvar "CLAYER" oclr)
      (setvar "ORTHOMODE" otm)
      (setvar "EXPERT" oexp)
      (vla-endundomark adoc)
      (princ)
      )

  3. #3
    All AUGI, all the time BCrouse's Avatar
    Join Date
    2003-04
    Location
    Bethlehem, PA
    Posts
    980
    Login to Give a bone
    0

    Thumbs up Re: Leader Lisp With Tag

    Fixo,

    Thank you very much for the beginning part of the idea. When I run the lisp. It comes up with an Automation Error and Filer error. It will not let me choose an end point.



    Brad

  4. #4
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Leader Lisp With Tag

    Quote Originally Posted by BCrouse
    Fixo,

    Thank you very much for the beginning part of the idea. When I run the lisp. It comes up with an Automation Error and Filer error. It will not let me choose an end point.



    Brad
    Hi Brad

    I slightly edited routine possibly now it will work for you
    See attachment
    (Tested in A2005 only)

    Thank you

    f.
    Attached Files Attached Files

  5. #5
    All AUGI, all the time BCrouse's Avatar
    Join Date
    2003-04
    Location
    Bethlehem, PA
    Posts
    980
    Login to Give a bone
    0

    Default Re: Leader Lisp With Tag

    Quote Originally Posted by fixo
    Hi Brad

    I slightly edited routine possibly now it will work for you
    See attachment
    (Tested in A2005 only)

    Thank you

    f.
    Fixo,

    I am getting and automatiion error: Undefined linetype! Can you please look at

    I think it is at Line 11 and Line 117 and 118.

    I would fix it but I don't know how.


    Thank you,

    Brad

  6. #6
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Leader Lisp With Tag

    Quote Originally Posted by BCrouse
    Fixo,

    I am getting and automatiion error: Undefined linetype! Can you please look at

    I think it is at Line 11 and Line 117 and 118.

    I would fix it but I don't know how.


    Thank you,

    Brad
    Hi Brad

    I don't know why this not work for you
    I loaded this routine into all your drawings many times and always
    it work fine for me
    Ok I edited this routine a lot and added error traping
    but this idea don't like to me
    I think here need another way with calculation of intersection points
    between leader and block and than redraw there are on normal location
    (differently for all block types: square, round and triangle)
    I'm not a math and I don't know how it will be done

    Thank you

    f.
    Attached Files Attached Files

  7. #7
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: Leader Lisp With Tag

    I took your second lisp & added an error check if the block was not in the drawing.
    This adds the ".DWG" to the block name & then checks to see if it exist.

    Also the block names are changed as they did not match those Brad posted.

    Routine works for me although it leader & scale may need some work.
    Attached Files Attached Files

  8. #8
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Leader Lisp With Tag

    Quote Originally Posted by ab2draft
    I took your second lisp & added an error check if the block was not in the drawing.
    This adds the ".DWG" to the block name & then checks to see if it exist.

    Also the block names are changed as they did not match those Brad posted.

    Routine works for me although it leader & scale may need some work.

    Thanks for support CAB

    I will test your program tomorrow, today I very busy on another work
    and I would wait flashback from our Brad

    f.

  9. #9
    All AUGI, all the time BCrouse's Avatar
    Join Date
    2003-04
    Location
    Bethlehem, PA
    Posts
    980
    Login to Give a bone
    0

    Default Re: Leader Lisp With Tag

    Quote Originally Posted by fixo
    Hi Brad

    I don't know why this not work for you
    I loaded this routine into all your drawings many times and always
    it work fine for me
    Ok I edited this routine a lot and added error traping
    but this idea don't like to me
    I think here need another way with calculation of intersection points
    between leader and block and than redraw there are on normal location
    (differently for all block types: square, round and triangle)
    I'm not a math and I don't know how it will be done

    Thank you

    f.
    Thank you very much. I got it to work. Just one more thing to ask you. Can you change the bylayer color to cyan?

    Than you,

    Brad

  10. #10
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Leader Lisp With Tag

    Quote Originally Posted by BCrouse
    Thank you very much. I got it to work. Just one more thing to ask you. Can you change the bylayer color to cyan?

    Than you,

    Brad
    Hi Brad

    Try edited version

    Thank you

    f.
    Attached Files Attached Files

Similar Threads

  1. Leader lisp
    By arussell2003385516 in forum AutoLISP
    Replies: 1
    Last Post: 2013-07-22, 08:41 AM
  2. LEADER. LISP
    By Scooby in forum AutoLISP
    Replies: 19
    Last Post: 2013-02-15, 05:32 PM
  3. Leader lisp help
    By jdcincy in forum AutoLISP
    Replies: 8
    Last Post: 2012-03-09, 08:06 PM
  4. BCount Leader LISP
    By jmarck in forum AutoLISP
    Replies: 15
    Last Post: 2010-08-06, 01:50 PM
  5. Replies: 4
    Last Post: 2006-09-15, 08:04 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
  •