+ Reply to Thread
Page 4 of 4 FirstFirst ... 2 3 4
Results 31 to 39 of 39

Thread: lisp needed

  1. #31
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,786

    Default

    Registered forum members do not see this ad.

    Tharwat a suggestion dump the blocks from the master dwg into a txt file name only and put somewhere safe. 2nd part run again on current drawing and compare the two lists. Display or write out some form of list found or not found.

    3rd bit harder beyond me as part of step 1 write out the number of entities and name per block save as master txt do 2nd again for name and number of entities this is rough but would find a few changes.

    result this time is
    Found
    Found but changed
    Not found.

    Like a lot of us sounds simple but takes a lot of time to write and test.
    A man who never made mistakes never made anything

  2. #32
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Lives in Abu Dhabi
    Posts
    2,631

    Default

    Quote Originally Posted by BIGAL View Post
    Tharwat a suggestion dump the blocks from the master dwg into a txt file name only and put somewhere safe. 2nd part run again on current drawing and compare the two lists. Display or write out some form of list found or not found.
    That's true , and thanks for the extra clarifications BIGAL
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  3. #33
    Junior Member
    Using
    AutoCAD 2012
    Join Date
    Mar 2012
    Posts
    19

    Default

    Dear Tharwat,

    thank you very much but i need one thing added to the lisp, the non standard block could be highlighted what ???????????????????

  4. #34
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Lives in Abu Dhabi
    Posts
    2,631

    Default

    Quote Originally Posted by DEEPAKRAJ View Post
    Dear Tharwat,

    thank you very much but i need one thing added to the lisp, the non standard block could be highlighted what ???????????????????
    You're welcome

    Check this one ...

    Code:
    (defun c:Test (/               BlockList       stand
                   non             ss              Blockname
                   StandardBlockname               nonstandardBlockname
                  )
    ;;; Tharwat 08. March. 2012 ;;;
      (setq BlockList '("Block1" "Block2"))
    ;;; Put the block name that you got from the first routine instead of the block names
      (if (and (setq ss (ssget "_x" '((0 . "INSERT"))))
               (setq stand 0)
               (setq non 0)
               (setq sel (ssadd))
          )
        (repeat (setq i (sslength ss))
          (setq
            Blockname
             (cdr
               (assoc 2
                      (entget (setq sn (ssname ss (setq i (1- i)))))
               )
             )
          )
          (if (member Blockname BlockList)
            (progn
              (setq stand (1+ stand))
              (setq standardBlock (cons Blockname standardBlock))
            )
            (progn
              (ssadd sn sel)
              (setq non (1+ non))
              (setq nonstandardBlock (cons Blockname nonstandardBlock))
            )
          )
        )
        (princ)
      )
      (if Blockname
        (alert
          (progn
            (strcat
              " You have : < "
              (itoa stand)
              " > Standard Blocks inserted into this drawing "
              "\n"
              (strcat " You have : < "
                      (itoa non)
                      " > Nonstandard Blocks inserted into this drawing "
              )
            )
          )
        )
      )
      (if (>= non 1)
        (sssetfirst nil sel)
      )
      (princ)
    )
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  5. #35
    Super Member Bill Tillman's Avatar
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Miami, FL
    Posts
    870

    Default

    Tharwat, this is similar to a recent post I place looking for information on how to dump a list of all the blocks in my drawing. By all the blocks I mean all of them. Not the ones that have been inserted. I see by using this command:

    Code:
    (tblsearch "BLOCK" "t288")
    this will list all the information about block t288, and it lists the long narrative description (4) which is what I need to identify the blocks I have against the blocks I still need to add. There are about 100 blocks in this drawing right now and I have to find someway to get my hands around what's in there and what's not. Can you assist me in how to get a listing of all the blocks in this file?

    OK, so I've tried this:

    Code:
    (ssget "X"  (list  (cons 0 "INSERT")))
    but all I get is <Selection set: 31>. So now how do I access Selection Set: 31, to see what's in it.
    Last edited by Bill Tillman; 9th Mar 2012 at 02:27 am.
    It's deja vu, all over again.

  6. #36
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,786

    Default

    Try something like this its actually a bit easier using VL if you want a global answer like all blocks all layers use ssget when you want to use filters as well. if you want to use ssget then you need ( ssname ss x) pulls entity number x from list remember starts at 0.

    Code:
    (setq  doc (vla-get-activedocument (vlax-get-acad-object))) ; open database
    (vlax-for block (vla-get-blocks doc) ; get all the blocks same as ssget
     (setq blkname (vla-get-name block)) ;get block name in for loop
    (if   (not (wcmatch (strcase (vla-get-name block) t) "*_space*")) ; dont show model space etc 
    (princ blkname) ; do what you want here 
    )
    )
    ps starting to come to grips with VL
    A man who never made mistakes never made anything

  7. #37
    Super Member Bill Tillman's Avatar
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Miami, FL
    Posts
    870

    Default

    Thanks BigAl,

    I found this:

    http://www.cadtutor.net/forum/showth...ABLE-NAME-LIST

    and also this:

    Code:
    (setq blist (acet-table-name-list (list "block" 1 4)))
    In the posting by Lee-Mac above I substituted 4 in the 70 field and it got the first block then crashed. So I substituted 4 for the 2 field and I got all those descriptions I'm after. But I need a way to put 2 and 4 together so I can have the block name and the associated description together.

    Will try the example above in your reply now.

    ps Coming to grips...well kind of...I'm gripping my hair and pulling it out.

    The example you gave works but it doesn't separate the block names. The acet-table command above lists all the blocks in quotes which makes parsing them easier for me. I just need a way to get the blocks and the descriptions in a listing together.

    Thanks again for the pointers...I'm still hacking but now it's time to put the monster away!
    It's deja vu, all over again.

  8. #38
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,786

    Default

    Maybe (nth blist x) no cad at moment
    A man who never made mistakes never made anything

  9. #39
    Junior Member
    Using
    AutoCAD 2012
    Join Date
    Mar 2012
    Posts
    19

    Default

    Registered forum members do not see this ad.

    hey tharwat,
    how are hope so doing well.
    do you have lisp which can convert the layers data from excel to autocad.
    note :- only layer name , color and line type is given

Similar Threads

  1. Help needed with a Lisp .
    By Tharwat in forum AutoLISP, Visual LISP & DCL
    Replies: 14
    Last Post: 4th Sep 2010, 10:46 pm
  2. Lisp Dimension help needed...
    By streivor in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 1st Jun 2010, 06:44 pm
  3. LISP Needed
    By good_m in forum AutoLISP, Visual LISP & DCL
    Replies: 9
    Last Post: 21st May 2009, 01:40 pm
  4. lisp needed
    By CadTechJGC184 in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 18th May 2009, 09:23 pm
  5. S.O.S. - LISP &/or VBA Assistance Needed
    By Broman in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 24th Nov 2006, 09:35 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