Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TBLSEARCH in current tab

1 REPLY 1
SOLVED
Reply
Message 1 of 2
magnar
1048 Views, 1 Reply

TBLSEARCH in current tab

Is it possible to tblsearch only in the current tab?  I have a routine that queries the table and if it finds a certain block within a Xref it inserts the appropiate block.  The problem is that sometimes I have different XREFs in the same DWG but on seperate tabs.. I'd love to only search the current tab.

 

as it is right now

 

..........
     (cond

       ((tblsearch "block" "xref_tblk|8x11")
    (setq bl01 "Titleblocks/8.5x11_info.dwg")
       );cond - 8.5x11
      
       ((tblsearch "block" "Xref_Tblk-8.5x11|8x11")
    (setq bl01 "Titleblocks/8.5x11_info.dwg")
       );cond - 8.5x11-ASI
      
       ((tblsearch "block" "xref_tblk|11x17")
    (setq bl01 "Titleblocks/11x17_info.dwg")
       );cond - 11x17

              ((tblsearch "block" "xref_tblk-11x17|11x17")
    (setq bl01 "Titleblocks/11x17_info.dwg")
       );cond - 11x17-ASI
      
       ((tblsearch "block" "xref_tblk|24x36")
    (setq bl01 "Titleblocks/24x36_info.dwg")
       );cond - 24x36

       ((tblsearch "block" "xref_tblk|30x42")
    (setq bl01 "Titleblocks/30x42_info.dwg")
       );cond - 30x42

       ((tblsearch "block" "xref_tblk|36x48")
    (setq bl01 "Titleblocks/36x48_info.dwg")
       );cond - 36x48

.......

Tags (3)
1 REPLY 1
Message 2 of 2
Moshe-A
in reply to: magnar

hi,

 

(tblsearch) only searches for a block definition in the block table...to see if a block reference is inserted in layout tab you should use the (ssget) function but (ssget) can not find xref depended  block reference so what you should do is loop through layout list and for each layout search for xref reference and if it found? insert the right title block

 

take a look at this:

 

(defun insert_title_blocks (/ layout xrefName titleBlockName ss)

 (setvar "expert" 1)
  
 (foreach layout (layoutlist)
  (setvar "ctab" layout)

  (vl-some
   '(lambda (xrefName titleBlockName)
     (if (setq ss (ssget (list (cons 0 (strcase xrefName)))))
      (progn
       (command "._insert" titleBlockName pause pause pause pause ;| here you have to take care of attributes values |;)
                                                  		  ;| if they are exist |;
       (setq ss nil)
       t ; return true 
      )
     ); if
    ); lambda
    (list "Xref_Tblk-8.5x11"        "xref_tblk-11x17"        "xref_tblk-24x36"        "xref_tblk-30x42"        "xref_tblk-36x48"); xref
    (list "Titleblocks/8.5x11_info" "Titleblocks/11x17_info" "Titleblocks/24x36_info" "Titleblocks/30x42_info" "Titleblocks/36x48_info"); title blocks
  ); vl-some
   
 ); foreach

 (setvar "expert" 0)
)

 

i did not test it.

 

cheers

moshe

 

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost