UGNX⼆次开发-建模-属性操作
NXObject.SetUrAttribute()是⽤于设置NXObject对象的属性,包括了多种类型,如字符串属性、整型属性、实值属性等等。1aggedObject[] taggedObjects = _FaceSelect.GetSelectedObjects();
2Face face = (Face)taggedObjects[0];
3//根据属性信息添加属性
4NXObject.AttributeInformation attributeInformation = new NXObject.AttributeInformation();
5attributeInformation.Type = NXObject.AttributeType.String;
6attributeInformation.Title = "Attribute_Face_1";
7attributeInformation.StringValue = "Attribute_1_string";
8face.SetUrAttribute(attributeInformation,Update.Option.Now);
9
10//添加int属性
佩服
11string intTitle = "IntAttributeTitle";
12int intValue = 1;
13face.SetUrAttribute(intTitle,0,intValue,Update.Option.Now);
14
柬埔寨属于哪个国家
15//添加double属性
16string doubleTitle = "DoubleAttributeTitle";
17double doubleValue = 2.1;
18face.SetUrAttribute(doubleTitle,0,doubleValue,Update.Option.Now);
19
客服回访话术大全20//添加字符串属性
21string stringTitle = "StringAttributeTitle";
22string stringValue = "stringValue";
第一军规23face.SetUrAttribute(stringTitle,0,stringValue,Update.Option.Now);
添加完成后,在⾯属性中可以看到如下:
查看⼀个⾯的所有属性,⽤ NXObject.AttributeInformation[] attributeInformation1 = face.GetUrAttributes();
1NXObject.AttributeInformation[] attributeInformation1 = face.GetUrAttributes();
2UFUi theUFUi = theUFSession.Ui;
3theUFUi.OpenListingWindow();
4int i = 0;
5foreach(var ai in attributeInformation1)
6{
脚踏实地的素材
7if (ai.Type == NXObject.AttributeType.String)好玩单机游戏
8{
9theUFUi.WriteListingWindow(i++.ToString() + " " + ai.Title + " "+ai.StringValue+"\n");
10}
qq网名英文
11el if(ai.Type==NXObject.AttributeType.Integer)
12{
13theUFUi.WriteListingWindow(i++.ToString()+" "+ai.Title+" "+ai.IntegerValue.ToString()+" \n");
14}
15el if (ai.Type == NXObject.AttributeType.Real)
16{
乔治修拉17theUFUi.WriteListingWindow(i++.ToString() + " " + ai.Title + " " + ai.RealValue.ToString() + " \n");
18}
19}
删除属性,NXObject.Delete***()
1
2public void DeleteAllAttributesByType(AttributeType type);
3
4public void DeleteAllAttributesByType(AttributeType type, Update.Option option);
5
6public void DeleteAttributeByTypeAndTitle(AttributeType type, string title, Update.Option option);
7
8public void DeleteAttributeByTypeAndTitle(AttributeType type, string title);
9
10public void DeleteUrAttribute(AttributeType type, string title, bool deleteEntireArray, Update.Option option);
11
12public void DeleteUrAttributes(AttributeType type, Update.Option option);
13
14public void DeleteUrAttributes(AttributeIterator iterator, Update.Option option);