0
Under review

How do I display pipe properties?

Mark4965 4 years ago in Question updated by Harlan 4 weeks ago 22

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 think that thanks for the valuabe information and insights you have so provided here. Informática forense Madrid

This is truly incredibly ideas and I am excited about this content alexpress spy tool

I'm contented to see your site I'm really happy this facts and method here eye conditions and ulcerative colitis

This is a outstanding content.I really like your brilliant perform here alcohol and drug addiction auckland

I am contented I got here the info is highly fantastic.Please keep on posting Male Extra

Wonderful and nice facts thank you for this and is really precious site buy chicken egg incubators

Fantastic and awesome post here and thank you for this website graco 4 in 1 car seat

I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page!hnd assignments

I always visit your site to read your daily posts. I really enjoyed everytime I visit here coz your always offered fresh and entertaining article. professional tax marketing

This is fantastic post, thank you for sharing this overflowing great information to us! I am so happy and would love to read more post coming from you... ketogenic diet

Decent data, dewajudiqq profitable and superb structure, as offer great stuff with smart thoughts and ideas, bunches of extraordinary data and motivation, the two of which I need, because of offer such an accommodating data here.

Buy amazing electronic items here with 50%

buy Electronic items 

Enrgtech 

I really appreciate everything you have shared to us. Anyways I'll be saving site and I hope you post again real soon. how to ask a girl for a date