Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hello Everyone,
I am utilizing a slider to adjust the scale of an object in order to essentially "zoom" in and out for a better view. The problem here is that the existing 3D labels remain in the same location thus not correlating to the object properly. The question here is can I get the labels to scale with the object? If not, could the labels somehow be linked to certain co-ordinates so that they stay in place while the object changes scale?
-Thank You
Solved! Go to Solution.
Thank you for the response. I'll give it a whirl and report back!
Edit: After spending a few hours trying to solve this issue I thought of a more simple solution (at least for my application). What I did was link the slider to the ThingMark and had it adjust the marker width. This way, when I move the slider it essentially simulates a 'zoom' feature by enlarging everything in the 3D canvas. This might present some limitations in the future, but it is good enough for now!
AFAIK there is no easy way to do this. All model coordinates are global so you can't place your labels with relative coordinates which might help in this case. In my experience scale also causes the model to move in 3D space as it scales relative to the 0,0,0, so if this is off to the side of your part the part will translate away from 0,0,0 as scale increases. Here are my suggestions on possible solutions:
1. Switch to a fixed scale increase and use a toggle button to switch between scale = 1 and scale = x. Then you can either make two sets of labels (one for each scale in the correct position) and hide/show as needed, this could be done all without code. Or you can change the coordinates for the label position to move one set of labels, this would require some JS code.
2. Write a bunch of JS code to take the slider value and apply a transformation to the 3D label coordinates to move them thru space as needed to maintain position. This would give you the the nice slider scaling action you want but would be a lot of math and work.
Thank you for the response. I'll give it a whirl and report back!
Edit: After spending a few hours trying to solve this issue I thought of a more simple solution (at least for my application). What I did was link the slider to the ThingMark and had it adjust the marker width. This way, when I move the slider it essentially simulates a 'zoom' feature by enlarging everything in the 3D canvas. This might present some limitations in the future, but it is good enough for now!