Jump to content

Recommended Posts

Posted

i have this code to get block names, I want to copy it (the block name) via lisp as if I were doing CTRL+C.

(vla-get-effectivename (vlax-ename->vla-object (car (entsel "\nSelect block: "))))

 

example:

Select block: "test"

i eant copy in memory test.

thx in advance

Posted

Try this way too

 

(defun c:testthis ( / )
  (setq NewText (vla-get-effectivename (vlax-ename->vla-object (car (entsel "\nSelect block: ")))) )
  (vlax-invoke (vlax-get (vlax-get (vlax-create-object "htmlfile") 'ParentWindow) 'ClipBoardData) 'setData "TEXT" NewText )
)

 

  • Like 1
  • Thanks 1
Posted (edited)

That is exactly a question I wanted to ask today

 

I use Graebert ares for planning electrical projects and I could use the custom blocks (like dynamic blocks in acad) to switch through various options I can preconfigure in the blocks like rotation, alignment and base points.

The problem is when the block is in the drwaing Id have to insert them again or copy and then change these things in properties.

 

A Program that reads the selected block name and inserts it, so I have it on handle would make a much nicer workflow.

 

Ok, I see you want to copy the blocks name...

If anyone has a simple program for the example I wrote, that would be nice!

Edited by Philipp
  • Thanks 1
Posted

It would be nice if i can select nested blocks

Posted

something like (last (last (nentsel))) rings a bell but, well long weekend here and CAD is off for now, but that might have been for something different, think I used that to grab text from a nested block.

 

Try Lee Mac, http://www.lee-mac.com/extractnestedblock.html for ideas, this might have something in it... however long weekend here and CAD is off till next week so can't check anything today

  • Like 2
Posted (edited)
23 hours ago, jim78b said:

It would be nice if i can select nested blocks

 

looking over this post.

(setq blk (last (last (nentselp "\nSelect Block: "))) ;this will get the nested block entity name

 

Edited by mhupp
updated code
  • Like 1
  • Thanks 1
Posted

it would be nice if i can view highlighted the selection and then copy into memory the name of the block. thanks!😉

Posted
8 hours ago, mhupp said:

 

(setq blk (car (last (nentselp "\nSelect Block: "))) ;this will get the nested block entity name

 

 

Thought it was 'last', though '(last (last' I think goes a bit deeper into a nested block - I did read something and I think it was Lee Mac on a forum somewhere about it (How I hate quoting him all the time... so annoying to have a resource who is so genuinely helpful and generous with what he offers....)

 

 

Not seen a way to highlight a nested block on selecting one of its objects

  • Like 1
  • Thanks 1
Posted (edited)

no your right @Steven P that lisp i linked you have to refedit the main block then step down to the nested one. so its (last (last

Edited by mhupp
  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...