jim78b Posted April 14, 2022 Share Posted April 14, 2022 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 Quote Link to comment Share on other sites More sharing options...
ronjonp Posted April 14, 2022 Share Posted April 14, 2022 HERE You could also store it in a global variable or set an environment (get\setenv) variable... Quote Link to comment Share on other sites More sharing options...
Steven P Posted April 14, 2022 Share Posted April 14, 2022 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 ) ) 1 1 Quote Link to comment Share on other sites More sharing options...
Philipp Posted April 14, 2022 Share Posted April 14, 2022 (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 April 14, 2022 by Philipp 1 Quote Link to comment Share on other sites More sharing options...
jim78b Posted April 14, 2022 Author Share Posted April 14, 2022 It would be nice if i can select nested blocks Quote Link to comment Share on other sites More sharing options...
Steven P Posted April 14, 2022 Share Posted April 14, 2022 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 2 Quote Link to comment Share on other sites More sharing options...
mhupp Posted April 14, 2022 Share Posted April 14, 2022 (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 April 15, 2022 by mhupp updated code 1 1 Quote Link to comment Share on other sites More sharing options...
jim78b Posted April 15, 2022 Author Share Posted April 15, 2022 it would be nice if i can view highlighted the selection and then copy into memory the name of the block. thanks! Quote Link to comment Share on other sites More sharing options...
Steven P Posted April 15, 2022 Share Posted April 15, 2022 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 1 1 Quote Link to comment Share on other sites More sharing options...
mhupp Posted April 15, 2022 Share Posted April 15, 2022 (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 April 15, 2022 by mhupp 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.