Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Geometry construction
Posted 2015年6月2日 GMT-4 10:14 Interfacing, LiveLink for MATLAB, Geometry, Modeling Tools & Definitions, Parameters, Variables, & Functions Version 4.4, Version 5.0 1 Reply
Please login with a confirmed email address before reporting spam
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.
1 Reply Last Post 2015年6月11日 GMT-4 13:16