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

Retrieving the block name of an anonymous block

3 REPLIES 3
Reply
Message 1 of 4
markash
965 Views, 3 Replies

Retrieving the block name of an anonymous block

Hello All:

 

When dynamic blocks are inserted they're assigned an anonymous block name.  I'd like to be able to retrieve the name of the parent block after selecting the block on screen using AutoLisp.

 

Does anyone have a bit of code that handles this?

 

Thanks

 

Mark Ash

3 REPLIES 3
Message 2 of 4
pbejse
in reply to: markash

(defun c:demo (/ obj)
  (vl-load-com)
  (if (setq obj (ssget "_:S:E" '((0 . "INSERT"))))
    (vla-get-effectivename
      (vlax-ename->vla-object (ssname obj 0))
    )
  )
)

 

Message 3 of 4
markash
in reply to: pbejse

pbejse:

 

That works like a charm.  Extending the thought process one step, can you tell me how I could change the parent block name to another block?

 

Sorry to be a bother.

 

Thanks,

 

Mark

Message 4 of 4
pbejse
in reply to: markash


@Anonymous wrote:

pbejse:

 

That works like a charm.  Extending the thought process one step, can you tell me how I could change the parent block name to another block?

 

Sorry to be a bother.

 

Thanks,

 

Mark


Yes, look into  ConvertToAnonymousBlock  or ConvertToStaticBlock Method

 

HTH

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

Post to forums  

Autodesk Design & Make Report

”Boost