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.

Making 3D object (Re: solid3)

Please login with a confirmed email address before reporting spam

Can I make a 3D solid object with vertices or lines or faces making up the solid?

From checking the internet manuel, I found out that I should use the function 'solid3'
But I don't know how to handle that function.

In the manual, it is written:

<s3 = solid3(vtx,vtxpre,edg,edgpre,fac,mfdpre,mfd) creates 3D solid geometry object >

but there's no example so I cannot understand how I can input the parameters in the Matlab code

For the case of 2D surface (function name: face3) examples were shown so I can understand how to use,
but case of solid3, I cannot know how to use it.

Please let me know how to handle this problem.
Thanks,

11 Replies Last Post 7 lug 2010, 09:59 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 9 set 2009, 22:21 GMT-4
Hi Chan,
If I well understand, you would like to create a 3D solid model starting from a like .stl format (you have vertices and faces which connect them). If so, you can try by first creating the 3D faces (by using "face3") and then using the function "geomcoerce('solid',geomObj)" to merge all faces and to get out the solid geometry in comsol.
Try, and let me know how it works.

Have a look to this pseudo-cose:

%%
for I=1:nFace %% number of faces...
Vertex=[X,Y,Z];

f=face3(Vertex(1),Vertex(2),Vertex(3)); %- creating 3d face
faceObj{i}=f;
end

%-then...
geomSolid=geomcoerce('solid',faceObj); %%% calculate the solid object...
%%

Keep mind that to obtain a solid object the input "vertex+faces" have to embed a closed domain.

Good luck

Pasquale
Hi Chan, If I well understand, you would like to create a 3D solid model starting from a like .stl format (you have vertices and faces which connect them). If so, you can try by first creating the 3D faces (by using "face3") and then using the function "geomcoerce('solid',geomObj)" to merge all faces and to get out the solid geometry in comsol. Try, and let me know how it works. Have a look to this pseudo-cose: %% for I=1:nFace %% number of faces... Vertex=[X,Y,Z]; f=face3(Vertex(1),Vertex(2),Vertex(3)); %- creating 3d face faceObj{i}=f; end %-then... geomSolid=geomcoerce('solid',faceObj); %%% calculate the solid object... %% Keep mind that to obtain a solid object the input "vertex+faces" have to embed a closed domain. Good luck Pasquale

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 10 set 2009, 13:21 GMT-4
Thank you very much for your reply.

Actually, I had made a group of 3D surfaces using face3, exactly as you told me.
So, what I am trying to do is to make 3D solid object which contains the composite surface as a face.
For that purpose, I tried 3 methods but all in vain, because of the shortage of knowledge.

1) make 3D surface directily using the face or vertices that I have as you told me.
2) make a dummy solid object and split it by the composite surface
3) use extrusion

3) seemed impossible because the surface is not confined to 2D plane.
Regarding 2), I totally have no idea about how to do in COMSOL.
About 1), I am glad if I can following up your comments.
Excuse me for not understanding your comments thoroughly.

Can you give me an example for your syntax for 'geomcoerce'?

So far, I have believed that 'geomcoerce' cannot transform the 'dimension' of object.
But according to your current comments, it seems possible.

Also, if either of option 2), 3) is possible, can you let me know?

I really appreciate your kind attention and be hoping to get your reply again.
Thanks,
Thank you very much for your reply. Actually, I had made a group of 3D surfaces using face3, exactly as you told me. So, what I am trying to do is to make 3D solid object which contains the composite surface as a face. For that purpose, I tried 3 methods but all in vain, because of the shortage of knowledge. 1) make 3D surface directily using the face or vertices that I have as you told me. 2) make a dummy solid object and split it by the composite surface 3) use extrusion 3) seemed impossible because the surface is not confined to 2D plane. Regarding 2), I totally have no idea about how to do in COMSOL. About 1), I am glad if I can following up your comments. Excuse me for not understanding your comments thoroughly. Can you give me an example for your syntax for 'geomcoerce'? So far, I have believed that 'geomcoerce' cannot transform the 'dimension' of object. But according to your current comments, it seems possible. Also, if either of option 2), 3) is possible, can you let me know? I really appreciate your kind attention and be hoping to get your reply again. Thanks,

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 10 set 2009, 14:28 GMT-4
Hi Chan,

here's a simple matlab code:

function solidObj=create3DDomain(Vertex,Face)

%% INPUT:
% Vertex: vertices matrix.
% Face: faces matrix

%% OUTPUT:
% solidObj: comsol Solid Obj.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% written by Pasquale Franciosa, MIT, Boston, Sept. 10, 2009.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Example:
% Face=[1 2 3 4;
% 5 6 7 8
% 3 4 8 7
% 1 2 6 5
% 2 6 7 3
% 1 4 8 5];
%
% Vertex=[0 0 0
% 100 0 0
% 100 100 0
% 0 100 0
% 0 0 100
% 100 0 100
% 100 100 100
% 0 100 100];

% solidObj=create3DDomain(Vertex,Face);
% geomplot(solidObj)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nFace=size(Face,1);

fObj=cell(1,nFace);
for I=1:nFace
f=Face(I,:);
localVertex=Vertex(f,:);

X=[localVertex(1,1),localVertex(2,1);localVertex(4,1),localVertex(3,1)];
Y=[localVertex(1,2),localVertex(2,2);localVertex(4,2),localVertex(3,2)];
Z=[localVertex(1,3),localVertex(2,3);localVertex(4,3),localVertex(3,3)];

fObj{I}=face3(X,Y,Z); %%% X, Y, Z control the degree of the rational bezier patch... (see comsol help for info)...

end

solidObj=geomcoerce('solid',fObj); %%% create the solid object...


try to use it and let me know.

Regards

