geometryFromMesh importing an assembly STL into MatLab
4 次查看(过去 30 天)
显示 更早的评论
I'm trying to take a CAD assembly and import it into my MATLAB code to run a vibrational analysis on an assembly, the code currently works for single parts only. I am having trouble connecting the different parts together as one assembly that is made up of different materials. The connections between all of the different parts are going to be fixed but when testing only the part that is fixed is affected.
First, the CAD is exported as a .STL ( ASCII, high resolution, one file). Then I am using the function rndread from MATLAB File exchange to get the nodes of each individual triangle. Then I find the unique nodes from that list to create a connection matrix that is size 3XN, where N is the number of connections needed. The code below is intended to be run as a function whose sole purpose is to create the geometry from the Cad file.
%function [mesh]=Elementimport(model,txt_file)
%% non function
clear,clc
model = createpde('structural','modal-solid');
tic
datapath=uigetdir([],'Select Data Directory');
d=dir(fullfile(datapath,'*.stl'));
txt_file = fullfile(datapath,d.name);
%}
%% function
[~, vout, ~] = rndread(txt_file);
[V,a,b]=unique(round(vout,2),'rows','stable');
y=numel(vout(:,1))/3;
V=V';
connec=reshape(b,[3,y]);
mesh=geometryFromMesh(model,V,connec);
pdegplot(model,'CellLabels','on')
%end
The code above always returns "The input mesh does not form a closed volume. This may be due to missing faces or gaps in the input." I have tried hard coding a problem into MATLAB but every time I add an interior face to separate the parts (cells) it returns the error above and when the interior face is not included then the 2 parts can not be put into different cells, they cannot have different material properties. I know interior faces should be possible because they are shown to be in the MultidomainMesh3D example.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geometry and Mesh 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!