Author Topic: Convert same geometry to block  (Read 3729 times)

0 Members and 1 Guest are viewing this topic.

divtiply

  • Guest
Convert same geometry to block
« on: November 21, 2014, 10:47:44 AM »
There are multiple same geometry entries in the drawing, i.e. two lines cross & circle. Any ideas how to automatically convert them to block inserts?

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Convert same geometry to block
« Reply #1 on: November 21, 2014, 11:18:04 AM »
Look for common properties of the items ( radius, length, layer etc.. ). Filter them, insert block @ center point of circle, then delete selection.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

divtiply

  • Guest
Re: Convert same geometry to block
« Reply #2 on: November 21, 2014, 11:35:02 AM »
But there can be entities with same properties, but not aligned so to be in the block.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Convert same geometry to block
« Reply #3 on: November 21, 2014, 11:57:21 AM »
Yes, would require a complex solution but is doable and not fool proof.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Convert same geometry to block
« Reply #4 on: November 21, 2014, 12:08:31 PM »
Post a drawing if you can.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

divtiply

  • Guest
Re: Convert same geometry to block
« Reply #5 on: November 21, 2014, 12:13:28 PM »
Let's simplify task to 2D lines only. Any non-geometrical properties are ignored.
So we have lines start & end coords, length & azimuth. How to compare relative positions?

danallen

  • Guest
Re: Convert same geometry to block
« Reply #6 on: November 21, 2014, 12:20:28 PM »
If you could assume the relative entity creation order of the objects is the same, that would help tremendously. Because then you can interate through the database comparing first object to next relative object compared to your original. Use trans to make coordination comparison relative to 0.

divtiply

  • Guest
Re: Convert same geometry to block
« Reply #7 on: November 21, 2014, 12:22:37 PM »
Here is an example - fragment of pile foundation drawing. Drafter copied pile gometry multiple times. I want to have piles as block inserts.

I know how to
pseudocode:
1. ssget geometry to search for (two lines cross & circle)
2. getpoint insertion-point (in this case line intersection / circle center)

What next?
« Last Edit: November 21, 2014, 12:29:42 PM by divtiply »

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Convert same geometry to block
« Reply #8 on: November 21, 2014, 12:27:50 PM »
Is the 'pile geometry' on its own layer?

divtiply

  • Guest
Re: Convert same geometry to block
« Reply #9 on: November 21, 2014, 12:31:24 PM »
Is the 'pile geometry' on its own layer?
In this case yes, but I saw a lot of drawings where all entities are on layer `0`.
« Last Edit: November 21, 2014, 12:46:39 PM by divtiply »

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Convert same geometry to block
« Reply #10 on: November 21, 2014, 12:53:32 PM »
Get a selection of circles then a selection of lines. Iterate through the circles center points looking for lines midpoints that are equal ( maybe fuzz is a percentage of the circle radius ) from the lines selset. If the result is 2 then do your stuff.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Convert same geometry to block
« Reply #11 on: November 21, 2014, 01:37:24 PM »
Generally, there is a need to quantify what "the same" means in concrete terms.  Humans can look at two item and declare them the same without much conscious thought; in order for this to be duplicated in a computer the steps we take internally have to be mapped out in discrete steps.  Remove everything from the drawing except for two such matching instances.  Pretend you are explaining this to somebody very young or simple - how would you explain why they are the same?
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Convert same geometry to block
« Reply #12 on: November 21, 2014, 01:47:20 PM »
Here is an example - fragment of pile foundation drawing. Drafter copied pile gometry multiple times. I want to have piles as block inserts.

I know how to
pseudocode:
1. ssget geometry to search for (two lines cross & circle)
2. getpoint insertion-point (in this case line intersection / circle center)

What next?
Are you trying to get the pline donuts with the two crossing lines?
That could be easy.
ssget closed pline with a known width
Use the center to get the lines of known length.

I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

divtiply

  • Guest
Re: Convert same geometry to block
« Reply #13 on: November 21, 2014, 02:58:05 PM »
I'm tryining to find generalized soulution, not only for lines/circles, but also for lwplines/3dplines/arcs/eclipses/etc.

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Convert same geometry to block
« Reply #14 on: November 21, 2014, 02:59:37 PM »
I'm tryining to find generalized soulution, not only for lines/circles, but also for lwplines/3dplines/arcs/eclipses/etc.
The answer will always be dependent on the relationship between the objects and how accurately they were drafted.
« Last Edit: November 21, 2014, 03:20:20 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Convert same geometry to block
« Reply #15 on: November 21, 2014, 03:40:40 PM »
Exactly, if you post a sample DWG file someone can see what you are up against.

Are the object a result of a copy & paste? If so they will be less coding needed to detect them.

It may require separate sub-functions for different object types.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.