Pasquale
Hi Chan, here's a simple matlab code: function solidObj=create3DDomain(Vertex,Face) %% INPUT: % Vertex: vertices matrix. % Face: faces matrix %% OUTPUT: % solidObj: comsol Solid Obj. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% written by Pasquale Franciosa, MIT, Boston, Sept. 10, 2009. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Example: % Face=[1 2 3 4; % 5 6 7 8 % 3 4 8 7 % 1 2 6 5 % 2 6 7 3 % 1 4 8 5]; % % Vertex=[0 0 0 % 100 0 0 % 100 100 0 % 0 100 0 % 0 0 100 % 100 0 100 % 100 100 100 % 0 100 100]; % solidObj=create3DDomain(Vertex,Face); % geomplot(solidObj) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% nFace=size(Face,1); fObj=cell(1,nFace); for I=1:nFace f=Face(I,:); localVertex=Vertex(f,:); X=[localVertex(1,1),localVertex(2,1);localVertex(4,1),localVertex(3,1)]; Y=[localVertex(1,2),localVertex(2,2);localVertex(4,2),localVertex(3,2)]; Z=[localVertex(1,3),localVertex(2,3);localVertex(4,3),localVertex(3,3)]; fObj{I}=face3(X,Y,Z); %%% X, Y, Z control the degree of the rational bezier patch... (see comsol help for info)... end solidObj=geomcoerce('solid',fObj); %%% create the solid object... try to use it and let me know. Regards Pasquale

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 11 set 2009, 16:32 GMT-4

Thank you very much.

I succeeded in making the geometry you gave me as a sample.

But I failed in making arbitrary geometry that I wanted to make.

As a sample, I tried to make a tetrahedron using four faces defining that solid
, no error message. but only void space emerged.

Also, I could not make the geometry I tried to make,

Let me try myself more and contact you again.

Thank you again.

Thank you very much. I succeeded in making the geometry you gave me as a sample. But I failed in making arbitrary geometry that I wanted to make. As a sample, I tried to make a tetrahedron using four faces defining that solid , no error message. but only void space emerged. Also, I could not make the geometry I tried to make, Let me try myself more and contact you again. Thank you again.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 12 set 2009, 20:26 GMT-4

Eventually, I succeeded in making the geometry that I intended to make.

It is a group of solids that has 3D surface, and the group consists of about 1000 solids components.

So, the running is extremely slow and unstable, uniting the solid components and some other geometrical operations, and making mesh is impossible.

So, I am thinking of other methods.

Thank you very much for your help.

Sincerely,
Eventually, I succeeded in making the geometry that I intended to make. It is a group of solids that has 3D surface, and the group consists of about 1000 solids components. So, the running is extremely slow and unstable, uniting the solid components and some other geometrical operations, and making mesh is impossible. So, I am thinking of other methods. Thank you very much for your help. Sincerely,

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 12 set 2009, 21:45 GMT-4
Hi Chan
I hope you can solve your problem.
If you have any news about your solution, please let me know.

Good luck

Pasquale
Hi Chan I hope you can solve your problem. If you have any news about your solution, please let me know. Good luck Pasquale

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 23 feb 2010, 03:53 GMT-5
hello

I have the same probleme.
Did you find a solution ?

thanks

Marie
hello I have the same probleme. Did you find a solution ? thanks Marie

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 7 lug 2010, 08:11 GMT-4
Hi Pasquale,

thanks for your example, looks very useful to me as well. but where do you find create3DDomain? It's not in COMSOL or Matlab, is it? google doesn't find it ..

Best regards and thanks in advance,
Susanne
Hi Pasquale, thanks for your example, looks very useful to me as well. but where do you find create3DDomain? It's not in COMSOL or Matlab, is it? google doesn't find it .. Best regards and thanks in advance, Susanne

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 7 lug 2010, 09:13 GMT-4
sorry, just disregard previous message - grabbing a coffee NOW ..


Hi Pasquale,

thanks for your example, looks very useful to me as well. but where do you find create3DDomain? It's not in COMSOL or Matlab, is it? google doesn't find it ..

Best regards and thanks in advance,
Susanne


sorry, just disregard previous message - grabbing a coffee NOW .. [QUOTE] Hi Pasquale, thanks for your example, looks very useful to me as well. but where do you find create3DDomain? It's not in COMSOL or Matlab, is it? google doesn't find it .. Best regards and thanks in advance, Susanne [/QUOTE]

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 7 lug 2010, 09:38 GMT-4
Hi all,
actually, after half an hour trying with the code (me being new to Matlab AND COMSOL), I figured that the example code, in order to run, should read in the first line

function fObj=create3DDomain(Vertex,Face)

NOT

function solidObj=create3DDomain(Vertex,Face)

Cheers,
Susanne

Hi all, actually, after half an hour trying with the code (me being new to Matlab AND COMSOL), I figured that the example code, in order to run, should read in the first line function fObj=create3DDomain(Vertex,Face) NOT function solidObj=create3DDomain(Vertex,Face) Cheers, Susanne

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 7 lug 2010, 09:59 GMT-4
and that was wrong again - sorry guys, I will just shut up now



Hi all,
actually, after half an hour trying with the code (me being new to Matlab AND COMSOL), I figured that the example code, in order to run, should read in the first line

function fObj=create3DDomain(Vertex,Face)

NOT

function solidObj=create3DDomain(Vertex,Face)

Cheers,
Susanne


and that was wrong again - sorry guys, I will just shut up now [QUOTE] Hi all, actually, after half an hour trying with the code (me being new to Matlab AND COMSOL), I figured that the example code, in order to run, should read in the first line function fObj=create3DDomain(Vertex,Face) NOT function solidObj=create3DDomain(Vertex,Face) Cheers, Susanne [/QUOTE]

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.