model.variable()

model.variable()

model.variable()
ایجاد، تعریف و حذف متغیرها.
نحو
model.variable().create( <tag> );
model.variable( <tag> ).set( <var> , <expr> );
model.variable( <tag> ).set( <var> , <expr> , <descr> );
model.variable( <tag> ).descr( <var> , <descr> );
model.variable( <tag> ).remove( <var> );
model.variable( <tag> ).clear();
model.variable( <tag> ).model( <mtag> );
model.variable( <tag> ).varnames();
model.variable( <tag> ).get( <var> );
model.variable( <tag> ).descr( <var> );
model.variable( <tag> ).model();
model.variable( <tag> ).scope();
model.variable( <tag> ).loadFile(tempFile, …);
model.variable( <tag> ).saveFile(tempFile, …);
 
برای متغیرهای سطح مؤلفه، از model.component( <ctag> ).variable().create( <tag> ) و غیره، به جای نحو بالا برای متغیرهای سراسری استفاده کنید.
شرح
 model.variable( <tag> ) یک مجموعه متغیر را برمی گرداند. هر مجموعه متغیر می تواند شامل چندین متغیر باشد، اما فقط یک انتخاب.
 model.variable() .create( <tag> ) یک گره متغیر با تگ <tag> ایجاد می کند .
model.variable( <tag> ).set( <var> <expr> ) متغیر <var> را با عبارت <expr> تعریف می کند .
model.variable( <tag> ).set( <var> <expr> <descr> ) یک متغیر را تعریف می کند و به آن توضیحاتی می دهد.
model.variable( <tag> ).descr( <var> <descr> ) توضیحاتی را برای متغیر <var> تعریف می کند .
model.variable( <tag> ) .model( <mtag> ) گره جزء مدل را تنظیم می کند.
model.variable( <tag> ).selection().named( <seltag> ) گره متغیر را به انتخاب نامگذاری شده <seltag> اختصاص می دهد .
model.shape( <tag> ).selection().set(…) یک انتخاب محلی را تعریف می کند که مجموعه متغیر را به موجودیت های هندسی اختصاص می دهد. قبل از اختصاص دادن یک انتخاب، مدل متغیر باید با استفاده از model.variable( <tag> ).model( <mtag> ) تنظیم شود . فقط از انتخاب سراسری و انتخاب های هندسی در مدل می توان استفاده کرد. برای فهرست کاملی از روش‌های موجود در انتخاب () ، به انتخاب‌ها مراجعه کنید .
model.variable( <tag> ).remove( <var> ) یک متغیر را از مجموعه متغیرها حذف می کند. model.variable( <tag> ).clear() همه متغیرها را از مجموعه متغیرها حذف می کند.
model.variable( <tag> ).varnames() نام تمام عبارات را به عنوان یک آرایه رشته ای برمی گرداند.
model.variable( <tag> ).get( <var> ) مقدار متغیر را به صورت رشته برمی گرداند.
model.variable( <tag> ).descr( <var> ) توضیحات متغیر را به صورت رشته ای برمی گرداند.
model.variable ( <tag> ) .model() تگ گره جزء مدل را برمی گرداند.
model.variable ( <tag> ) .scope() نام دامنه کاملا واجد شرایط را برمی گرداند.
model.variable( <tag> ).selection().named() تگ انتخاب را به صورت رشته برمی گرداند.
model.variable( <tag> .selection(.get Type () اطلاعات دامنه را برمی گرداند. برای روش های موجود، model.selection() را ببینید .
برای model.param().loadFile() و model.param().saveFile() ، به روش های loadFile و saveFile مراجعه کنید .
مثال ها
عبارت e را در دامنه های 1 و 2 به صورت x+1 و در دامنه 3 به صورت x-1 تعریف کنید.
کد برای استفاده با جاوا
Model model = ModelUtil.create(“Model”);
model.component().create(“comp1”);
model.component(“comp1”).geom().create(“geom1”,3);
model.component(“comp1”).geom(“geom1”).create(“blk1″، “Block”);
model.component(“comp1”).geom(“geom1”).run();
model.component(“comp1”).variable().create(“e1”).set(“e”,”x+1″);
model.component(“comp1”).variable(“e1”).selection().geom(“geom1”,2);
model.component(“comp1”).variable(“e1”).selection().set(new int[]{1,2});
model.component(“comp1”).variable().create(“e2”).set(“e”,”x-1″);
model.component(“comp1”).variable(“e2”).selection().geom(“geom1”,2);
model.component(“comp1”).variable(“e2”).selection().set(3);
کد برای استفاده با متلب
model = ModelUtil.create(‘Model’);
model.component.create(‘comp1’);
model.component.geom.create(‘geom1’,3);
model.component.geom(‘geom1’).create(‘blk1’, ‘Block’);
model.component.geom(‘geom1’).run;
model.component.variable.create(‘e1’).set(‘e’,’x+1′);
model.component.variable(‘e1’).selection.geom(‘geom1’,2);
model.component.variable(‘e1’).selection.set([1,2]);
model.component.variable.create(‘e2’).set(‘e’,’x-1′);
model.component.variable(‘e2’).model(‘mod1’);
model.component.variable(‘e2’).selection().geom(‘geom1’,2);
model.component.variable(‘e2’).selection().set(3);
همچنین ببینید
model.selection()