LSP for Topo Survey Boundary

LSP for Topo Survey Boundary

sdhara.hit
Advocate Advocate
991 Views
15 Replies
Message 1 of 16

LSP for Topo Survey Boundary

sdhara.hit
Advocate
Advocate

sdharahit_0-1770799041163.png

 

I want to create  topo survey boundary like this, the boundary line will connect outer point of survey, Is there any lsp proggram

0 Likes
Accepted solutions (1)
992 Views
15 Replies
  • LSP
Replies (15)
Message 2 of 16

-didier-
Advisor
Advisor
Accepted solution

Bonjour @sdhara.hit 

 

It’s a classic case of hull convex
Do a search with "convex hull" and you will find several solutions.

Here... 

or here ... 

 

Amicalement

Éternel débutant.. my site for learning : Programmer dans AutoCAD

DA

EESignature

0 Likes
Message 3 of 16

daniel_cadext
Advisor
Advisor

Actually, it would be a concave hull

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 4 of 16

Sea-Haven
Mentor
Mentor

Inside CIV3D is Shrinkwrap if you have CIV3D give it a try.

 

There is a program Superboundary, do a google "superboundary software Autocad". There are a couple of others out there also googling may reveal, may have a cost.

 

It is a question that has been asked before for TIN type models.

 

@daniel_cadext not sure the convex / concave will work pretty sure have tried on real data, may be a version out there.

Message 5 of 16

daniel_cadext
Advisor
Advisor

Convex definitely won’t, concave or alpha_shape is what you want. One method is to create Delaunay triangulation of the points, then delete the triangles that have outside edges, using an angle as the filter. Like https://www.theswamp.org/index.php?topic=57135. There’s probably a lisp over at the swamp

Shapely and GIS tools have stuff too

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 6 of 16

Sea-Haven
Mentor
Mentor

@daniel_cadext having played with TINS since the 80's you can not use a "delete out side edges" but maybe a "is a triangle an outside edge ?" Maybe take each triangle get edge mid point and do a multi angle ray check for intersection ie repeat check 3 times per triangle. A side with no intersections would mean keep that edge segment, end up with lots of 2 point lists.

 

In software I used could delete wrong outside triangles by length, fence for multiple etc.

0 Likes
Message 7 of 16

daniel_cadext
Advisor
Advisor

I’m not sure what you mean.  if the triangle has an edge that’s not shared, or adjacent to another triangle, check the angle, if it satisfies a requirement, delete it.

usually, with a good set of points, they're easy to spot 

 

tin.png

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 8 of 16

daniel_cadext
Advisor
Advisor

I tried to do island detection once, you can spot the malformed triangles. too hard though lol

 

tin3.png

 

tin2.png

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 9 of 16

Sea-Haven
Mentor
Mentor

The second image is the request, do you have a solution to that, python ? 

 

There is problems about boundary around objects not a TIN, using superboundary the authors can not be contacted, posted on another forum.

0 Likes
Message 10 of 16

daniel_cadext
Advisor
Advisor

I did that in C++, the routine I used is Delaunator https://github.com/mapbox/delaunator.

Not a port, but I made a wrapper for Autolisp, https://github.com/CEXT-Dan/ads_geo

Here’s a detailed guide https://mapbox.github.io/delaunator/

 

It’s incredibly fast, basically you feed in a pointset, and it returns two lists indexing out triangles and half edges. The half edges are the matching segments between two triangles.

What I did is iterate the half edges, find all the half edge pairs that have a -1 I.e. (-1 22) , then you know triangle with edge 22 is outside. Check the angles in triangle that contains edge 22, if it’s below a certain threshold, delete it.

 

Now you have a structure where you can iterate the outside edges, connect them to create the boundary polyline

 

The same wrapper contains a fast KD-Tree and a std::unordered_map<AcGePoint3d,VALUE> I created a custom hash for Points. Armed with these tools, another approach might be to investigate this paper. Concave hull: A k-nearest neighbors approach for the computation of the region occupied by a set of points. https://www.scitepress.org/papers/2007/20808/20808.pdf

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 11 of 16

autoid374ceb4990
Collaborator
Collaborator

As a retired Civil Engineer and Registered Land Surveyor can you tell me if your "delaunator" takes into account breaklines, like center lines for streams, top of bank, curb lines, etc.?

Not sure I understand your half-edge functions.

0 Likes
Message 12 of 16

daniel_cadext
Advisor
Advisor

“breaklines”

 

No, I’m not in the civil genre. The routines only generate triangles from a set of points, Delaunay and Voronoi are interesting from a graph theory perspective. The above pics are me just goofing around with point sets I had found that seemed interesting

 

“half-edge”

The Delaunator guide describes the half edges and their relation to the triangles

 

“center lines for streams”

This is also interesting from a programming perspective, I think one possible solution uses Voronoi.

 

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 13 of 16

Sea-Haven
Mentor
Mentor

@daniel_cadext I would not get too carried away trying to add more function to the TIN creation, as an Ex civil software rep, it's much easier to buy a Civil package that has those functions built into it. @autoid374ceb4990 breaklines and curved breaklines. The price for a civil package has dropped significantly. The other advantage of a package is that you get so much more features. Civ3D is obvious, I use Civil Site Design and there are others. The biggest problem with "free" code is the end users want more but not prepared to pay for it. yeah I know "but I can't afford it" is the cry, but they are getting paid for a project, not you. I do understand that design fees/costs vary all over the world.

0 Likes
Message 14 of 16

daniel_cadext
Advisor
Advisor

@Sea-Haven 

 

Actually, I was just thinking, I should vibe-code the greatest open-source civil package of all time. I have some of the parts, Delaunay, KD-Tree, Contours, Point reader.  I started goofing around here https://github.com/CEXT-Dan/ArxTin

 

But, I know nothing of the genre, I would not be able to make it Juicy and Delicious lol

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 15 of 16

autoid374ceb4990
Collaborator
Collaborator

When I started my business there were few software packages available and the ones that were available were written by software geeks, not engineers\surveyors.  So I bought an Apple II to use in my business and wrote my own "Juicy and Delicious" software.  When Apple brought out the Macintosh you had to buy a Lisa computer  ($6000) in order to write programs for the Mac.  That is when I switched to the IBM PC and the wonderful DOS operating system.

Message 16 of 16

daniel_cadext
Advisor
Advisor

"do you have a solution to that, python"

 

I added concaveman to my Python  wrappers(2.2.45)

https://github.com/mapbox/concaveman

 

concavity: A relative measure of concavity. A value of 1 provides a detailed shape, while Infinity results in a convex hull.

lengthThreshold: Determines the minimum segment length considered for further detailing, with higher values leading to simpler shapes

 

import traceback
from pyrx import Ap, Db, Ed, Ge
 
# --- Command for PyRx ---
@Ap.Command()
def doit0():
    try:
        ps, ss = Ed.Editor.select([(Db.DxfCode.kDxfStart, "POINT")])
        if ps != Ed.PromptStatus.eNormal:
            return
        
        pnts = Ge.Point3dArray([Db.Point(id).position() for id in ss])
        
        #modifiy these params to tell the solver how deep to dig
        hull_points = pnts.concaveHull(0.8, 100)
        
        db = Db.curDb()
        pl = Db.Polyline(hull_points)
        pl.setDatabaseDefaults()
        pl.setClosed(True)
        pl.setColorIndex(2)
        db.addToModelspace(pl)
        
    except Exception:
        traceback.print_exc()

 

concave1.png

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes