Author Topic: How to find Min Width of a Polyline  (Read 3081 times)

0 Members and 1 Guest are viewing this topic.

Proctor

  • Guest
How to find Min Width of a Polyline
« on: May 22, 2008, 03:02:43 PM »
Hello: I'd like to try and find the minimum width in my polylines2d. For example, if I have the letter "C" depending on the font used, it will have varried widths for this poly letter.

I've thought about using geometric extents to get min max x...or looping though the vertecies to get points
but hit a dead ends.

Does anyone have any ideas on how I might be able to do this?

Any ideas/thoughts are truly appreciated.
Thanks,
Proctor

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find Min Width of a Polyline
« Reply #1 on: May 22, 2008, 03:10:50 PM »
I think a pic might work here, as I don't really understand what you are trying to do.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Proctor

  • Guest
Re: How to find Min Width of a Polyline
« Reply #2 on: May 22, 2008, 03:29:57 PM »
Hi - and thanks for the reply.

here's a pic ....as requested.
If I open this drawing in autocad and dimension random widths inside this letter "C" (see pic), I can find the minium width for the letter. But, how can I find this value dynamically...after the user selects the letter "C" for example.


I would like to use this value to offset my letter with ....it enables me to get a single row of my leds (blocks) inserted into the letter.

the first pic shows how it looks when I enter in the correct offset value (or minimum width of the letter).

the second pic shows how it looks when I enter an incorrect offset value.


I hope this helps...let me know if i've confused you further. it's hard to explain.

Proctor

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find Min Width of a Polyline
« Reply #3 on: May 22, 2008, 05:44:35 PM »
So you have the 'c'.  You pick it, and you want to place your LED blocks in the middle of the letter.  Is the letter a single pline?

I think I understand, but just trying to make sure I do.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Proctor

  • Guest
Re: How to find Min Width of a Polyline
« Reply #4 on: May 22, 2008, 07:30:20 PM »
Yes....that's correct. The letter is a single polyline2d;

... you know how normally when you offset - e.g. you are doing the letter "C", it would appear as if there were 2 rows in it because the offset is goes inside the curves of an enclosed poly. (see new pic)...

well, in this paticular senerio, i need it to appear as if there was just one row - just like pic one of first attachment I sent you..with a single row of leds running through the exact center points inside the poly letter.

when i did the code for the 2 rows, I offset the poly and then moved along the curves and  using GetPointAtdist method to place the led blocks along this new curve. I'd like to do something similar w/ the one row. I offset and from this offset poly i am trying to find where to place the leds. 

i've been struggling struggling...haven't had to much autocad .net experience and this stuff is hard hard hard.

anyway, I appreciate any ideas you may have. thanks for your time too. let me know if you have more questions.

Thanks again,
Proctor

Bryco

  • Water Moccasin
  • Posts: 1883
Re: How to find Min Width of a Polyline
« Reply #5 on: May 23, 2008, 08:51:35 AM »
Proctor, I think I would try the following;
1)  Make one polyline of the short curve of the "c", then make one polyline of the long curve.
This is a little tricky but presuming all the "C"s you use have a straight line at each end, you can cycle through looking for a segment with no bulge then recreate the plines(no need to add them to the database). Start the short pline the distance from the end you place your first LED.

2) Divide the short pline by 100 and find the corresponding perpendicular point on the long pline using .GetClosestPointTo.
Make a new pline of all the midpoints, with a 100 points you probably don't need to worry about bulges.

Proctor

  • Guest
Re: How to find Min Width of a Polyline
« Reply #6 on: May 23, 2008, 01:51:03 PM »
Hi Bryco: Thanks for your reply....your idea sounds great. I'm on travel for a few days - but have some questions to ask when I return...just wanted to thank you for your reply.

Proctor

Proctor

  • Guest
Re: How to find Min Width of a Polyline
« Reply #7 on: May 26, 2008, 05:26:37 PM »
Bryco: I had some time to look over your ideas...thanks again for sending.

I apologize for not stating that the user could pick any letter of the alphabet...not just "C". In addition, the shape of the letter will vary based on what ever font the image was created in.

I wanted to ask you what you thought about incorporating your ideas - and dividing the entire poly by 100 and finding the point that is perpendicular to each point... and then finding midpoints of each line segment. It does seem as though this idea could work ....w/ some additional logic added to it...?

Thanks again for sharing your ideas.
Proctor



Bryco

  • Water Moccasin
  • Posts: 1883
Re: How to find Min Width of a Polyline
« Reply #8 on: May 27, 2008, 03:41:13 PM »
I am not sure you can design something that works for all letters at once.
Sometimes it's best to figure out how to do one at a time and use what you have learnt along the way to reckon the best overall approach.

Proctor

  • Guest
Re: How to find Min Width of a Polyline
« Reply #9 on: May 28, 2008, 06:20:35 PM »
Bryco: I agree...it seems like often that's the only way - I guess I'll start w/ one letter and keep moving through the alphabet as suggested. sometimes it just helps to hear it from someone else.

Thanks again for your advice.

Oh...I wanted to ask you ..when you mention Dividing the pline above, is there a method you use to do this? I've been having to loop through the poly using GetPointAtDist and drawing points while adding them to a point collection. Just wanted to know if there's an easier way.

Thanks again,
proctor