Author Topic: BLOCKREPLACE in dynamic block  (Read 856 times)

0 Members and 1 Guest are viewing this topic.

mbrandt5

  • Newt
  • Posts: 44
BLOCKREPLACE in dynamic block
« on: December 06, 2019, 11:30:48 AM »
Hey all I was curious if anyone is aware of a lisp that can replace blocks inside of a dynamic block, while still retaining the action parameters.

I now how I could write it, put due to the cumbersomeness of the task I figured you all may have seen someone prior execute this feat.

kozmos

  • Newt
  • Posts: 37
Re: BLOCKREPLACE in dynamic block
« Reply #1 on: December 16, 2019, 12:22:49 AM »
Directly foreach objects in Dynamic block definition, replace the internal block by using subst DXF2.
« Last Edit: December 16, 2019, 12:31:20 AM by kozmos »
KozMos Inc.

mbrandt5

  • Newt
  • Posts: 44
Re: BLOCKREPLACE in dynamic block
« Reply #2 on: December 20, 2019, 02:16:49 PM »
Any chance anybody out there has an example code?

Also, by replacing the internal blocks would that automatically update the action/parameter set selection sets to those objects?

ribarm

  • Water Moccasin
  • Posts: 2383
  • Marko Ribar, architect
Re: BLOCKREPLACE in dynamic block
« Reply #3 on: December 20, 2019, 02:52:45 PM »
I am afraid you are quite right in your observations... Replacing nested entities will break stored links with parameters of dynamic block... To preserve its functionality I would redefine blocks and rebuild dynamic block from scratch with new links attached to nested redefined blocks... Then with new block created, you should reinsert them with the same properties like old (scale, rotation, insertion point), then you should remove old one, purge it and rename new one to match old block name... This all sounds cumbersome procedure, but as you stated it is like that if you want the same functionality, not to mention that you could have different visibility paramters attached and as you can figure out on own there is no way the links would be preserved if entities change their definitions especcialy their handles and enames...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

kozmos

  • Newt
  • Posts: 37
Re: BLOCKREPLACE in dynamic block
« Reply #4 on: December 22, 2019, 09:46:10 PM »
Using other way to modify nest block may cause the broken links for parameters and actions, but using entmod DXF2 may have the biggest chance to maintain all the parameters and actions as the internal object's handle (which is unique in DWG) remains the same.
KozMos Inc.

mbrandt5

  • Newt
  • Posts: 44
Re: BLOCKREPLACE in dynamic block
« Reply #5 on: January 28, 2020, 11:12:29 AM »
Not sure if this is what you were explaining but if anyone is interested I found a way to do it with code or any commands.

- Take the name of the block being replaced that has parameters/actions linked to it.
- Create new block with same name in a new drawing.
- Copy dynamic block into new drawing, then it will automatically be replaced.

ribarm

  • Water Moccasin
  • Posts: 2383
  • Marko Ribar, architect
Re: BLOCKREPLACE in dynamic block
« Reply #6 on: February 13, 2020, 08:20:55 AM »
I've just checked this one again and realized - you should use what you named this topic : -BLOCKREPLACE command...

1. Create block you want to replace with...
2. -BLOCKREPLACE
3. Type name of nested block
4. Type name of created block
5. No purge... Finished...
6. Remove block you replaced with
7. Purge that block you replaced
8. -RENAME (BLOCK option)
9. Type name of created block
10. Type name of nested block

I don't know will linked parameters stay remained, but to me they should... Only thing is that dynamic block may not function as intended (if with original everything worked as desired)...
« Last Edit: February 13, 2020, 09:54:29 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube