Programmatically finding faces, edges, etc for an imported geometry
11 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Jack
2025-3-9
Hey Jasdeep,
Yes, you can programmatically find faces, edges, and vertices of an imported geometry in the PDE Toolbox using the findFaces and findEdges functions along with geometric queries.
Finding Faces Based on Location
If your geometry is stored in model.Geometry, you can use findFaces to locate faces that contain a specific point:
model = createpde();
importGeometry(model, 'your_geometry.stl'); % Import your file
% Example: Find face containing a point (x, y, z)
queryPoint = [1, 2, 3]; % Modify as needed
faceID = findFaces(model.Geometry, 'Point', queryPoint);
disp(['Face ID at location: ', num2str(faceID)]);
Finding Edges Based on Location
To get edges near a specific location, use findEdges:
edgeID = findEdges(model.Geometry, 'NearestPoint', queryPoint);
disp(['Edge ID near location: ', num2str(edgeID)]);
Finding Face IDs Without Visual Inspection
If you need to check all faces and their approximate locations:
numFaces = model.Geometry.NumFaces;
for i = 1:numFaces
disp(['Face ', num2str(i), ' centroid: ', num2str(centroid(model.Geometry, i))]);
end
This should let you programmatically identify faces and edges without manually checking the plot.
Follow me so you can message me anytime with future MATLAB questions. If this helps, please accept the answer as well.
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!