Jump to content

Lisp routine to replace block with non block object


Jest

Recommended Posts

Ok a new lesson 

(setq ent (ssname ss (setq x (1- x)))) this retrieves the block to change so set the layer as the next line (setvar 'clayer (cdr (assoc 8 (entget ent)))) ; sets layer to blk layer, same for color.

 

Need to redo the way the code works select all blocks and do the ODget for each single block and set layer etc. Its all there just needs to be reshuffled around. I only did 1 block name rather than different block names with different OD data.

 

Maybe later today.

 

 

Edited by BIGAL
Link to comment
Share on other sites

13 hours ago, BIGAL said:

Ok a new lesson 

(setq ent (ssname ss (setq x (1- x)))) this retrieves the block to change so set the layer as the next line (setvar 'clayer (cdr (assoc 8 (entget ent)))) ; sets layer to blk layer, same for color.

 

Need to redo the way the code works select all blocks and do the ODget for each single block and set layer etc. Its all there just needs to be reshuffled around. I only did 1 block name rather than different block names with different OD data.

 

Maybe later today.

 

 

Hi
I have found another lisp program, which replaces block with another block (see attachment). It works fine with OD and different layers.
Can you look at it, so it would maybe help you complete ODBLK lisp?
p.s. I've tried to do you new lesson. I couldn't figured out where to put it or what line to replace. Tried many combinations...no success..

rblock.zip

Edited by Jest
Link to comment
Share on other sites

As part of learning you need to compare using entsel for 1 item v's SSGET for multiple items. The question of how to convert a single to multiple is probably asked ever 3 months. It is not that hard. Just look at code examples here that have ssget.

 

Don;t be afraid to post what does not work. Plenty here to help.

Link to comment
Share on other sites

On 10/26/2021 at 2:12 AM, BIGAL said:

As part of learning you need to compare using entsel for 1 item v's SSGET for multiple items. The question of how to convert a single to multiple is probably asked ever 3 months. It is not that hard. Just look at code examples here that have ssget.

 

Don;t be afraid to post what does not work. Plenty here to help.

It works now. I had some problems with anonymous block names, but I've found the solution.
Thanks again for your help!

Link to comment
Share on other sites

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...