Programmatically finding faces, edges, etc for an imported geometry

4 Ansichten (letzte 30 Tage)
Jasdeep
Jasdeep am 8 Mär. 2025
Beantwortet: Jack am 9 Mär. 2025
Is it possible to identify, based on location, faces of an imported geometry in the pde toolbox? Without looking at the plot visually.

Akzeptierte Antwort

Jack
Jack am 9 Mär. 2025
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.

Weitere Antworten (0)

Tags

Produkte


Version

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by