Cancel
Showing results for
Search instead for
Did you mean:

# Two Vectors Angle  Gears Phenom

Hello ,

is there any simple function that returns angle between 2 vectors (in 3D) ?

Or any good idea?

Because I calculate it step by step (with dot product,acos, vec length, etc..) and it is little bit tidious way

(I am calculating angle deviation in segmented tool path)

Thank you

---------------------------------------------
#♫ PB, 5ax, itnc, nx, vericut ♫ #
10 REPLIES 10

# Re: Two Vectors Angle  Siemens Phenom

Hello @Juraj

This would be a good example to make a small custom application with one of the NX programming tools. Probably SNAP would be my first choice considering it's a simple select , measure then calculate function.

You could make a nice icon, add it to your toolbar to make it super simple to use.

Regards

Paul

# Re: Two Vectors Angle  Solution Partner Phenom
@Juraj,
In ugopen exist very useful function UF_VEC3_angle_between, return no sign angle 0..360 but you must to add third vector to define rotation from 1st to 2nd. Usually 3rd vector is a cross product 1st and 2nd.
In TCL you must to calc with dot, acos. Not so bad, if you need just value of angle and no need shortest angle from 1st to 2nd.

# Re: Two Vectors Angle Legend
@Juraj
In PostConfigurator there is a function that do this.

I give you the link where you can find it

https://docs.plm.automation.siemens.com/tdoc/nx/12.0.1/nx_help#uid:xid1128418:index_mfgpostconfig:xi...

# Re: Two Vectors Angle  Siemens Phenom

Here is a sample from the docs. Search for Angle Method.

Regards

Paul # Re: Two Vectors Angle  Gears Phenom

Hello,

thank you all for reply

I am not experienced in NX open programing :/

Anyway, I calculate angle between two tool path segment - sharp corner angle

and if there value bellow 120deg I output some smoothing function in NC code.

(Customer wish)

In short:

create 2 vectors from points - prev pos, pos, nxt pos /  a_vec, b_vec

vec unitize

vec mag as a length / |a_le|, |b_le|

vec dot product / a.b

then cos_del [expr [VEC3_dot a_vec b_vec]/\$a_le*\$b_le]

and from cos get the angle

and then 180 - angle to get inside corner angle

---------------------------------------------
#♫ PB, 5ax, itnc, nx, vericut ♫ #

# Re: Two Vectors Angle  Siemens Phenom

Hi @Juraj

I'm interested in this bit: "output some smoothing function in NC code" I assume you remove "pos" and replace with something. The length of each vector would be taken into account I assume.

Seems doable but would need some heavy testing. I'd be keen to pursue this further.

Do you want to do this during postprocessing or as a function on an existing G-Code file?

Paul

# Re: Two Vectors Angle  Gears Phenom

Hi,

I do it during postprocessing.

If angle is less than 120deg - I output G61, else I output G64. I did it in CMD and as input points for vector I use mom prev pos, mom pos, mom nxt pos

Actually this logic seems working.

(To be honest, customer figure out that such logic is good I really dont know what machine will do.)

(They have probelms with braking and some others)

---------------------------------------------
#♫ PB, 5ax, itnc, nx, vericut ♫ #

# Re: Two Vectors Angle  Siemens Phenom

@Juraj

Ok I see now. They want exact stop on something that should be defined and not washed away by the machine not stopping exactly at the programmed points probably because of high feedrates.

Thanks for the clarification.

Paul

# Re: Two Vectors Angle  Gears Phenom

yes exactly

they trying to find some solution to keep sharp corners really sharp and on "flat" areas to keep smooth/fluent motion

(machine is a little bit dummy)

---------------------------------------------
#♫ PB, 5ax, itnc, nx, vericut ♫ #