0
Under review

How do I display pipe properties?

Mark4965 3 years ago in Question • updated by Brittany M. Lemay 4 days ago 23

Good Afternoon,


First off, I've really enjoyed using Helix and as a new user of WPF and graphical programming, I have found Helix very easy to use as well a aid during my learning process. The work put into this project is much appreciated!


I am currently working on a program where the user can create various elements (pipes, spheres, etc.) by inputting the appropriate inputs and graphically display them in the viewport.


Up to now everything has been pretty straight forward. Where I've been hung up the last several days is how to display the properties of the elements once selected with the mouse. For example, if user creates a pipe and then selects it a window would display the diameter, inner diameter, and Point1/2 coordinates. From what I can tell the BuildingDemo might provide a good example as to how this is accomplished however the PropertyGrid remains blank when I select something.


If anyone could provide some insight or some example code I would be extremely grateful. If you need more information please let me know.

Under review

Hi Mark, there was an issue with the wrong BrowsableAttribute being used in the models. The PropertyGrid is set to require [System.ComponentModel.Browsable]. See the updated example source code on github.

Thanks for looking at this and for the reply. I will take a look once I get home.


I was able to come up with a work around which ended up being a better fit for what I ultimately needed. Once i figured this out i felt a bit silly as it seemed so obvious. I'll post a source code example as well once I get home.

Øystein,


The property window is now being populated. Thanks again for looking into the issue!


As for the work around I eventually stumbled into see the example code below. For example purposes I'm manually adding the pipe properties. In my actual program the user inputs the desired values in a textbox and clicks the "AddElement_Click" button to incorporate the element.

public void AddElement_Click(object sender, RoutedEventArgs e)
{
    PipeVisual3D tubenew = new PipeVisual3D();
 
    tubenew.Material = Materials.Green;
    tubenew.Point1 = new Point3D(0, 0, 0);
    tubenew.Point2 = new Point3D(0, 5, 0);
    tubenew.Diameter = 0.5;
    tubenew.InnerDiameter = 0.4;

    View1.Children.Add(tubenew);
}

Using the ViewModel.cs file from BuildingDemo and the code below, I am able to obtain the pipe properties to display in a format of my choosing.


private void CheckElement_OnMouseDown(object sender, MouseButtonEventArgs e)
{
    var viewport = (HelixViewport3D)sender;
    var firstHit = viewport.Viewport.FindHits(e.GetPosition(viewport)).FirstOrDefault();
    if (firstHit != null)
    {
        GetDiameter = HelixToolkit.Wpf.PipeVisual3D.DiameterProperty;
        GetInnerDiameter = HelixToolkit.Wpf.PipeVisual3D.InnerDiameterProperty;

        var a = firstHit.Visual.GetValue(GetDiameter);
        var b = firstHit.Visual.GetValue(GetInnerDiameter);
    }
}

If anyone sees a better or more elegant way of pulling the properties without using the PropertyGrid I'd be happy to see/hear it. I'm still learning and trying to make my code more efficient so any constructive comments or suggestions are more than welcome!


Mark

Friends:

Could you please direct me to the source code for the (or a) pipe project?

Thanks

ikonuk

The web site is lovingly serviced and saved as much as date. So it should be, thanks for sharing this with us.   Boston garage door repair

i am for the first time here. I found this board and I in finding It truly helpful & it helped me out a lot. I hope to present something back and help others such as you helped me.   slim wave garcinia reviews

You have done a great job. I will definitely dig it and personally recommend to my friends. I am confident they will be benefited from this site.   kings gold keto review

This is very useful post for me. This will absolutely going to help me in my project.   Keto Kinetics Review Buyer's Guides, Testimonials (2019)

Very nice post and also very interesting too. Thanks for sharing here a useful article. Also visit the link : Nop in NJ

I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing. Domain Authority

Thank you very much for this useful article. I like it. bookkeeping

This is such a

great resource that you are providing and you give it away for free. I

love seeing websites that understand the value of providing a quality

resource for free. It is the old what goes around comes around routine. Sign Maker Wolverhampton

I am hoping the same best effort from you in the future as well. In fact your creative writing skills has inspired me. travel the world

Your blog

provided us with valuable information to work with. Each & every

tips of your post are awesome. Thanks a lot for sharing. Keep blogging, perniagaan internet

Thank you again

for all the knowledge you distribute,Good post. I was very interested

in the article, it's quite inspiring I should admit. I like visiting you

site since I always come across interesting articles like this

one.Great Job, I greatly appreciate that.Do Keep sharing! Regards, Used guns for sale

I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. Ballet classes in Dubai

You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant! bisnes taufufah

I really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people. Hotel San Blas

very interesting post.this is my first time visit here.i found so mmany interesting stuff in your blog especially its discussion..thanks for the post! charlotte startups

I think that thanks for the valuabe information and insights you have so provided here. Informática forense Madrid

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. Agen togel terpercaya