Quantcast
Channel: Latest Discussions - COMSOL Forums
Viewing all articles
Browse latest Browse all 2194

How to find entities of expelicit selection in the Work plane of a 3D model (API model)

$
0
0
Hi
I have created a geometry in the work plane of a 3D geometry (which is obviously in 2D mode at this stage).
and i have created explicit selection feature and set the selection object as well. when I try to read the entities associated to it, I get nothing. My code is working in the 2D model but for 3D model it is not working.

my code is :

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
import com.comsol.model.*
import com.comsol.model.util.*

model = ModelUtil.create('Model');

model.modelNode.create('comp1');

model.geom.create('geom1', 3);
model.geom('geom1').lengthUnit([native2unicode(hex2dec({'00' 'b5'}), 'unicode') 'm']);
model.geom('geom1').feature.create('wp1', 'WorkPlane');
model.geom('geom1').feature('wp1').geom.feature.create('r1', 'Rectangle');
model.geom('geom1').feature('wp1').geom.feature.create('r2', 'Rectangle');
model.geom('geom1').feature('wp1').geom.feature.create('r3', 'Rectangle');
model.geom('geom1').feature('wp1').geom.feature.create('r4', 'Rectangle');
model.geom('geom1').feature('wp1').geom.feature.create('r5', 'Rectangle');
model.geom('geom1').feature('wp1').geom.feature.create('dif1', 'Difference');
model.geom('geom1').feature('wp1').geom.feature.create('sel1', 'ExplicitSelection');
model.geom('geom1').feature('wp1').geom.feature('r1').set('size', {'110' '85'});
model.geom('geom1').feature('wp1').geom.feature('r1').set('pos', {'0' '0'});
model.geom('geom1').feature('wp1').geom.feature('r2').set('size', {'25' '25'});
model.geom('geom1').feature('wp1').geom.feature('r2').set('pos', {'95' '60'});
model.geom('geom1').feature('wp1').geom.feature('r3').set('size', {'15' '25'});
model.geom('geom1').feature('wp1').geom.feature('r3').set('pos', {'-5' '55'});
model.geom('geom1').feature('wp1').geom.feature('r4').set('size', {'50' '25'});
model.geom('geom1').feature('wp1').geom.feature('r4').set('pos', {'-10' '0'});
model.geom('geom1').feature('wp1').geom.feature('r5').set('size', {'50' '50'});
model.geom('geom1').feature('wp1').geom.feature('r5').set('pos', {'70' '-20'});
model.geom('geom1').feature('wp1').geom.feature('dif1').selection('input2').set({'r2' 'r3' 'r4' 'r5'});
model.geom('geom1').feature('wp1').geom.feature('dif1').selection('input').set({'r1'});
model.geom('geom1').feature('wp1').geom.feature('sel1').selection('selection').init;
model.geom('geom1').feature('wp1').geom.feature('sel1').selection('selection').set({'dif1'});
model.geom('geom1').run;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5



if i try to get the entities of "sel1" by :
model.geom('geom1').feature('wp1').geom.selection('sel1').entities(2)

it gives me empty output while the JAVA object contents the "dif1" object ... i really appropriate if you can help me to find a way to solve this problem?

PS. i am using Matlab live link

Viewing all articles
Browse latest Browse all 2194

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>