Author Topic: Trying to insert 1 row of leds into my polys - working with offset curves  (Read 2374 times)

0 Members and 1 Guest are viewing this topic.

Proctor

  • Guest
Hello: I've been working on my project..that involves inserting leds (as rectangular blocks) into letters that are brought into cad as vector formats (usually polys). the blocks need to rotate ...along with the curves.

I'm been working with the curves class and using offset and was able to get the leds  into the letters and have them rotate and be spaced evenly for cases when they will require 2 rows of leds;

Currently, I'm working on cases for when they require only one row of leds per letter. These will need to be placed along the midsection for each letter and am struggling with it.

Since you always get 2 rows when you offset the poly, I came up w/ a plan - which seems kind of hokey...and wacky when I look at it.....so I wanted to run it by you to see if anyone might have any thoughts on either my approach...or another way which I could accomplish this.

Here's my approach in puesdo code:

1) For each poly selected, get offset curves (the original offset distance is determined
from user input (of what the stoke width should be for the letters)...I divide this in half.
2) if rows needed = 1 then, for each poly (letter), get curve count
3) if it's >1 loop...reducing offset by very small increments until it adjusts to 1 curve count.
4)For each curve, look at the ratio (one I made up from looking at letters) of old poly length/new poly length. This is to make sure that the curve goes through the entire letter. e.g. I noticed that for example for the letter F, I was getting one curve, but this curve didn't run through the whole letter. Loop until this ratio indicates that the curve is proportionate to the letter.
5)append new entity
6)loop through the new poly curves using newPl.GetPointAtDist(dSpacing * z), and add these point to a collection
7) loop through collection and for each point, try to find the point closest to it..but is not at the distance that was used when placing them along the curve. (using myPt.DistanceTo(myBlockPtTempCollection(a))
8.0) find midsection of these two points
9) make new point
10) make new poly along these points
11) place leds once again, using GetPointAtDist

The problems I'm having is:
a) it's slow to run through all this stuff..and I keep wondering how I could do it differently.
b) when i look for the closest point, I use myPt.DistanceTo(point in collection) and want to ignore all points that were placed using newPl.GetPointAtDist(dSpacing * z); however, I realized that this doesn't work, because it gets the distance between the two points as a line...not along the curve..and therefore, it is inacuracte.

I've included a file to give you an idea of what the results shoud look like (leds in letters...1 row). I only need to eliminate the line...and just show the leds.

Any response, advice, dirrection, is really appreciated.
Thanks,
Proctor

Bryco

  • Water Moccasin
  • Posts: 1883
Letters are tough.
Do you get them from illustrator,
if so is it better to draw the centerline in that program?

Proctor

  • Guest
Bryco - thanks for the reply. We get the original image from the customer - sometimes as  a raster...others as a vector; however, after that, we use Correl draw to convert to wmf so we can import into cad. I don't know if correl draw has this feature - how do you do it in illustrator?

thanks again for giving me some ideas.
Proctor

Bryco

  • Water Moccasin
  • Posts: 1883
Proctor, I don't use illustrator myself, but tomorrow I'll ask someone at work.

Proctor

  • Guest
thanks....

Bryco

  • Water Moccasin
  • Posts: 1883
It looks like a no go, it seems are made from the outside in rather than the center out.

Proctor

  • Guest
ok...well....thanks for getting back to me on that. I've been working with my code to try and get it more efficient.

thanks again,
Proctor