Author Topic: Join objects inside blocks without using commands  (Read 870 times)

0 Members and 1 Guest are viewing this topic.

kasmo

  • Newt
  • Posts: 28
Join objects inside blocks without using commands
« on: March 28, 2023, 07:35:50 AM »
With commands this would be pretty straightforward:

Code - Auto/Visual Lisp: [Select]
  1. (command "_.-BEDIT" "BLOCKNAME")
  2. (command "_.JOIN" "_ALL")
  3. (command "_.BCLOSE" "_save")

But commands are slow..
So I was wondering if there is a better way?

57gmc

  • Bull Frog
  • Posts: 366
Re: Join objects inside blocks without using commands
« Reply #1 on: March 28, 2023, 10:18:25 AM »
I'm just curious why you would want to do that? I've never had the need to.

kasmo

  • Newt
  • Posts: 28
Re: Join objects inside blocks without using commands
« Reply #2 on: March 28, 2023, 11:03:43 AM »
Quote
I'm just curious why you would want to do that? I've never had the need to.
I often receive huge (in terms of filesize) drawings that have lots of appliance blocks from various manufacturers with lots of single lines in them.
I found that joining those and removing unnecessary vertices can significantly reduce filesize.
But as of now, it can take several minutes or more to process a single file.

57gmc

  • Bull Frog
  • Posts: 366
Re: Join objects inside blocks without using commands
« Reply #3 on: March 28, 2023, 04:47:54 PM »
Interesting...
One way you could do it is to explode one of the block references. The explode method leaves the original in place. Now you have access to the sub entities and you could do what you want to them. Then use them to redefine the block. I'm not sure that this would be much faster though.

BIGAL

  • Swamp Rat
  • Posts: 1411
  • 40 + years of using Autocad
Re: Join objects inside blocks without using commands
« Reply #4 on: March 28, 2023, 06:52:38 PM »
Its is probably this (command "_.JOIN" "_ALL") that takes the time, if you have lots of items to join. May not be able to get around it.

Tested in bricscad (command "_.JOIN" "_ALL" "") needed a exit.

I would add a entsel as 1st step pick a block and get its name.
A man who never made a mistake never made anything

kasmo

  • Newt
  • Posts: 28
Re: Join objects inside blocks without using commands
« Reply #5 on: March 30, 2023, 08:54:35 AM »
Interesting...
One way you could do it is to explode one of the block references. The explode method leaves the original in place. Now you have access to the sub entities and you could do what you want to them. Then use them to redefine the block. I'm not sure that this would be much faster though.
I haven't thought of that. This would get around the block editing commands. Might be worth a try..

Its is probably this (command "_.JOIN" "_ALL") that takes the time, if you have lots of items to join. May not be able to get around it.

Yeah, it seems to really slow down with more then 20000 objects or so. Not really surprising, I guess.
And I highly doubt that writing my own join function would be any faster.   :-)

Thanks for the help guys!

BIGAL

  • Swamp Rat
  • Posts: 1411
  • 40 + years of using Autocad
Re: Join objects inside blocks without using commands
« Reply #6 on: March 30, 2023, 11:01:21 PM »
Ouch 20,000 objects. maybe one way if you get the same objects is to reinsert an external block this will force a redefine block, the external block has the lines joined.
A man who never made a mistake never made anything