Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

**First time visiting? Here are some places to start:**

- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

# New point every(x) distance on line

theodore_peters
Member Posts:

**15**✭
I'm looking for a way to add a point using featurescript every x distance on a line...the tricky part is that the line doesn't have to be aligned to any certain axis, it could be askew to any axis. I'm sure there is some vector math that I am unaware of. Please point(hah!) me in the right direction!

To clarify, lets assume I have a 4 sided polygon with all 4 sides different length, and no sides are parallel to any axis or plane(aside from the flat plane being drawn on). every inch, I want to add a point to each edge...

What I have so far:

I have the user select a sketch region or face.

then I grab all edges adjacent to the face.

then I evaluate the query into an array of edges I can loop through.

inside the loop, I grab the edge's start point and end point.

here is where i need a for loop to start "i" at the start point and end when "i == end point" and increment "i" by the distance I want between points......problem is that this only works when the other value of the vector is constant. how do I create a line reference that normalizes this so that start is always (0,start) and end is always (0,end) or something to that effect?

I am working on a method that uses the distance formula and slope but I'm sure there is a method already defined for this.

To clarify, lets assume I have a 4 sided polygon with all 4 sides different length, and no sides are parallel to any axis or plane(aside from the flat plane being drawn on). every inch, I want to add a point to each edge...

What I have so far:

I have the user select a sketch region or face.

then I grab all edges adjacent to the face.

then I evaluate the query into an array of edges I can loop through.

inside the loop, I grab the edge's start point and end point.

here is where i need a for loop to start "i" at the start point and end when "i == end point" and increment "i" by the distance I want between points......problem is that this only works when the other value of the vector is constant. how do I create a line reference that normalizes this so that start is always (0,start) and end is always (0,end) or something to that effect?

I am working on a method that uses the distance formula and slope but I'm sure there is a method already defined for this.

0

## Comments

3,11115✭3,11115✭15✭In the following code:

i need each Id to be unique or it will throw me an error saying each must be unique...what do i do here?

let me know if i should start a new topic...i will post my answer to my previous question once i get this line fixed.

3,111