Hi!
I'm trying to solve a geometry problem for my model using Matlab Livelink Comsol.
There is a "loop" using "for" to create multiples lines (BezierPolygon), but the program returns
just the last line I have created. Here is the code inside the loop:
model.param.set('a',j);
model.param.set('b',iv);
model.geom('geom1').feature.create(model.param().descr('nome'), 'BezierPolygon');
model.geom('geom1').feature(model.param().descr('nome')).set('p', {'(a-1)*0.001' '(a-1)*0.001'; 'b*0.001' '(b-1)*0.001'});
I suppose that the program is creating just the last line because all lines are define by 'a' and 'b'. So,
'a' and 'b' are changing according to j' and 'iv' (variables from matlab) in each single loop and, in the finalized geometry, all lines will have the same values for the coordinates.
So, my question is: there is a way to creating lines with evaluated coordinates? I mean making Comsol
understands that this line of code:
model.geom('geom1').feature(model.param().descr('nome')).set('p', {'(a-1)*0.001' '(a-1)*0.001'; 'b*0.001' '(b-1)*0.001'});
Should be read, for example making a = 2 and b = 2:
model.geom('geom1').feature(model.param().descr('nome')).set('p', {'(2-1)*0.001' '(2-1)*0.001'; '2*0.001' '(2-1)*0.001'});
Best regards, Flavi.
I'm trying to solve a geometry problem for my model using Matlab Livelink Comsol.
There is a "loop" using "for" to create multiples lines (BezierPolygon), but the program returns
just the last line I have created. Here is the code inside the loop:
model.param.set('a',j);
model.param.set('b',iv);
model.geom('geom1').feature.create(model.param().descr('nome'), 'BezierPolygon');
model.geom('geom1').feature(model.param().descr('nome')).set('p', {'(a-1)*0.001' '(a-1)*0.001'; 'b*0.001' '(b-1)*0.001'});
I suppose that the program is creating just the last line because all lines are define by 'a' and 'b'. So,
'a' and 'b' are changing according to j' and 'iv' (variables from matlab) in each single loop and, in the finalized geometry, all lines will have the same values for the coordinates.
So, my question is: there is a way to creating lines with evaluated coordinates? I mean making Comsol
understands that this line of code:
model.geom('geom1').feature(model.param().descr('nome')).set('p', {'(a-1)*0.001' '(a-1)*0.001'; 'b*0.001' '(b-1)*0.001'});
Should be read, for example making a = 2 and b = 2:
model.geom('geom1').feature(model.param().descr('nome')).set('p', {'(2-1)*0.001' '(2-1)*0.001'; '2*0.001' '(2-1)*0.001'});
Best regards, Flavi.