Returns the first XProperty by the given name to be found in the passed entity. Null if none is found.
Syntax
Parameters
Return Value
The first XProperty found or null.
Example
Here is an example where we search in mousedown event for a specific XProperty of an entity and if we find it we change it’s value,if not we add a new one.
C# | Copy Code |
---|
function _vdmousedown(e) { var entity = e.target.GetEntityFromPoint(e.xPix, e.yPix); if (entity.XProperties === undefined) {// in case there are not any XProperties we add the new that I want var newExProp = vdcanvas.AddXProperty(entity, 'name1', 5.0); } else { for (var i = 0; i < entity.XProperties.Items.length; i++) {//search for the XProperty we want by it’s name if (entity.XProperties.Items[i].Name == "name1") { var xprop = vdcanvas.GetXProperty(entity, "name1");//If we find the XProperty name that we search for, we change its value xprop.PropValue = 'newValue'; } else { if (newExProp) return; var newExProp = vdcanvas.AddXProperty(entity, 'name1', 5.0); // if we didn’t find the Xproperty that we were searching for in the XProperties of the entity,we add a new one } } } } |
See Also