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)
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.
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.
create 2 vectors from points - prev pos, pos, nxt pos / a_vec, b_vec
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
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?
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)
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.
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)