Jump to content

block work. inserting block bom01 where bom00 is and then taking bom00 values and ...


Recommended Posts

Posted

I want to combine the lisp written down here

 

;inserts a bom00 in the same spot as the block bom01. call commando with ukbom
(defun c:ukbom (/ a b c)
 (setq    a (ssget "_X" '((0 . "INSERT") (2 . "bom00")))
   b (sslength a)
 )
 (repeat b
   (setq b (1- b)
     c (append c (cdr (assoc 10 (entget (ssname a b)))))
   )
 )
 (command "insunits" "4" "")
 (Command "-insert" "bom01" c "" "" "" )
 (princ)
)

with this code mtb.lsp

 

;mtb copies attribut data from one block to other blocks with the same tags inside. write mtb to Run
(defun C:ukipcos2 (/ baselist ename elist tag val i ss ename1 elist1) 
  (setq baselist (list))      
  (while (not (setq ename (car (entsel "\nSelect Block:"))))
            (princ "\nNothing Picked"))
    (cond (
       (assoc 66 (setq elist (entget ename)))
               (setq ename (entnext ename)
                     elist (entget ename))
               (while (= "ATTRIB" (cdr (assoc 0 elist)))
           (setq tag (cdr (assoc 2 elist))
                 val (cdr (assoc 1 elist))
           baselist (append (list (list tag val)) baselist)
                     ename (entnext ename)
                     elist (entget ename))
                 )
       (setq i -1
                    ss (ssget '((0 . "INSERT")(66 . 1))))
               (repeat (sslength ss)
                  (setq ename1 (ssname ss (setq i (1+ i)))
                     ename1 (entnext ename1)
                     elist1 (entget ename1))
                  (while (= "ATTRIB" (cdr (assoc 0 elist1)))
                     (setq tag (cdr (assoc 2 elist1)))
                     (if (assoc tag baselist)
                             (entmod (subst (cons 1 (cadr (assoc tag baselist))) (assoc 1 elist1) elist1)))
                     (setq  ename1 (entnext ename1)
                               elist1 (entget ename1))
                             )
                 )
              )
         )
(princ)
)

so it take values from bom00 to bom01 and erase bom00......? So what i need is to combine the 2 routines so block name bom01 is inserted where bom00 is having its inserting point move the values from blockname bom00 to bom01 and erase block bom00. The attribute tags of block bom00 and bom01 have to be similar of cause.

 

Thx in advance. :oops:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...