Author Topic: Place text where block (Multiple Block Selection)  (Read 2555 times)

0 Members and 1 Guest are viewing this topic.

sanju2323

  • Newt
  • Posts: 68
Place text where block (Multiple Block Selection)
« 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.
« Last Edit: August 17, 2015, 11:07:57 AM by sanju2323 »

ChrisCarlson

  • Guest
Re: Place text where block (Multiple Block Selection)
« Reply #1 on: August 17, 2015, 10:42:39 AM »
Huh?

sanju2323

  • Newt
  • Posts: 68
Re: Place text where block (Multiple Block Selection)
« Reply #2 on: August 17, 2015, 11:02:54 AM »
ChrisCarlson,
        I don't understand what are you saying.

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Place text where block (Multiple Block Selection)
« Reply #3 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.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

sanju2323

  • Newt
  • Posts: 68
Re: Place text where block (Multiple Block Selection)
« Reply #4 on: August 17, 2015, 11:37:58 AM »
Please download sample2 file for a better understand.

ChrisCarlson

  • Guest
Re: Place text where block (Multiple Block Selection)
« Reply #5 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?


sanju2323

  • Newt
  • Posts: 68
Re: Place text where block (Multiple Block Selection)
« Reply #6 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.

ChrisCarlson

  • Guest
Re: Place text where block (Multiple Block Selection)
« Reply #7 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.


ronjonp

  • Needs a day job
  • Posts: 7527
Re: Place text where block (Multiple Block Selection)
« Reply #8 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. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

sanju2323

  • Newt
  • Posts: 68
Re: Place text where block (Multiple Block Selection)
« Reply #9 on: August 17, 2015, 12:28:36 PM »
Thanks both of you its work