Hi , I am trying to display protractor angle parameter value as text . by using Set Value as Text option in Text plus. But when i click on set value as text option in Text plus. and then in the window that opens i click on Pick value from scene button. and then selected protractor helper object in the scene i get only one option Transform and then position and rotation but no option to display angle parameter value .
basically i dont want to animate, just display the angle value of a line object when i move its middle vertex .
i am following a tutorial in autodesk 3dsmax learning channel https://www.youtube.com/watch?v=W_DsXHpuUYw&t=1s
Solved! Go to Solution.
Solved by MartinBeh. Go to Solution.
Solved by MartinBeh. Go to Solution.
Solved by MartinBeh. Go to Solution.
Hi!
Protractor seems to be a really odd piece of code in 3ds Max, it has no properties one can use in MAXScript. Neither does it have any parameters available in Trackview. So you cannot "get" the Protactor angle, and you also cannot query the two target nodes it references.
So I would suggest to use a bit of math in TextPlus to re-calculate the angle between the Protractor location and the two objects instead.
For this, I would use the dot product:
-- location of three objects: Protractor, ObjectA and ObjectB
Ppos = $Protractor001.pos
Apos = $ObjectA.pos
Bpos = $ObjectB.pos
-- unit-length vectors from H to A and B
vecHA = normalize (Apos - Ppos)
vecHB = normalize (Bpos - Ppos)
-- angle in degrees
angDeg = acos (dot vecHA vecHB)
Hope this helps
3ds max 2019 is too old for me, so here is a screenshot of the "Set value as text" dialog of TextPlus:
Shown is the assignment of the "Ppos" variable to position track of the protractor - you will have to set the assignment for Apos and Bpos accordingly.
i kept tweaking the whole night . never knew it would be so difficult. but thanks for answering . i will surely try now.
thanks for the script it worked for me really well. But now i have a problem . the measure of angle does not exceed 180 degrees. i want the angle to read from 0 degree to 360 degrees.
-- location of three objects: Protractor, ObjectA and ObjectB Ppos = $Protractor001.transform.pos Apos = $ObjectA.transform.pos Bpos = $ObjectB.transform.pos -- unit-length vectors from H to A and B vecHA = normalize (Apos - Ppos) vecHB = normalize (Bpos - Ppos) vecC = cross vecHA vecHB -- angle in degrees angDeg = acos (dot vecHA vecHB) If (dot vecC [0,0,1]) >= 0 then angDeg else (360 - angDeg )
thanks for the reply sir. You are exactly right the protractor can measure only till 180 degrees.
I was about to give up the whole project because i couldn't get it right. But you got it going for me..
.
your solution set things right for me and instilled confidence in me to go with the project.
A member from your forum helped me in setting things right. the above script is exactly what i was looking for.
Excellent service from autodesk. Kudos to all you amazing people out there.
Can't find what you're looking for? Ask the community or share your knowledge.