TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: sanju2323 on August 17, 2015, 04:06:04 AM

Title: Place text where block (Multiple Block Selection)
Post by: sanju2323 on August 17, 2015, 04:06:04 AM
Place text at block. I need lisp two type first layer wise and second block name wise place.
Title: Re: Place text where block (Multiple Block Selection)
Post by: ChrisCarlson on August 17, 2015, 10:42:39 AM
Huh?
Title: Re: Place text where block (Multiple Block Selection)
Post by: sanju2323 on August 17, 2015, 11:02:54 AM
ChrisCarlson,
        I don't understand what are you saying.
Title: Re: Place text where block (Multiple Block Selection)
Post by: ronjonp on August 17, 2015, 11:07:20 AM
ChrisCarlson,
        I don't understand what are you saying.
You need a better example drawing of the results you are looking for. Chris is saying he does not understand your question & I don't either.
Title: Re: Place text where block (Multiple Block Selection)
Post by: sanju2323 on August 17, 2015, 11:37:58 AM
Please download sample2 file for a better understand.
Title: Re: Place text where block (Multiple Block Selection)
Post by: ChrisCarlson on August 17, 2015, 11:51:44 AM
For block name, why not just edit the block and insert the name of the block as a text entity?

Title: Re: Place text where block (Multiple Block Selection)
Post by: sanju2323 on August 17, 2015, 12:04:16 PM
Sir, at this time the block name changes one by one to a long time procedure. I think lisp I would live to save my time.
Title: Re: Place text where block (Multiple Block Selection)
Post by: ChrisCarlson on August 17, 2015, 12:08:13 PM
I can't write it at this time but look into the following

Code - Auto/Visual Lisp: [Select]
  1. (setq   obj (vlax-ename->vla-object (car (entsel)))
  2.                 layer (vla-get-layer obj)
  3.                 point (vlax-get obj 'InsertionPoint))
  4.  

and create a text entity from those variables.

Title: Re: Place text where block (Multiple Block Selection)
Post by: ronjonp on August 17, 2015, 12:24:20 PM
Here you go:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ _txt e n p ss)
  2.   (defun _txt (p l s)
  3.     (entmakex (list '(0 . "TEXT")
  4.                     '(100 . "AcDbEntity")
  5.                     '(67 . 0)
  6.                     (cons 8 l)
  7.                     '(100 . "AcDbText")
  8.                     (cons 10 p)
  9.                     '(40 . 2.0)
  10.                     (cons 1 s)
  11.                     '(50 . 0.0)
  12.                     '(41 . 1.0)
  13.                     '(51 . 0.0)
  14.                     '(71 . 0)
  15.                     '(72 . 1)
  16.                     (cons 11 p)
  17.                     '(73 . 2)
  18.               )
  19.     )
  20.   )
  21.   (if (setq ss (ssget '((0 . "insert"))))
  22.     (repeat (setq n (sslength ss))
  23.       (setq e (ssname ss (setq n (1- n))))
  24.       (setq p (cdr (assoc 10 (entget e))))
  25.       (_txt p "_LayerLabel" (cdr (assoc 8 (entget e))))
  26.       (_txt p "_BlockNameLabel" (cdr (assoc 2 (entget e))))
  27.     )
  28.   )
  29.   (princ)
  30. )
Title: Re: Place text where block (Multiple Block Selection)
Post by: sanju2323 on August 17, 2015, 12:28:36 PM
Thanks both of you its work