Author Topic: Insert Block to multiple insertion points  (Read 3057 times)

0 Members and 1 Guest are viewing this topic.

bman

  • Guest
Insert Block to multiple insertion points
« on: March 06, 2006, 11:47:25 AM »
Is there a way to insert a block to an insertion point to multiple entities by selecting with a window?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Insert Block to multiple insertion points
« Reply #1 on: March 06, 2006, 04:40:46 PM »
Is there a way to insert a block to an insertion point to multiple entities by selecting with a window?

Do you mean INTERSECTION POINT ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

bman

  • Guest
Re: Insert Block to multiple insertion points
« Reply #2 on: March 06, 2006, 07:16:00 PM »
Quote

Do you mean INTERSECTION POINT ?


I'm trying to insert a block at the insertion point of multiple text entities w/o having to snap to & select each entity individually.

Ex: I have a revision cloud block that I want to attached to the insertion point of about 500 asbuilt spot elevations that are text entities. Currently, I inserted the block & copied multiple from insertion to insertion which is putting me to sleep.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Insert Block to multiple insertion points
« Reply #3 on: March 06, 2006, 07:31:45 PM »
Wouldn't you still have to select the text ... unless you can filter them ... can you filter the text to isolate it ?

I see it as about 15 minutes work, either way ..  write the routine, or do it manually :-) 

« Last Edit: March 06, 2006, 07:38:40 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Insert Block to multiple insertion points
« Reply #4 on: March 06, 2006, 07:41:21 PM »
It might not be that hard, or take that long.  If all the text objects are on a layer that you can filter, then it will go by pretty fast.  Just when you do it, make sure you look at the alignment of the text, and use the correct point.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Insert Block to multiple insertion points
« Reply #5 on: March 09, 2006, 04:50:47 PM »
try this...

Code: [Select]
(defun c:rsett ()
(setq la1 nil)
(setq la3 nil)
  
 (setq bname (ssget))
  (if (not bname)
    (progn
      (alert " No entity was selected.")
      (exit)
    )
  ) 
 (setq sscount (sslength bname))
 (setq val1 (- sscount 1))
 (setq tlen 0)       
 (repeat sscount
   (setq a1 (entget (ssname bname val1)))
   (setq a2 (cdr (assoc 0 a1)))
   (if (eq a2 "MTEXT")
   (command "._-insert" "YOURBLOCKNAMEHERE" (cdr (assoc 10 a1)) "1" "1" "0")     
   )
(setq val1 (- val1 1))
);;end repeat
)
Keep smile...

kpblc

  • Bull Frog
  • Posts: 396
Re: Insert Block to multiple insertion points
« Reply #6 on: March 10, 2006, 08:24:51 AM »
Try this (I haven't enough time to test this code at any situations):
Code: [Select]
;|=============================================================================
*    Function insert selected block at the insertion point of text primitives.
* The block have to be inserted at file. Function works only in model space,
* world coordinate system. The block inserted at insertion point of text at the
* same layer. Linetype, lineweight, linescale are copies from text ename.
*    Written by kpblc (kpblc2000@gmail.com)
=============================================================================|;
(defun c:mins2txt (/       adoc selset     item       vla_block
   block_ent  x_scale y_scale    z_scale    rotation
   )
  (vl-load-com)
  (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
  (vla-startundomark adoc)
  (if (and (setq block_ent (entsel "\nSelect the block : "))
   (= (cdr (assoc 0 (entget (car block_ent)))) "INSERT")
   (setq selset (ssget "_:L" '((0 . "TEXT"))))
   ) ;_ end of and
    (progn
      (if (not (setq x_scale (getreal "\nEnter x scale factor <1> : ")))
(setq x_scale 1.0)
) ;_ end of if
      (if (not (setq y_scale (getreal "\nEnter y scale factor <1> : ")))
(setq y_scale 1.0)
) ;_ end of if
      (if (not (setq z_scale (getreal "\nEnter z scale factor <1> : ")))
(setq z_scale 1.0)
) ;_ end of if
      (if (not (setq rotation (getreal "\nEnter rotation, degrees <0.0> : ")))
(setq rotation 0.0)
) ;_ end of if
      (while (and selset
  (> (sslength selset) 0)
  ) ;_ end of and
(setq item (ssname selset 0))
(ssdel item selset)
(setq item (vlax-ename->vla-object item))
(setq
  vla_block (vla-insertblock
      (vla-get-modelspace adoc)
      (vlax-3d-point
(vlax-variant-value
  (vlax-safearray->list (vla-get-insertionpoint item))
  ) ;_ end of vlax-variant-value
) ;_ end of vlax-3d-point
      (vla-get-name (vlax-ename->vla-object (car block_ent)))
      x_scale
      y_scale
      z_scale
      (/ (* 180.0 rotation) pi)
      ) ;_ end of vla-InsertBlock
  ) ;_ end of setq
(foreach sub_item '("layer" "lineweight" "linetype")
  (vlax-put-property
    vla_block
    sub_item
    (vlax-get-property item sub_item)
    ) ;_ end of vlax-put-property
  ) ;_ end of foreach
) ;_ end of while
      ) ;_ end of progn
    ) ;_ end of if
  (vla-endundomark adoc)
  ) ;_ end of defun
Sorry for my English.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Insert Block to multiple insertion points
« Reply #7 on: March 10, 2006, 03:44:39 PM »
I'm guessing this is what you want.
TheSwamp.org  (serving the CAD community since 2003)