Any way to make objects move that aren't animation objects

Any way to make objects move that aren't animation objects https://forum.weintekusa.com/uploads/db0776/original/2X/7/7d91892c55221321209bec532e8a096da82e269e.png
none 0.0 0
  • HMI Model: cMT3162X (V2)
  • EasyBuilder Pro Version: 6.10.01.173

Hey there, I have been poking around the manuals and tutorials and haven’t seen anything that could be helpful.
Basically I would like to be able to move some labels, shapes, toggle switches, etc around and axis in the center of a graphic that represents a rotary table. this would read the table position to determine the position of the graphic

Is there any way to actually do this? it seems to me that the only objects that can be animated are those that are created with an animation object, so I would only be able to animate bit lamps. Additionally, these positions would have to be hand placed in a circle which is less than ideal.

thanks for your feedback.

I think you can attempt to use Direct Window objects with the “Dynamic position” option checked. This way the Direct Window will display a popup window that accommodates your labels, shapes, Toggle object, etc, when the popup moves to the position you want by sending X,Y position values to the specified two registers.

The X, Y values for positioning can be found on the bottom of the EBpro IDE when you move your mouse cursor on the editor.

1 Like

That’s a great idea. Can you confirm that the position of the window is the top, left corner? so the path would need to look something like this?

Yes, you will locate the popup window using its top left corner (x,y) to set up each position for the path.

1 Like

There have been a couple issues that I have encountered. The first is that is the words for window placement need to be integers and the calculated locations are rarely nice round integers. I haven’t thought of a solution for this yet.
The next issue that I am having is that the macro that I wrote to do this math seems to be outputting bad data. like COS(180) is coming out as 2.590… when its supposed to be -1. Similar issue with SIN(180).

Here is the macro that I am using to calculate the position.

macro_command main()

float angle = 0.00
//radius of the circle
float r = 290.00
float ux, uy
float x, y

GetData(angle, "Local HMI", LW, 15, 1)

//calc the position using COS and SIN


COS(angle, ux)
SIN(angle, uy)

//print the results of the calculation
SetData(ux, "Local HMI", LW, 18, 1)
SetData(uy, "Local HMI", LW, 19, 1)

//caluculate exact coordinates using the radius of the circle and the offset

x = r * ux + 960.00

y = r * uy + 540.00


//send the data to the HMI
SetData(x, "Local HMI", LW, 20, 1)
SetData(y, "Local HMI", LW, 21, 1)




end macro_command

Any insight you can provide on the bad Trigonometry outputs and the best way to get these values as integers for the window coordinate would be great.

Moments after posting this, it occurred to me that the floats take up two words. offsetting the words has fixed the bad data issue, :slight_smile:

I have looked at datatype conversion and the macros don’t seem to have a robust solution for converting from a float to an INT. Made even more difficult by the fact that the indirect window wants to use a single 16bit word vs the 32bit float. Any ideas on how to make this work is appreciated.

Hi @Cstarr,

To convert from a float to an int we usually recommend using the round() function like this:

macro_command main()
	float a = 2.67
	int b = 0
	
	b = ROUND(a)
	// b = 3
end macro_command
1 Like

I will also note that floor() can be used as well:

macro_command main()
     float x = 3.8
     int result

     result = FLOOR(x)
     // result = 3
end macro_command
1 Like