WPF 3D graphics redraw when data changes
up vote
0
down vote
favorite
I am rendering a 3D contour surface from data. I get new data every few seconds from real time monitoring and need to redraw using the new data. All of the examples I can find only show how render the 3D contour surface from fixed data.
I can't find an example of explanation of how to (clear, delete, erase) the mesh or model and redraw with new data.
Can anyone point me to an example or explain how to redraw the 3D contour surface with the new data.
wpf
New contributor
add a comment |
up vote
0
down vote
favorite
I am rendering a 3D contour surface from data. I get new data every few seconds from real time monitoring and need to redraw using the new data. All of the examples I can find only show how render the 3D contour surface from fixed data.
I can't find an example of explanation of how to (clear, delete, erase) the mesh or model and redraw with new data.
Can anyone point me to an example or explain how to redraw the 3D contour surface with the new data.
wpf
New contributor
If you know how to calculate your mesh, just use MVVM and bind your data to theMeshGeometry3D
. Take a look.
– jsanalytics
Nov 11 at 15:45
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am rendering a 3D contour surface from data. I get new data every few seconds from real time monitoring and need to redraw using the new data. All of the examples I can find only show how render the 3D contour surface from fixed data.
I can't find an example of explanation of how to (clear, delete, erase) the mesh or model and redraw with new data.
Can anyone point me to an example or explain how to redraw the 3D contour surface with the new data.
wpf
New contributor
I am rendering a 3D contour surface from data. I get new data every few seconds from real time monitoring and need to redraw using the new data. All of the examples I can find only show how render the 3D contour surface from fixed data.
I can't find an example of explanation of how to (clear, delete, erase) the mesh or model and redraw with new data.
Can anyone point me to an example or explain how to redraw the 3D contour surface with the new data.
wpf
wpf
New contributor
New contributor
edited Nov 10 at 17:32
amonk
1,49111323
1,49111323
New contributor
asked Nov 10 at 15:31
TomC
1
1
New contributor
New contributor
If you know how to calculate your mesh, just use MVVM and bind your data to theMeshGeometry3D
. Take a look.
– jsanalytics
Nov 11 at 15:45
add a comment |
If you know how to calculate your mesh, just use MVVM and bind your data to theMeshGeometry3D
. Take a look.
– jsanalytics
Nov 11 at 15:45
If you know how to calculate your mesh, just use MVVM and bind your data to the
MeshGeometry3D
. Take a look.– jsanalytics
Nov 11 at 15:45
If you know how to calculate your mesh, just use MVVM and bind your data to the
MeshGeometry3D
. Take a look.– jsanalytics
Nov 11 at 15:45
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
I have solved this issue with the help of several answered questions.
Removed all children of the Model3DGroup 'main_model_3D_group'.
for (int i = main_model_3D_group.Children.Count-1; i >= 0; i--)
{
if (main_model_3D_group.Children[i] is GeometryModel3D)
main_model_3D_group.Children.RemoveAt(i);
}
rebuild the GeometryModel3D objects
- add the GeometryModel3D objects back to the children of the main_model_3D_group.
Second Issue encountered:
I used an ImageBrush to get a gradient colored surface material.
The ImageBrush.ImageSource locks the file so you can't save the same filename with new color data.
Solved this with the following function;
public ImageSource BitmapFromUri(Uri source)
{
bitmap.BeginInit();
bitmap.UriSource = source;
bitmap.CacheOption = BitmapCacheOption.OnLoad;
bitmap.EndInit();
return bitmap;
}
This function leaves Uri source (xxx.PNG file) unlocked, but the 2nd call doesn't reload the file (assume because it is cached). Solved this by using 2 filename (odd/even). So every other call used a different filename.
New contributor
Can you please post a MCVE ?
– jsanalytics
Nov 13 at 0:24
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I have solved this issue with the help of several answered questions.
Removed all children of the Model3DGroup 'main_model_3D_group'.
for (int i = main_model_3D_group.Children.Count-1; i >= 0; i--)
{
if (main_model_3D_group.Children[i] is GeometryModel3D)
main_model_3D_group.Children.RemoveAt(i);
}
rebuild the GeometryModel3D objects
- add the GeometryModel3D objects back to the children of the main_model_3D_group.
Second Issue encountered:
I used an ImageBrush to get a gradient colored surface material.
The ImageBrush.ImageSource locks the file so you can't save the same filename with new color data.
Solved this with the following function;
public ImageSource BitmapFromUri(Uri source)
{
bitmap.BeginInit();
bitmap.UriSource = source;
bitmap.CacheOption = BitmapCacheOption.OnLoad;
bitmap.EndInit();
return bitmap;
}
This function leaves Uri source (xxx.PNG file) unlocked, but the 2nd call doesn't reload the file (assume because it is cached). Solved this by using 2 filename (odd/even). So every other call used a different filename.
New contributor
Can you please post a MCVE ?
– jsanalytics
Nov 13 at 0:24
add a comment |
up vote
0
down vote
I have solved this issue with the help of several answered questions.
Removed all children of the Model3DGroup 'main_model_3D_group'.
for (int i = main_model_3D_group.Children.Count-1; i >= 0; i--)
{
if (main_model_3D_group.Children[i] is GeometryModel3D)
main_model_3D_group.Children.RemoveAt(i);
}
rebuild the GeometryModel3D objects
- add the GeometryModel3D objects back to the children of the main_model_3D_group.
Second Issue encountered:
I used an ImageBrush to get a gradient colored surface material.
The ImageBrush.ImageSource locks the file so you can't save the same filename with new color data.
Solved this with the following function;
public ImageSource BitmapFromUri(Uri source)
{
bitmap.BeginInit();
bitmap.UriSource = source;
bitmap.CacheOption = BitmapCacheOption.OnLoad;
bitmap.EndInit();
return bitmap;
}
This function leaves Uri source (xxx.PNG file) unlocked, but the 2nd call doesn't reload the file (assume because it is cached). Solved this by using 2 filename (odd/even). So every other call used a different filename.
New contributor
Can you please post a MCVE ?
– jsanalytics
Nov 13 at 0:24
add a comment |
up vote
0
down vote
up vote
0
down vote
I have solved this issue with the help of several answered questions.
Removed all children of the Model3DGroup 'main_model_3D_group'.
for (int i = main_model_3D_group.Children.Count-1; i >= 0; i--)
{
if (main_model_3D_group.Children[i] is GeometryModel3D)
main_model_3D_group.Children.RemoveAt(i);
}
rebuild the GeometryModel3D objects
- add the GeometryModel3D objects back to the children of the main_model_3D_group.
Second Issue encountered:
I used an ImageBrush to get a gradient colored surface material.
The ImageBrush.ImageSource locks the file so you can't save the same filename with new color data.
Solved this with the following function;
public ImageSource BitmapFromUri(Uri source)
{
bitmap.BeginInit();
bitmap.UriSource = source;
bitmap.CacheOption = BitmapCacheOption.OnLoad;
bitmap.EndInit();
return bitmap;
}
This function leaves Uri source (xxx.PNG file) unlocked, but the 2nd call doesn't reload the file (assume because it is cached). Solved this by using 2 filename (odd/even). So every other call used a different filename.
New contributor
I have solved this issue with the help of several answered questions.
Removed all children of the Model3DGroup 'main_model_3D_group'.
for (int i = main_model_3D_group.Children.Count-1; i >= 0; i--)
{
if (main_model_3D_group.Children[i] is GeometryModel3D)
main_model_3D_group.Children.RemoveAt(i);
}
rebuild the GeometryModel3D objects
- add the GeometryModel3D objects back to the children of the main_model_3D_group.
Second Issue encountered:
I used an ImageBrush to get a gradient colored surface material.
The ImageBrush.ImageSource locks the file so you can't save the same filename with new color data.
Solved this with the following function;
public ImageSource BitmapFromUri(Uri source)
{
bitmap.BeginInit();
bitmap.UriSource = source;
bitmap.CacheOption = BitmapCacheOption.OnLoad;
bitmap.EndInit();
return bitmap;
}
This function leaves Uri source (xxx.PNG file) unlocked, but the 2nd call doesn't reload the file (assume because it is cached). Solved this by using 2 filename (odd/even). So every other call used a different filename.
New contributor
New contributor
answered Nov 12 at 18:26
TomC
1
1
New contributor
New contributor
Can you please post a MCVE ?
– jsanalytics
Nov 13 at 0:24
add a comment |
Can you please post a MCVE ?
– jsanalytics
Nov 13 at 0:24
Can you please post a MCVE ?
– jsanalytics
Nov 13 at 0:24
Can you please post a MCVE ?
– jsanalytics
Nov 13 at 0:24
add a comment |
TomC is a new contributor. Be nice, and check out our Code of Conduct.
TomC is a new contributor. Be nice, and check out our Code of Conduct.
TomC is a new contributor. Be nice, and check out our Code of Conduct.
TomC is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240451%2fwpf-3d-graphics-redraw-when-data-changes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If you know how to calculate your mesh, just use MVVM and bind your data to the
MeshGeometry3D
. Take a look.– jsanalytics
Nov 11 at 15:45