Importing Solidworks 2D Geometry into MATLAB
조회 수: 17 (최근 30일)
이전 댓글 표시
Hello, I'm quite new to MATLAB but I was wondering, how can I import 2D Geometry coordinates from Solidworks into MATLAB? The ultimate goal would to get these geometry coordinates (specifically the distance from the origin to the Y coordinate of the contour, which the geometry is half of a rocket engine contour), to get the datapoints of the ratio of Area/Area of the throat along the entire contour.
Hopefully that makes sense,
Thank you for any help
댓글 수: 3
답변 (2개)
Avni Agrawal
2023년 10월 9일
편집: Avni Agrawal
2023년 10월 9일
Hi,
I understand that you want to import 2D geometry coordinates from Solidworks, specifically an STL file, into MATLAB. You can achieve this by using the "importGeometry" function in MATLAB's PDE Toolbox. You can find more information about this function in the MATLAB documentation here: https://in.mathworks.com/help/pde/ug/pde.pdemodel.importgeometry.html#bulkov_-4
Here's an example of how you can import geometry using the "importGeometry" function in MATLAB's PDE Toolbox:
% Create a PDE model
model = createpde();
% Import the geometry using the importGeometry function
importGeometry(model, 'rocket.stl');
% Plot the imported geometry
pdegplot(model, 'FaceLabels', 'on', 'FaceAlpha', 0.5);
% Further processing or analysis of the imported geometry can be done here
% Display a message to indicate successful geometry import
disp('Geometry imported successfully.');
To extract the coordinates from the STL file and import them into MATLAB, you can use the "stlread" function. Here is an example that demonstrates how to do this:
% Import the STL file using the stlread function
[vertices, faces] = stlread('rocket.stl');
% Extract the coordinates from the vertices
x = vertices(:, 1);
y = vertices(:, 2);
z = vertices(:, 3);
% Process the coordinates as needed
% (e.g., calculate distances, ratios, etc.)
% Your further MATLAB code goes here
% Display a message to indicate completion
disp('Coordinates imported successfully.');
I hope this explanation helps you with importing the 2D geometry coordinates from Solidworks into MATLAB.
댓글 수: 4
Mario Malic
2023년 10월 15일
What is the that curve you are trying to obtain the points from - arc, spline?
Mario Malic
2023년 10월 15일
Here is a SolidWorks macro, you have to select the edge and run the macro. Hopefully it works, otherwise you need to tell me what kind of curve is used to draw the edge.
댓글 수: 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!