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.

Boolean Operation Difference using Selection

Please login with a confirmed email address before reporting spam

I have trouble with the difference operation in Comsol. My geometry is based upon a matlab code where the amount of cylinders can change. I want to use a selection in the boolean operation, however I can only simply click all domains separately and cannot use the explicit selection that I created.
Also when I create a simple cell array containing all the strings of geometries that are needed in matlab the comsol syntax does not use a cell array, which is the type where strings are stored in matlab (are not stored in lists). Simply looping does not work either for the input because then only the last (cyl%n) is used as input for the difference.

model.geom('geom1').feature('dif1').selection('sel1').set({'sel1'}); #does not work
model.geom('geom1').feature('dif1').selection('sel1').set({a}); with a = {'cyl1' 'cyl2' 'cyl3'}; #does not work

for i = 1:length(n);
str = sprintf('cyl%d', i);
model.geom('geom1').feature('dif1').selection('sel1').set({str});
end
#only gives a difference with the last cylinder.

I hope someone can help me with this!
Thank you in advance

0 Replies Last Post Oct 12, 2016, 1:36 p.m. EDT
COMSOL Moderator

Hello Maria Hagelaars

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

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.