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.
how do I get properties, delete a feature, and determine if a feature exists
Posted Jun 14, 2012, 4:25 p.m. EDT 1 Reply
Please login with a confirmed email address before reporting spam
I am new to the livelink with Matlab but familiar with Matlab itself. After running the code labeled below as "CODE USED" I want to know...
1. If I want to clear the 'b1' feature, how do I do this?
I've tried the clear command:
clear model.geom('geom1').feature('b1')
I get no error, but the node is still present.
2. How do I get the bezier curve points defined under property 'p'? I tried using the command:
model.geom('geom1').feature('b1').get('p')
And I get the error
Error using get
Ambiguous property found.
Object Name : com.comsol.model.impl.GeomFeatureImpl
Property Name : 'p'
3. How do I determine if a feature already exists?
For example, if I try exists(model.geom('geom1')) I get a true value. But the function seems undefined for the feature.
Thanks!
==== CODE USED =====
import com.comsol.model.*
import com.comsol.model.util.*
model = ModelUtil.create('Model');
model.modelNode.create('mod1');
model.geom.create('geom1', 2);
model.geom('geom1').lengthUnit('mm');
model.geom('geom1').feature.create('b1', 'BezierPolygon');
model.geom('geom1').feature('b1').set('w', {'1' '1' '1' '1/sqrt(2)' '1' '1' '1' '1' '1' '1' '1'});
model.geom('geom1').feature('b1').set('p', {'0' '.9' '1' '1' '1' '0' '0'; '0' '0' '0' '.1' '1' '1' '0'});
1. If I want to clear the 'b1' feature, how do I do this?
I've tried the clear command:
clear model.geom('geom1').feature('b1')
I get no error, but the node is still present.
2. How do I get the bezier curve points defined under property 'p'? I tried using the command:
model.geom('geom1').feature('b1').get('p')
And I get the error
Error using get
Ambiguous property found.
Object Name : com.comsol.model.impl.GeomFeatureImpl
Property Name : 'p'
3. How do I determine if a feature already exists?
For example, if I try exists(model.geom('geom1')) I get a true value. But the function seems undefined for the feature.
Thanks!
==== CODE USED =====
import com.comsol.model.*
import com.comsol.model.util.*
model = ModelUtil.create('Model');
model.modelNode.create('mod1');
model.geom.create('geom1', 2);
model.geom('geom1').lengthUnit('mm');
model.geom('geom1').feature.create('b1', 'BezierPolygon');
model.geom('geom1').feature('b1').set('w', {'1' '1' '1' '1/sqrt(2)' '1' '1' '1' '1' '1' '1' '1'});
model.geom('geom1').feature('b1').set('p', {'0' '.9' '1' '1' '1' '0' '0'; '0' '0' '0' '.1' '1' '1' '0'});
1 Reply Last Post Jun 15, 2012, 4:01 a.m. EDT