Author Topic: How to get insertionpoint of block when select attribute  (Read 1472 times)

0 Members and 1 Guest are viewing this topic.

HasanCAD

  • Swamp Rat
  • Posts: 1421
How to get insertionpoint of block when select attribute
« on: March 27, 2017, 09:24:47 AM »
HI all
when select attribute  (vlax-get objVL 'insertionpoint) gives the attribute insertionpoint
How to get the block insertionpoint?
This what I am using
Code - Auto/Visual Lisp: [Select]
  1.         (setq obj (car (nentsel "\nSelect Origin attribute/Text : ")))
  2.         (setq objVL (vlax-ename->vla-object obj))
  3.         (setq objVL-Strng (vlax-get objVL 'textstring))
  4.         (setq objVL-inspnt (vlax-get objVL 'insertionpoint))

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: How to get insertionpoint of block when select attribute
« Reply #1 on: March 27, 2017, 09:36:32 AM »
Using activex, probably like this:
Code - Auto/Visual Lisp: [Select]
  1.   (setq att (car (nentsel "\nSelect attribute: ")))
  2.   (= "ATTRIB" (cdr (assoc 0 (entget att))))
  3.   (setq attobj (vlax-ename->vla-object att))
  4.   (setq attpt (vlax-get attobj 'InsertionPoint))
  5.   (setq blkpt (vlax-get blkobj 'InsertionPoint))
  6. ); and
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

Pepe

  • Newt
  • Posts: 87
Re: How to get insertionpoint of block when select attribute
« Reply #2 on: March 27, 2017, 09:50:38 AM »
Just for comparing with plain Autolisp...

Code - Auto/Visual Lisp: [Select]
  1.   (setq att (car (nentsel "\nSelect attribute: ")))
  2.   (= "ATTRIB" (cdr (assoc 0 (entget att))))
  3.   (setq attobj (vlax-ename->vla-object att))
  4.   (setq blkobj (cdr (assoc 330 (entget att))))
  5.   (setq attpt (vlax-get attobj 'InsertionPoint))
  6.   (setq blkpt (cdr (assoc 10 (entget blkobj))))
  7. ); and

Regards.

HasanCAD

  • Swamp Rat
  • Posts: 1421
Re: How to get insertionpoint of block when select attribute
« Reply #3 on: March 28, 2017, 01:47:42 AM »
Thanks Grrr1337
Thanks Pepe

both solutions are working perfect.