PLD (polyline Diet) last vertex not being deleted

PLD (polyline Diet) last vertex not being deleted

MaccyDee
Enthusiast Enthusiast
1,316 Views
9 Replies
Message 1 of 10

PLD (polyline Diet) last vertex not being deleted

MaccyDee
Enthusiast
Enthusiast

Hi all, 

having an issue with PLD I've got a closed polyline with the last and first vertex on the same line (co-incident?)  but it's not removing the extra vertex, I've noticed it a couple of times now and I'll have to manually select and remove the vertex and its always the end/start of the polyline.

 

I'm thinking it may be something to do with the first vertex not being at the corner because;

  • if the corner is vertex 9 as per the attached image, if there is a vertex before the corner (vertex 8) and after the corner (vertex 1), it will delete the one before the corner but not after.

 

lisps are like hieroglyphs to me especially without comments so some guidance would be grand 😂

 

 

Polyline Diet | CAD Tips (cadalyst.com)

0 Likes
1,317 Views
9 Replies
Replies (9)
Message 2 of 10

Kent1Cooper
Consultant
Consultant

It may not make the difference, but [partly since downloading from Cadalyst CAD Tips isn't working right now] here's a newer version of that.  I don't recall what has changed since the one at that link, but maybe something meaningful to your issue.  I will think about it later, but I gotta go....

Kent Cooper, AIA
0 Likes
Message 3 of 10

MaccyDee
Enthusiast
Enthusiast
Tried it, but to no avail, but thankyou for the updated version regardless
0 Likes
Message 4 of 10

Kent1Cooper
Consultant
Consultant

@MaccyDee wrote:

... I've got a closed polyline with the last and first vertex on the same line (co-incident?)  but it's not removing the extra vertex .... I'll have to manually select and remove the vertex and its always the end/start of the polyline.

....


[Collinear is the word you want.]

 

That's just a result of the way it decides whether to remove a vertex.  It compares the current reference vertex [let's call it A] to the one two vertices further along [C], for distance and for the angle of bend at B in between, to decide whether to remove vertex B.  At the situation you describe, there is no vertex 2 further along [from your vertex 9], so it cannot remove the original start/end vertex.

 

I suppose it might be possible, on closed Polylines only, to have it do that comparison across the start/end, which would require a different determination of what to compare than it uses for all the rest.  I expect that's possible and if I manage to work that in, I'll post an update.

Kent Cooper, AIA
0 Likes
Message 5 of 10

Kent1Cooper
Consultant
Consultant

@MaccyDee wrote:

.... I've got a closed polyline with the last and first vertex on the same line .... it's not removing the extra vertex, .... its always the end/start of the polyline. ....


I found a simple trick [short of adding a check across the start/end as mentioned in my previous Reply] that overcomes this.  REVERSE the Polyline, which uses the original last vertex for the new first, and the original first one within the collinear stretch becomes the last one before the closing.  With that, PLD unaltered will remove that original start/end vertex, because it's no longer the start/end.

Kent Cooper, AIA
0 Likes
Message 6 of 10

MaccyDee
Enthusiast
Enthusiast

Thanks, that appears to work most of the time!

Occasionally i have a midpoint vertex on top of start/end vertexes that requires PLD to run twice, just thought i'd mention this if you're going to go through the effort of updating the code 

0 Likes
Message 7 of 10

Kent1Cooper
Consultant
Consultant

@MaccyDee wrote:

... i have a midpoint vertex on top of start/end vertexes that requires PLD to run twice, .... 


I'm not picturing what you mean by that.  Can you post a small drawing containing such a Polyline?

Kent Cooper, AIA
0 Likes
Message 8 of 10

MaccyDee
Enthusiast
Enthusiast

this is not *exactly* what happens but more or less the same thing, I've tried PLD on this line and it doesn't do anything to it, but when I encounter these types of lines organically it will work, next time i find it organically ill b sue to post an example.

 

 

I'm not entirely sure how i end up with these lines but i think it might be from trimming line work that have been offset and cut up and joined to form a closed polyline that indicates a pipe route.

0 Likes
Message 9 of 10

MaccyDee
Enthusiast
Enthusiast

well that didnt take long...attached is an organic instance 

0 Likes
Message 10 of 10

Kent1Cooper
Consultant
Consultant

In your fabricated example, I don't understand what you would want removed.  The segment that has a vertex midway along it is entire in itself -- that vertex is unrelated except for the tracing over itself aspect, and I don't see what could be removed without changing the shape entirely.

 

In your "organic" example, I'm not sure why PLD doesn't take that extra inside corner vertex out, but I also don't understand how that is "a midpoint vertex on top of start/end vertexes," since the start/end is several vertices away from the problem location.  It may have something to do with the fact that the (angle) function, given the same point twice, always returns 0, regardless of the direction of adjacent segments, so it does not consider the zero-length segment collinear with either adjacent one.  It might work if the object is rotated in just the right way [I'll leave it to you to experiment].  Coincident vertices are the cause of many problems.  BUT I find OVERKILL will take care of that one.

Kent Cooper, AIA
0 Likes