Author Topic: dynamic blocks  (Read 8832 times)

0 Members and 1 Guest are viewing this topic.

Thomas 3D

  • Guest
Re: dynamic blocks
« Reply #30 on: January 08, 2011, 02:15:39 AM »
Hi Kruuger,

It works great. Thanks!!!
I have another question for you. How you would delete the ID values, for example in all block01?

I have tried the autocad command "_-attedit". There you can select which block and which attribute you want edit.
- Attributes edit individually (Y/N)                          -> N
- Only visible on the screen to edit attributes? (Y/N) -> Y
- Enter block name specification <*>                      -> block01
- Specification for type attribute name <*>             -> ID
- Specification for type attribute value <*>             -> *
- Select attributes                                              -> I have select all blocks 01
- Enter string to be amended                                -> *
- Enter the new string                                         -> I have pressed the spacebar or Delete key

Autocad abort the function

Do you have an idea?

Thomas

kruuger

  • Swamp Rat
  • Posts: 635
Re: dynamic blocks
« Reply #31 on: January 08, 2011, 12:27:39 PM »
Hi Kruuger,

It works great. Thanks!!!
I have another question for you. How you would delete the ID values, for example in all block01?

I have tried the autocad command "_-attedit". There you can select which block and which attribute you want edit.
- Attributes edit individually (Y/N)                          -> N
- Only visible on the screen to edit attributes? (Y/N) -> Y
- Enter block name specification <*>                      -> block01
- Specification for type attribute name <*>             -> ID
- Specification for type attribute value <*>             -> *
- Select attributes                                              -> I have select all blocks 01
- Enter string to be amended                                -> *
- Enter the new string                                         -> I have pressed the spacebar or Delete key

Autocad abort the function

Do you have an idea?

Thomas
i'm glad it works.
Back to your question. There is a many ways to do this:
1. GATTE command from Express Menu. I'm not sure if autodesk updated the code but old one not works with dynamic blocks.
2. _QSELECT -> Block Reference -> Name -> Block01 which make selection set and then change ID value in properties pallete.
3. _FILTER -> Block name -> Add -> Apply - i think it not works with dynamic also.
4. Dynamic filter lisp which make selection set of blokcs and then change via properties pallete
Code: [Select]
(defun c:FID (/ Realss Sel Obj ss BlkName tempEnt)
  (setq Realss (ssadd))
    (if
      (and
        (setq Sel (entsel "\nSelect block to select likewise: "))
        (setq Obj (vlax-ename->vla-object (car Sel)))
        (= (vla-get-ObjectName Obj) "AcDbBlockReference")
        (setq ss (ssget "X" '((0 . "INSERT"))))
        (setq BlkName (vla-get-EffectiveName Obj))
        (progn
          (while (setq tempEnt (ssname ss 0))
            (if (= BlkName (vla-get-EffectiveName (vlax-ename->vla-object tempEnt)))
              (ssadd tempEnt Realss)
            )
            (ssdel tempEnt ss)
          )
          (> (sslength Realss) 0)
        )
      )
      (progn
        (sssetfirst nil Realss)
        (prompt (strcat "\n Block selected: " (itoa (sslength Realss))))
      )
      (prompt "\n No likeness block selected.")
    )
  (princ)
)
5. this one clear atrribute at selected block. it can be updated to clear all the same block:
Code: [Select]
(Defun C:CLS (/ OB TY OT OC)
  (setq OB (car (entsel "\nSelect block w/attribute:"))
        TY (cdr (assoc 0 (entget OB)))
        OT "ATTRIB")
  (if (= TY "INSERT")
    (progn
      (while (= OT "ATTRIB")
        (setq OB (entnext OB)
              OT (cdr (assoc 0 (entget OB)))
              OC (entget OB)
             OC (subst (Cons 1 "") (assoc 1 OC) OC))
        (EntMod OC)            
      );while
    );progn
  );if
  (princ)
);CLS
6. probably more and more and more...

kruuger
« Last Edit: January 08, 2011, 03:37:08 PM by kruuger »