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.

LiveLink for Matlab: access the edge of a Bezier curve

Please login with a confirmed email address before reporting spam

Hi everyone,

I'm trying to access a Bezier curve as an 'edge' in LiveLink for Matlab, but I cannot figure out how to do it. I want to create a sweep of a rectangle, following a Bezier curve 'b1'.
Here are some code and explanations:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% creation of Bezier curve 'b1'
model.geom('geom1').feature('wp3').geom.create('b1', 'BezierPolygon');
model.geom('geom1').feature('wp3').geom.feature('b1').set('p', {['-0.01295' '-0.01295';'0' '0.00466']});
model.geom('geom1').feature('wp3').geom.feature('b1').set('w', {'1' '1'});
model.geom('geom1').feature('wp3').geom.feature('b1').set('degree', {'1'});

% providing I have a face named 'r1', creation of a sweep of 'r1' following 'b1'
model.geom('geom1').create('swe1', 'Sweep');
model.geom('geom1').feature('swe1').label('Sweep 1');
model.geom('geom1').feature('swe1').set('crossfaces', true);
model.geom('geom1').feature('swe1').set('includefinal', false);
model.geom('geom1').feature('swe1').selection('face').set('wp2.r1', 1);
model.geom('geom1').feature('swe1').selection('edge').set( ??? );
model.geom('geom1').feature('swe1').selection('diredge').set( ??? );
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Now, what should I write instead of the '???' to have my sweep follow the curve 'b1' ?

Thanks in advance for your replies :-)

1 Reply Last Post Nov 3, 2016, 8:30 a.m. EDT
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago Nov 3, 2016, 8:30 a.m. EDT
Hi Julien

The easiest way to figure out how to name things or call certain methods in the Comsol API is to set up the model in Comsol Multiphysics and export the model as an M-file using File->Save As.

I'm attaching a working example.

In order to learn about how geometry entities (objects) are named in Comsol you can consult the Comsol Programming Reference Manual and look in the section titled "Accessing Geometry Object Names" which includes a section on "Naming Of Geometry Objects".

If you need more information about the geometry such as boundary and edge numbers you should look for functions in the section titled: "Geometry Object Information".


--
Lars Gregersen
Comsol Denmark
Hi Julien The easiest way to figure out how to name things or call certain methods in the Comsol API is to set up the model in Comsol Multiphysics and export the model as an M-file using File->Save As. I'm attaching a working example. In order to learn about how geometry entities (objects) are named in Comsol you can consult the Comsol Programming Reference Manual and look in the section titled "Accessing Geometry Object Names" which includes a section on "Naming Of Geometry Objects". If you need more information about the geometry such as boundary and edge numbers you should look for functions in the section titled: "Geometry Object Information". -- Lars Gregersen Comsol Denmark

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.