Stl file pdegplot in App designer

3 次查看(过去 30 天)
Hi,
I am looking for a solution to find names of the faces after importing the stl file. pdegplot command does that but how can I use it in App Designer. I am trying the command but it throws different error. Looked for a solution but it isn't available.
Is there any other command where i can use it to see name faces in the App designer so that i can use it to apply BC.
Thanks,
Jigar

采纳的回答

Adam Danz
Adam Danz 2024-5-17
编辑:Adam Danz 2024-5-17
> pdegplot command does that but how can I use it in App Designer?
pdegplot does not have an input argument or property to specify the parent axes. This often poses a propblem in AppDesigner and uifigures in general since the default HandleVisible property in uifigures is 'off'. This prevents pdegplot from finding the axes within the uifigure resulting in the generation of a new figure external to the app.
I suppose this is the problem you're running into.
This workaround describes how to temporarily make the app's axes accessible and current so that the pdegplot will add content to the existing axes.
Here's a quick example. See the previous link for details.
% Mimick an app
app.UIFigure = uifigure();
app.UIAxes = uiaxes(app.UIFigure);
% Change handle visibility
origState = app.UIFigure.HandleVisibility;
handleVisCleanup = onCleanup(@()set(app.UIFigure,'HandleVisibility',origState));
app.UIFigure.HandleVisibility = 'on';
% Make axes current
set(groot, 'CurrentFigure', app.UIFigure)
set(app.UIFigure,'CurrentAxes',app.UIAxes)
% Plot pdegplot
g = [2 1 1 1 1 1 1 1 1 4 4;
-1 -0.6 -0.5 -0.4 -0.5 0.4 0.5 0.6 0.5 -1 0.17;
1 -0.5 -0.4 -0.5 -0.6 0.5 0.6 0.5 0.4 0.17 1;
0 -0.25 -0.35 -0.25 -0.15 -0.25 -0.35 -0.25 -0.15 0 -0.74;
0 -0.35 -0.25 -0.15 -0.25 -0.35 -0.25 -0.15 -0.25 -0.74 0;
0 0 0 0 0 0 0 0 0 1 1;
1 1 1 1 1 1 1 1 1 0 0;
0 -0.5 -0.5 -0.5 -0.5 0.5 0.5 0.5 0.5 0 0;
0 -0.25 -0.25 -0.25 -0.25 -0.25 -0.25 -0.25 -0.25 0 0;
0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 1 1;
0 0 0 0 0 0 0 0 0 0.75 0.75;
0 0 0 0 0 0 0 0 0 0 0];
pdegplot(g)
  10 个评论
Jigar
Jigar 2024-5-19
编辑:Jigar 2024-5-19
editing
I take my words back. It is working with an app property. Thanks for all the help!
Adam Danz
Adam Danz 2024-5-20
Glad that it all worked out, thanks for the demo @Cris LaPierre!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by