0

3D coordinate system axis names

Anonymous 10 years ago 0
This discussion was imported from CodePlex

michaeldjackson wrote at 2012-10-18 14:58:

Does anyone know how to add "X", "Y", "Z" text on the coordinate system, without modifying source code?

 


RobPerkins wrote at 2012-10-19 17:43:

To do this without modifying the source code of Helix3D, you would have to reconstitute the <style> of the HelixViewport3D. You can find the original style in the Generic.xaml file in the codebase for a template.

 

Copy and place it in any resource dictionary, and then modify the "PART_CoordinateView" portion to read:

                            <Viewport3D x:Name="PART_CoordinateView" 
                                        Width="{TemplateBinding CoordinateSystemWidth}" Height="{TemplateBinding CoordinateSystemHeight}" Margin="0" 
                                        HorizontalAlignment="{TemplateBinding CoordinateSystemHorizontalPosition}" VerticalAlignment="{TemplateBinding CoordinateSystemVerticalPosition}" 
                                        ClipToBounds="False" Visibility="{TemplateBinding ShowCoordinateSystem, Converter={StaticResource BoolToVisibilityConverter}}">
                                <local:ArrowVisual3D Point2="8 0 0" Fill="#964B4B" />
                                <local:TextBillboardVisual3D  Position="9 -2 1" Text="X" Height="10" />
                                <local:ArrowVisual3D Point2="0 8 0" Fill="#4B964B" />
                                <local:TextBillboardVisual3D Position="-2 9 1" Text="Y" Height="10" />
                                <local:ArrowVisual3D Point2="0 0 8" Fill="#4B4B96" />
                                <local:TextBillboardVisual3D Position="-2 -1 9" Text="Z" Height="10" />
                            </Viewport3D>

Then, wherever you set the HelixViewport3D up, just set its Style property to your custom style.


michaeldjackson wrote at 2012-10-19 17:56:

Rob,

Thanks for the reply.

I placed the style in my Resource Dictionary, but I get the error:

"Could not register named object. Names not supported under ResurceDictionary scope."

When I remove the x:Name="PART_CoordinateView", the previous error goes away, but I get this error:

"Failed to creat a 'DependencyProperty' from the text 'CoordinateSystemWidth'."

Michael Jackson

Senior Sofware Developer / Analyst

Department of Petroleum and Geosystems Engineering

University of Texas at Austin

mjackson@austin.utexas.edu

CPE 5.116


From: RobPerkins [notifications@codeplex.com]
Sent: Friday, October 19, 2012 10:43 AM
To: Jackson, Michael D
Subject: Re: 3D coordinate system axis names [helixToolkit:399901]

From: RobPerkins

To do this without modifying the source code of Helix3D, you would have to reconstitute the <style> of the HelixViewport3D. You can find the original style in the Generic.xaml file in the codebase for a template.

Copy and place it in any resource dictionary, and then modify the "PART_CoordinateView" portion to read:

                            <Viewport3D x:Name="PART_CoordinateView" 
                                        Width="{TemplateBinding CoordinateSystemWidth}" Height="{TemplateBinding CoordinateSystemHeight}" Margin="0" 
                                        HorizontalAlignment="{TemplateBinding CoordinateSystemHorizontalPosition}" VerticalAlignment="{TemplateBinding CoordinateSystemVerticalPosition}" 
                                        ClipToBounds="False" Visibility="{TemplateBinding ShowCoordinateSystem, Converter={StaticResource BoolToVisibilityConverter}}">
                                <local:ArrowVisual3D Point2="8 0 0" Fill="#964B4B" />
                                <local:TextBillboardVisual3D  Position="9 -2 1" Text="X" Height="10" />
                                <local:ArrowVisual3D Point2="0 8 0" Fill="#4B964B" />
                                <local:TextBillboardVisual3D Position="-2 9 1" Text="Y" Height="10" />
                                <local:ArrowVisual3D Point2="0 0 8" Fill="#4B4B96" />
                                <local:TextBillboardVisual3D Position="-2 -1 9" Text="Z" Height="10" />
                            </Viewport3D>

Then, wherever you set the HelixViewport3D up, just set its Style property to your custom style.


RobPerkins wrote at 2012-10-19 18:00:

I can't see your code, but, you need the entire style from the Default.xml for HelixViewport3D; I only posted the part that needs changing.

The PART_CoordinateView x:Name must stay attached to this Viewport3D snippet within the style.


michaeldjackson wrote at 2012-10-19 19:09:

That was dumb of me. Thanks for the help.

Are you able to help with another problem?

I draw piping systems based on an observable collection, then setting ViewPort3D ItemsSource to this collection. This works fine, however when I first load the application, it fires an event on my treeview, which loads a "case", which loads the collection of pipe. But the pipe system does not appear. I have had to add a button to "redraw" the pipe system.

I tested yesteray and determine that if I create a meshbuilder, with the .AddPipe method per objo's suggestion (Jun 25, 2012 1:33), it works as expected.

However, I need to create one PipeVisual3D at a time in order to color the object with a gradient (it is colored based on temperature, pressure, etc.

Also, I need elbows to join pipe. In the works?, or any suggestions?

Thanks for any help or ideas?

Michael Jackson

Senior Sofware Developer / Analyst

Department of Petroleum and Geosystems Engineering

University of Texas at Austin

mjackson@austin.utexas.edu

CPE 5.116


From: RobPerkins [notifications@codeplex.com]
Sent: Friday, October 19, 2012 11:00 AM
To: Jackson, Michael D
Subject: Re: 3D coordinate system axis names [helixToolkit:399901]

From: RobPerkins

I can't see your code, but, you need the entire style from the Default.xml for HelixViewport3D; I only posted the part that needs changing.

The PART_CoordinateView x:Name must stay attached to this Viewport3D snippet within the style.


RobPerkins wrote at 2012-10-19 21:50:

Two PipeVisual3D's and a sphere, scaled to the sizes you need, should resemble a pipe elbow. You'd need to write the class that emits it and scale the results.

I'm working on similar graphics problems but I don't have employer permission to release code.

You could also use texture coordinates, correlated with triangle vertices, and combined with a GradientBrush to plot color data along your surface. A pipe geometry is a relatively simple thing to tessellate. It wouldn't be hard to further tessellate so that you get vertices at points along the pipe that align with your data results.


objo wrote at 2012-10-22 22:46:

I added the coordinate system labels to the default template. I hope it is ok for everyone...

Thanks for sharing the code, Rob!