Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Polyline segments length

50 REPLIES 50
Reply
Message 1 of 51
rphillips
2086 Views, 50 Replies

Polyline segments length

I need a routine that will allow you to pick a polyline and then tell me the smallest and the largest segment lengths, or something that will work for the following.

I am working on some master planing and did no do the original layout not we have some design requirements.
I would like to be able to select a ployline that has multiple segments and the routine tell me what the shortest length and the longest lengths are. So the I can verify that we do not have any runs of pipe over a certain length.

Do anyone have anything like that?
Thanks
50 REPLIES 50
Message 41 of 51
rphillips
in reply to: rphillips

I am sorry, I tested it very fast and did not realize that i did not put the dialog file in my Search path folder. After looking at the code i saw that if it does not find the dcl file it will quit, and that is just what it did.
I tested it off of my desktop. Anyway it works great, just stupidity on my part.
Thanks
Message 42 of 51
Anonymous
in reply to: rphillips


Well, you're welcome. Maybe it's a better idea to
put an alert or a prompt instead of just exiting. It's up to you. I was just
wondering, because as I said, it works here. So have fun !

 

Regards


--
Humans are born with a wide horizon.
As time goes by, the
horizon narrows and
narrows, until it becomes a point of view.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
am sorry, I tested it very fast and did not realize that i did not put the
dialog file in my Search path folder. After looking at the code i saw that if
it does not find the dcl file it will quit, and that is just what it did. I
tested it off of my desktop. Anyway it works great, just stupidity on my part.
Thanks
Message 43 of 51
Anonymous
in reply to: rphillips


It seems that I forgot some scissors inside the
pacient, so you can remove the line

size=2>(print (Setq sl selection)) because it was only for
debugging purposes.

 

 

 


--
Humans are born with a wide horizon.
As time goes by, the
horizon narrows and
narrows, until it becomes a point of view.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
am sorry, I tested it very fast and did not realize that i did not put the
dialog file in my Search path folder. After looking at the code i saw that if
it does not find the dcl file it will quit, and that is just what it did. I
tested it off of my desktop. Anyway it works great, just stupidity on my part.
Thanks
Message 44 of 51
FTWilson
in reply to: rphillips

Well, I finally got around to finalizing this program for my needs. When I got into your code, I realized that it wasn't working on closed polylines when you select the last segment. It also wouldn't work on open polylines with the start and end points the same (visually closed, but not technically). I boiled it down to the way you used the vlax-curve-getDistAtPoint functions to compare pick point and startpoint. When it is the last segment, it wouldn't compute.

Anyway, I've attached my final code if you are interested. I am basically ignoring any arc segments and assuming that if I don't get a hit on a linear segment, then I don't need the result anyway.

Thanks for all the help Some Buddy!

-fred.
Message 45 of 51
FTWilson
in reply to: rphillips

Oh, and I also threw out any heavyweight polyline testing since I don't need that.
Message 46 of 51
Anonymous
in reply to: rphillips

Hi Fred,

Well, I'm glad that you managed to work something out from that code. It
certainly had some limitations, since as a general approach, one will code
by assuming a certain "reality", a state of facts relative to the initial
request, which is not always true and only later, through testing and
changes of the initial context and rules, we discover the bugs.

It's not clear for me if you finally managed to correct all the bugs that
you are mentioning here, or just a part of them.

As for the arc segments, we could reject the selection from the start, if it
contains bulges, instead of ignoring them, since this could be frustrating
for someone who sees that the shortest segment is an arc, but it's ignored.


--
Humans are born with a wide horizon.
As time goes by, the horizon narrows and
narrows, until it becomes a point of view.


a écrit dans le message de news:
6223148@discussion.autodesk.com...
Well, I finally got around to finalizing this program for my needs. When I
got into your code, I realized that it wasn't working on closed polylines
when you select the last segment. It also wouldn't work on open polylines
with the start and end points the same (visually closed, but not
technically). I boiled it down to the way you used the
vlax-curve-getDistAtPoint functions to compare pick point and startpoint.
When it is the last segment, it wouldn't compute.

Anyway, I've attached my final code if you are interested. I am basically
ignoring any arc segments and assuming that if I don't get a hit on a linear
segment, then I don't need the result anyway.

Thanks for all the help Some Buddy!

-fred.
Message 47 of 51
FTWilson
in reply to: rphillips

Too true. You have to solve the problem given and make assumptions about how it is going to be used in your environment. I didn't expect a fully developed solution, only enough to nudge me in the right direction. But sometimes I can be really obtuse with all the vl and active x functions.

I have the code finalized for what I want it to do. I did not want to reject a polyline just because it has a segment or two with bulge. I cycle through each segment and if it has bulge, I skip any further testing on it. If it is linear, then I test to see if the pick point lies along the segment. If it does, then I stop and get some further data from the segment and report the results. If I get through all segments in the polyline without a match, then I assume the segment was non-linear. Which given the inputs to the program and the parameters of polylines, should be a fairly accurate assumption.

--
Humans are reared with a point of view handed down from their parents.
As time goes by, they realize the world is not so black and white, and the horizon widens.

(Sorry, couldn't resist. Even philosophical perceptions are colored by ones own experiences...in my case the horizon has widened as I've aged.)

-fred.
Message 48 of 51
Anonymous
in reply to: rphillips

This wasn't meant to be taken (so) seriously, as a quintessence of a life
experience. It's merely a satirical and bitter-funny description of a
tendency to stubbornness and intolerance, which so often happens. Of course
there are exceptions (which enforce the rule, as they say) and I consider
myself being one :^)

--
Humans are born with a wide horizon.
As time goes by, the horizon narrows and
narrows, until it becomes a point of view.


a écrit dans le message de news:
6223701@discussion.autodesk.com...
Too true. You have to solve the problem given and make assumptions about
how it is going to be used in your environment. I didn't expect a fully
developed solution, only enough to nudge me in the right direction. But
sometimes I can be really obtuse with all the vl and active x functions.

I have the code finalized for what I want it to do. I did not want to reject
a polyline just because it has a segment or two with bulge. I cycle through
each segment and if it has bulge, I skip any further testing on it. If it
is linear, then I test to see if the pick point lies along the segment. If
it does, then I stop and get some further data from the segment and report
the results. If I get through all segments in the polyline without a match,
then I assume the segment was non-linear. Which given the inputs to
the program and the parameters of polylines, should be a fairly accurate
assumption.

--
Humans are reared with a point of view handed down from their parents.
As time goes by, they realize the world is not so black and white, and the
horizon widens.

(Sorry, couldn't resist. Even philosophical perceptions are colored by ones
own experiences...in my case the horizon has widened as I've aged.)

-fred.
Message 49 of 51
marlance
in reply to: rphillips

how about deleting the longest segment of polyline?
Message 50 of 51
Lee_Mac
in reply to: marlance

rulep21 wrote:
how about deleting the longest segment of polyline?

 

Please refrain from posting the same question twice - I have answered your question here.

 

Message 51 of 51
marlance
in reply to: rphillips

my apology lee for this.
i'm might be so desperate on waiting for the solution.
i'm so glad your quick response.

regards
roldan

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost