Insert points on 2D spline by equal distances

Insert points on 2D spline by equal distances

danijel.radenkovic
Collaborator Collaborator
754 Views
6 Replies
Message 1 of 7

Insert points on 2D spline by equal distances

danijel.radenkovic
Collaborator
Collaborator

Hello,
I am trying to find a way to insert points on some 2D spline, programmatically. Distances between points need to be equal of course.
I suppose it can be done using some ilogic rule or vba.
Any reference or suggestion. I will be appreciate.

 

spline.png

Best regards

Danijel

Inventor 2018/Windows 10 x64
If this information was helpful, please consider marking it as an Accepted Solution by using the Accept as Solution. Kudos are also gladly accepted.
0 Likes
755 Views
6 Replies
Replies (6)
Message 2 of 7

danijel.radenkovic
Collaborator
Collaborator

I'm wondering is there a person who can suggest or give some advice about this topic?

 

Regards

Danijel

Inventor 2018/Windows 10 x64
If this information was helpful, please consider marking it as an Accepted Solution by using the Accept as Solution. Kudos are also gladly accepted.
0 Likes
Message 3 of 7

LukeDavenport
Collaborator
Collaborator

Hi daniel,

The simplest way would probably be to use a built-in API function to do this. Try the GetStrokes method for the sketch spline geometry. 

 

http://modthemachine.typepad.com/my_weblog/2012/05/get-strokes-for-2d-and-3d-transient-wireframe-geo...

 

Hope this helps,

Luke

0 Likes
Message 4 of 7

danijel.radenkovic
Collaborator
Collaborator

Hello Luke,

Thank you very much for engagement on this topic.

I don't need to create spline, I have created already. I just need to build a macro which will add points on 2D spline. Points can't be control points, just simple points which are coincident to spline and on equal distance between each of them.

 

I know, It is not a simple. But maybe someone on the forum have worked on the similar case in the past.

 

Best regards

Danijel

Inventor 2018/Windows 10 x64
If this information was helpful, please consider marking it as an Accepted Solution by using the Accept as Solution. Kudos are also gladly accepted.
0 Likes
Message 5 of 7

LukeDavenport
Collaborator
Collaborator
Danijel,
The example in the link I posted doesn't create the spline for you, if you
look at the code it takes a given spline and returns a load of vertex
points spaced along the spline (which you could create sketchpoints from).

Although - looking at it a bit more closely - it looks like you can't
specify the quantity of points you want along the spline, only the
tolerance away from the spline for the 'strokes' (the straight lines
approximating the spline curve)

If you need a certain quantity of points along the spline, you might need
to write your own routine to step along the spline, using the
Geometry.Evaluator.GetPointAtParam, GetParamAtLength etc methods. I think
there's some examples of using these methods in the API help files.

Cheers,
Luke
0 Likes
Message 6 of 7

danijel.radenkovic
Collaborator
Collaborator

Hello Luke,

Now I understand what did you mean. First, I tried to adapt example on my problem and it is not possible cause I am working with 2D curve not 3D.

But on 3D spline it works fine and if I find a way to collect coordinates of nodes, maybe I will be able to create a points afterward. Other thing is that this is "transient wireframe geometry" and this is the first time that I see that type of geometry in sketch. I didn't have oportunity to work with it.

 

1. I am deciding a number of points and macro need to calculate distance between points by spline length and number of points (L/n). It is very important that all of added points are not the parameter of spline (added points are not control points)

2. Quantity of points is not fixed. I am deciding how many points will be on spline by my opinion.


@LukeDavenport wrote:
Danijel,
The example in the link I posted doesn't create the spline for you, if you
look at the code it takes a given spline and returns a load of vertex
points spaced along the spline (which you could create sketchpoints from).

1. Although - looking at it a bit more closely - it looks like you can't
specify the quantity of points you want along the spline, only the
tolerance away from the spline for the 'strokes' (the straight lines
approximating the spline curve)

2. If you need a certain quantity of points along the spline, you might need
to write your own routine to step along the spline, using the
Geometry.Evaluator.GetPointAtParam, GetParamAtLength etc methods. I think
there's some examples of using these methods in the API help files.

Cheers,
Luke

 

Inventor 2018/Windows 10 x64
If this information was helpful, please consider marking it as an Accepted Solution by using the Accept as Solution. Kudos are also gladly accepted.
0 Likes
Message 7 of 7

Jef_E
Collaborator
Collaborator

@danijel.radenkovic @LukeDavenport

 

Did you ever got the GETSTROKES method working? I'm stuck...

 

http://forums.autodesk.com/t5/inventor-customization/3d-arc-geometry-evaluator-getstrokes-quot-type-...



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes