Results 1 to 10 of 10

Thread: Block attribute prefill LISP stops in ACAD2019

  1. #1
    Member
    Join Date
    2011-02
    Posts
    5
    Login to Give a bone
    0

    Default Block attribute prefill LISP stops in ACAD2019

    Hi All,

    I've had a great lisp for a few years that has worked really well.
    The LISP is built on Jimmy Bergmark's AreaText LISP, but attached the area values to a block instead.

    Just upgraded from ACAD2015 to ACAD2019 and it now gets stuck at the final step of attaching attributes to the block (line ~74 in the code).

    Does anyone have any ideas whats wrong?

    Cheers,
    KJ
    Attached Files Attached Files

  2. #2
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Block attribute prefill LISP stops in ACAD2019

    Hi,
    Try to replace the command call command with vl-cmdf function.

  3. #3
    Member
    Join Date
    2011-02
    Posts
    5
    Login to Give a bone
    0

    Default Re: Block attribute prefill LISP stops in ACAD2019

    Thanks Tharwat,
    The attributes are still not associated with the block though,

    From the command line the output reads:

    CAT
    start number=6
    Select object:
    Select Drop Point --> Unknown command "C6". Press F1 for help.
    Unknown command "AREA \F "%LU6%QF1%PS[,HA]%CT8[0.0001]">%". Press F1 for help.

  4. #4
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Block attribute prefill LISP stops in ACAD2019

    Actually the routine can be written in entirely different way than that but let me ask you the following.

    Firstly. Are you sure is that the path is correct?

    Secondly. What is the name of the attributed block? Is it Label1 ?

  5. #5
    Member
    Join Date
    2011-02
    Posts
    5
    Login to Give a bone
    0

    Default Re: Block attribute prefill LISP stops in ACAD2019

    Ok, that's interesting
    Yes, i can confirm the path is correct. The block and DWG name is "CATCHMENT LABEL1"

  6. #6
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Block attribute prefill LISP stops in ACAD2019

    The path of a drawing should have either two back slashes ( \\ ) or one forward slash ( / ) so this indicates is that your path of the drawing is incorrect .

    Can you upload that attributed block drawing if its not confidential or just let me know what is the name of tag that should have the incremental number and what is the tag name for the field object as well?

    It seems that your attributed block has two attributes. Right?

  7. #7
    Member
    Join Date
    2011-02
    Posts
    5
    Login to Give a bone
    0

    Default Re: Block attribute prefill LISP stops in ACAD2019

    Yep, two attributes, The NAME and AREA

    The block is here:
    https://1drv.ms/u/s!AgeAUPaXe78uiIk9...KHTfQ?e=VHfCzU

    The block does load, so im sure the address is correct. Its my understanding the single backslash is to denote a space in the address

  8. #8
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Block attribute prefill LISP stops in ACAD2019

    Alright, please try the following program and let me know how you get on with it.

    Be sure to have the current layer unlocked although I can alert message to the user for this issue if you would like to.

    Code:
    (defun c:Test (/ *error* var sel blk ins pth)
      ;;	Tharwat - 24.Oct.2019		;;
      (defun *error* (msg)
        (and var (mapcar 'setvar '(ATTREQ ATTDIA) var))
        (and *doc* (vla-regen *doc* AcActiveviewport))
        (and msg
             (not (wcmatch (strcase msg) "*CANCEL*,*EXIT*,*BREAK*"))
             (princ (strcat "\nError =>: " msg))
        )
        (princ)
      )
      (and
        (or (findfile (setq pth
                             "U:\\MANUALS\\CIVIL_QLD\\CAD\ Standard\ Data\\Stormwater\\Blocks\\Catchment Label1.dwg"
                      )
            )
            (alert "Path of block is uncorrect <!>")
        )
        (or *doc*
            (setq *doc* (vla-get-ActiveDocument (vlax-get-acad-object)))
        )
        (or
          (tblsearch "BLOCK" "CATCHMENT LABEL1")
          (and (setq blk (vlax-invoke
                           (vla-get-modelspace *doc*)
                           'insertblock
                           '(0. 0. 0.)
                           pth
                           1.
                           1.
                           1.
                           0.
                         )
               )
               (progn (vla-delete blk)
                      (tblsearch "BLOCK" "CATCHMENT LABEL1")
               )
          )
          (alert
            "Block name <CATCHMENT Label1> not found in original drawing <!>"
          )
        )
        (or *initdgt* (setq *initdgt* 1))
        (or (initget 6)
            (setq
              *initdgt* (cond ((getint (strcat "\nSpecify start number < "
                                               (itoa *initdgt*)
                                               " > : "
                                       )
                               )
                              )
                              (*initdgt*)
                        )
            )
        )
        (setq var (mapcar 'getvar '(ATTREQ ATTDIA)))
        (mapcar 'setvar '(ATTREQ ATTDIA) '(0 0))
      )
      (while (and (princ "\nPick a closed polyline : ")
                  (setq sel (ssget "_+.:S:E" '((0 . "LWPOLYLINE"))))
             )
        (and
          (or (= (cdr (assoc 70 (entget (ssname sel 0)))) 1)
              (alert "Picked polyline is opened!. Try again.")
          )
          (setq
            ins (getpoint "\nSpecify attributed block insertion point : ")
          )
          (setq blk (vlax-invoke
                      (vla-get-modelspace *doc*)
                      'insertblock
                      ins
                      "CATCHMENT LABEL1"
                      1.
                      1.
                      1.
                      0.
                    )
          )
          (mapcar
            '(lambda (at)
               (vla-put-textstring
                 at
                 (if (= (vla-get-tagstring at) "NAME")
                   (strcat "C" (itoa *initdgt*))
                   (strcat "%<\\AcObjProp Object(%<\\_ObjId "
                           (get:id (vlax-ename->vla-object (ssname sel 0)))
                           ">%).Area \\f \"%lu6%qf1%ps[,ha]%ct8[0.0001]\">%"
                   )
                 )
               )
             )
            (vlax-invoke blk 'getattributes)
          )
          (setq *initdgt* (1+ *initdgt*))
        )
      )
      (*error* nil)
      (princ)
    ) (vl-load-com)
    ;;		;;
    (defun get:id (o / u)
      (if (vlax-method-applicable-p
            (setq u (vla-get-Utility *doc*))
            'GetObjectIdString
          )
        (vla-GetObjectIdString u o :vlax-false)
        (itoa (vla-get-ObjectId o))
      )
    )
    Last edited by Tharwat; 2019-10-24 at 07:31 AM.

  9. #9
    Member
    Join Date
    2011-02
    Posts
    5
    Login to Give a bone
    0

    Default Re: Block attribute prefill LISP stops in ACAD2019

    Thats awesome!
    Thanks so much, works great!

    Where would you add a prefix "C" to the name?

  10. #10
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Block attribute prefill LISP stops in ACAD2019

    Quote Originally Posted by kelvin_lloyd View Post
    Thats awesome!
    Thanks so much, works great!
    Excellent, You're welcome anytime.

    Quote Originally Posted by kelvin_lloyd View Post
    Where would you add a prefix "C" to the name?
    Oops, I updated the codes above and added the prefix 'C' char.

Similar Threads

  1. Issues with LispFunction ACAD2019 vb.net
    By nelson in forum Dot Net API
    Replies: 3
    Last Post: 2019-02-19, 09:45 PM
  2. Replies: 8
    Last Post: 2018-11-19, 06:05 AM
  3. Replies: 13
    Last Post: 2012-09-18, 07:51 PM
  4. Copy previous Block Attribute Value to next Block Attribute
    By CADfunk MC in forum VBA/COM Interop
    Replies: 8
    Last Post: 2009-02-27, 09:46 PM
  5. Block Attribute Manager Vs. Enhanced Attribute Editor
    By zoomharis in forum AutoCAD General
    Replies: 0
    Last Post: 2006-04-15, 11:53 AM

Posting Permissions

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