Detecting a boundary for a not closed object

Detecting a boundary for a not closed object

Anonymous
Not applicable
3,282 Views
13 Replies
Message 1 of 14

Detecting a boundary for a not closed object

Anonymous
Not applicable

We have a few 2D Blocks with very irregular shapes. The 2D blocks are slices or projections of 3D objects clearly extracted from a different software. We are looking at calculating the area of those shapes. However, the shapes are not closed entities and our app fails to find the boundary. We even tried using hatch and adjusting the tolerance to create and keep the boundaries, but it is also failing to detect it.

The question is: Is there any development or option to detect this overall boundary when lines are not perfectly closed or overlapping? 

Thanks

0 Likes
3,283 Views
13 Replies
Replies (13)
Message 2 of 14

marko_ribar
Advisor
Advisor

I think you are in bad situation, but have you tried "PEDIT" command "Multiple" option, "Join" and specify fuzz tolerances for gaps, for ex. 0.0001...?

If curves are overlapping too then I can't think anything better than command "OVERKILL"...

So all, in all, try combination of both commands and see if the shapes will close...

HTH., M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 3 of 14

Anonymous
Not applicable

Hi Marko,

 

Thanks. Yes we tried all that and unfortunately didn't work.

Thanks for your tips.

 

Daniel

0 Likes
Message 4 of 14

Scottu2
Advocate
Advocate

Biagi,

 

If your program does not work with Splines you may have to convert them to LWpolylines.

Try the Flatten command on the objects and then use Overkill.

Adjust the Overkill command with setting of .002 instead of .000001  and mark the lower check-boxes to combine lines

 

(The Flatten command part of the express tools ribbon)

 

 

Message 5 of 14

hak_vz
Advisor
Advisor

 

 


@Anonymous wrote:

We have a few 2D Blocks with very irregular shapes. The 2D blocks are slices or projections of 3D objects clearly extracted from a different softwar

Thanks



Area is not exclusively linked to closed boundary. As you say, your polylines are inside blocks that don't provide area information. To get area of an object inside a block (insert) use this. Just click on a boundary.

 

(defun c:get_blk_area( / e bo area)
    (setq e (car (nentsel)) bo (vlax-ename->vla-object e))
    (if (vlax-property-available-p bo 'area)
        (setq area(vla-get-area bo))
        (setq area 0)
    )
    area
)

 

It would be easier to work with sample drawing, but I hope this is what you are looking for.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 6 of 14

john.uhden
Mentor
Mentor

@hak_vz 's offering may be very helpful

IF there is an entity like a polyline to select.

Otherwise you are probably out of luck as the getboundingbox method will always return the lower left and upper right corners of a rectangle that surrounds the object.

I wish there were a getboundingoutline method.

John F. Uhden

Message 7 of 14

Sea-Haven
Mentor
Mentor

Like others here.

 

There is Lineworkshrinkwrap, Convex hull and a commercial product, how well they all work ? 

 

If they can be plines then open plines do return area.

 

There is area by points methods but if curves then its not accurate, arc to chords improves accuracy at expense of speed.

 

Really need a dwg may require explode block or may be as simple as get entity inside block.

Message 8 of 14

stevor
Collaborator
Collaborator

One way, is to make a lisp routine that uses  the convex hull  method,

like at:

http://www.lee-mac.com/convexhull.html-- or 

http://www.realerthanreal.com/autolisp/ConvexHull3D.lsp.

 

S
Message 9 of 14

hak_vz
Advisor
Advisor

Convex hull algorithm(s) are applicable only for limited group of shapes. It will not produce correct results for complex shapes, let say a star.

As long as we have to guess what kind of polylines (splines) or even line segments is saved inside block we can not offer proper solution. @Anonymous says that blocks are created in 3d party application, what means a lots of shortcut solutions.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 10 of 14

Anonymous
Not applicable

Thanks everybody for your help.

 

Unfortunately I can't upload the blocks due to confidentiality issues. I will try all your advice and get back to you.

Additionally I think I will try something else: I will convert the blocks to JPG and do a trace over using the AutoCAD Rasteer Design functions (automatically). Hopefully, the polilines drafted on top of the lines will be simpler and easier for AutoCAD to detect. Some accuracy will be lost but it will hold 98% of it.

 

I'll try all these approaches and get back to you.

 

Thanks for your help

 

0 Likes
Message 11 of 14

stevor
Collaborator
Collaborator

If Convex hulls are inadequate,  Concave hulls can be made, with much more investment.

About the same cost would be decompose, ie, separate, the 'blocks' into parts that are primitive enough to get their areas.

S
0 Likes
Message 12 of 14

hak_vz
Advisor
Advisor

@Anonymous  To determine what kind of polyline object is inside a block paste following code in system console, run it and click on a line object inside a block.

 

(cdr(assoc 0 (entget(car(nentsel "\nSelect line object \n")))))

 

 I hope my code will work, but just in case it won't, at least we'll know crucial info to update code.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 13 of 14

Sea-Haven
Mentor
Mentor

Draw something close or edit one of the blocks distorting its shape its really about no idea what you have.

 

Only send a couple of  blocks use wblock and pick block objects will not make much sense without text etc.

0 Likes
Message 14 of 14

abdullah_najm
Explorer
Explorer

Thanks a lot!

0 Likes