a) Coordinates: the position information is stored in the "Position" attribute, a default attribute by the platform. You can add this attribute to the ATTRREP to see how the values change when you move an object. In order to retrieve and set the coordinates, you can use the following script as an example. This sample would move a set of elements 1 cm to the right.
Please consider in the script that the following logic:
i) Position value is read using the default GET_ATTR_VAL function
ii) The position String is a LEO String and parsed accordingly.
iii) The values to be used in SET_OBJ_POS are measurement values (actually CM) if you calculate thos differently, please convert to a measurement accordingly, using "CM" to transform a real to a centimeter value.
Alternatively to iii) you can also construct the position string in the script and set it using SET_ATTR_VAL. This should be used if you do not have a model window yet but modify in the CORE only.
1CC "Modeling" GET_SELECTED
2FOR objid in: (objids) {
3 CC "Core" GET_CLASS_ID objid: (VAL objid)
4 IF (NOT isrel) {
5 # get position
6 CC "Core" GET_ATTR_ID classid: (classid) attrname:"Position"
7 CC "Core" GET_ATTR_VAL objid: (VAL objid) attrid: (attrid)
8 LEO parse: (val) get-tmm-value:x:"x" get-tmm-value:y:"y"
9 # increment x coordinate and set new position
10 SET x: (x + 1cm)
11 CC "Modeling" SET_OBJ_POS objid: (VAL objid) x: (x) y: (y)
12 }
13}
b) Deleting prevention: My proposal here would be to implement a logic that defines the "Erasable" according to the logic you have in mind. You can simple set the value of the attribute in your script, constructing the model based on the user input. This would leave the events intact and generic and you cover your interaction logic in the script you currently produce.
Another approach could be to cover the logic when an object can be deleted in an EXPRESSION attribute to calculate the value dynamically based on the model setup.
Alternatively, please have a look at the events that prevent the deletion as provided yesterday, and modify the non-delete logic there.