Jump to content

Trimming polyline challenge


Aftertouch

Recommended Posts

Hello all,

got myself a question now, wich i realy cannot solve myself this time...

On the left side 4 cases, with on the right side the desired results.

The case can be anything between these, but will be shaped like this in some way.

 

I want the blue line to be trimmed on the yellow one, but the blue line must always remain above the yellow one.

Yellow = earthwork, blue = water.

There is always one yellow and one blue line.

 

lets say...


!waterline = blue entity

!earthline = yellow entity.

 

image.thumb.png.ebafa6f6a4577f996ccac5de001f0513.png

 

Hope somebody can do me a suggestion. 😉

Link to comment
Share on other sites

Why do you need this automated... You can easily do this manually... I think this is a rabbit hole for someone willing to code it as it takes more time to make lisp than that lisp can save time by using it...

Link to comment
Share on other sites

Since this is a part of something larger where im generating profiles based on numbers.

Sometimes up to 40 profiles in one go. 😉

Edited by Aftertouch
Link to comment
Share on other sites

Few words to solve the puzzle:

• GetBoundingBox method (activeX),

• Ray casting method (algorithm in LISP)

• Break Sub by CAB

• This pseudo-conditional:

(if (DoesAVerticallyCastedRayFromTheBlueSegmentIntersectsTheYellowLine BlueSeg YellowLine)
  (erase BlueSeg)
)

Right now I don't have time to assemble it, so good luck solving! :)

  • Like 1
Link to comment
Share on other sites

5 hours ago, Aftertouch said:

Since this is a part of something larger where im generating profiles based on numbers.

Sometimes up to 40 profiles in one go. 😉

 

 

What sort of line entities are the earthline and the waterline?

Link to comment
Share on other sites

Applause for Grrr, as someone just starting down the path of learning Lisp, I personally find this reply more helpful than half a dozen people trying to better each other by seeing who can feed the biggest fish to the OP this breaks it down into easy steps giving useful pointers to the thought process behind it, and some useful tips about how to approach it. I'm saddened by the trend at the moment (in many forums) where people just post requests and they get working solutions, We have some of the brightest people in the Cad world right here on CADTutor, and so many people wanting to learn how to fish. I'm not for one minute suggesting the OP is just hoping someone will give them the code and move onto the next item in the wish list. But all too often that is how it comes across (to me at least). So my thanks to all of you who have answered here. There are a lot of us watching you from the sidelines trying to learn how "you" do it, the way you approach it, more importantly, the methods available and the thought process behind it, and this is much more instructional than saying "here's the answer".

  • Thanks 1
Link to comment
Share on other sites

2 hours ago, dlanorh said:

 

What sort of line entities are the earthline and the waterline?

 

Oops :(   Senior moment :oops:

 

I'd do it slightly differently to Grrr, but the approach is much the same

 

Get the two polylines

Get the coordinates of the waterline

Find the insersection points and feed back into the waterline polyline.

collect the line objects made from exploding the waterline (code below)

 

(setq l_objs (vlax-invoke wl_obj 'explode))

delete waterline

loop through line objects in l_objs

        insert an xline (per to) at the mid point of each line object

       get the intersection between the xline and the earthline

      delete xline

      If the mid pt y coord less than the intersection point y coord  add line obj to delete list

end loop

remove delete list objs from l_objs and delete

run the remaining lines in l_objs through pedit (peditaccept set to 1)

 

 

Edited by dlanorh
Link to comment
Share on other sites

Hello all, 

 

Solved the problem, by instead of trimming the line, drawing the line where it should be.

The program loops trough all vertexes. Checks current and next point, it it intersects, it calculates the points.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...