Quantcast
Channel: Latest Discussions - COMSOL Forums
Viewing all articles
Browse latest Browse all 428

LiveLink geometry layout design

$
0
0
Hi,

I am using Matlab LiveLink and am trying to create a layout for optical reflectors. My Problem is the following: I am looking at about 2000 reflectors and want them to form a union so I don't have to click on every single one and set their properties seperatly every time I generate a new layout.
I have prepared a Codefragment that demonstrates my Problem:

import com.comsol.model.*;
import com.comsol.model.util.*;

model = ModelUtil.create('Model');
geom1 = model.geom.create('geom1',3);

wp1 = geom1.feature.create('wp1','WorkPlane');
wp1.set('planetype','quick');
wp1.set('quickplane','xy');

refl_union = wp1.geom.feature.create('refl_union', 'Union');

for i=1:10

refl_geom_name{i} = wp1.geom.feature.create(['r' num2str(i)], 'BezierPolygon');
refl_geom_name{i}.set('type', 'closed');
refl_geom_name{i}.set('p', [i i+0.5 i+0.5 i ; 0 0 2 2]);
wp1.geom.feature.create(['refl_csol' num2str(i)],'ConvertToSolid');
wp1.geom.feature(['refl_csol' num2str(i)]).selection('input').set(['r' num2str(i)]);

refl_union.selection('input').object('geom1');
refl_union.selection('input').set(['refl_csol' num2str(i)]);

end

ext1 = geom1.feature.create('ext1','Extrude');
ext1.selection('input').set({'wp1'});
ext1.set('distance',5);

geom1.run;
mphgeom(model,'geom1');

My Intention was to create one geometrical Object (refl_union) and one by one add the objects to it during each itteration of the for loop. However this does not seem to work. The Code works fine till I try to form a Union, what am I missing?

Thanks
Mark

Viewing all articles
Browse latest Browse all 428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>