Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need a very simple code example to create a 3d model in WPF.
Can you give me such the code?

I wanna add the code to my new WPF application and see a result.
It should be very simple to make it easy to understand.
I need it in C# language, not XAML.

I don't wanna add models into WPF.
I wanna create them in WPF, for example, 3d Ellipse or 3d Cube.
Posted
Updated 26-May-15 2:53am
v6

Zam3d is a great tool for converting 3D Models into Xaml. I highly recomend Petzold's book http://www.charlespetzold.com/3D/index.html[^]
 
Share this answer
 
Comments
Ziya1995 26-May-15 8:34am    
You copied it from another forum.
I don't wanna convert models into XAML.
I need a code to create a model, for example, 3d Ellipse, 3d Cube in WPF.
Have a look at the simple example shown here: http://wpftutorial.net/IntroductionTo3D.html[^]

And as GanesanSenthilvel recommended if you work with 3d you "Need" something to create your models... Your "I wan't to do it in code" makes you look a little "dumb" - take the example form the link I provided. If you can't convert that xaml to code (but why?), you shouldn't go for 3d WPF... sorry to say that.
 
Share this answer
 
Comments
Ziya1995 26-May-15 9:06am    
> if you work with 3d you "Need" something to create your models...
I specify my goal to make it clear:
I wanna create primitive models like 3d Ellipse or 3d Cube.
I wanna do it in code using C#, not XAML.
I wanna go for 3d in WPF to make an app with 3d models out scratch in WPF.

The code given through your link is written in XAML.
I need in C#.
You can convert it into C# and give me and if it works, i accept your solution.
johannesnestler 26-May-15 9:30am    
Sorry I have better things to do than write code like

Viewport3D viewport = new Viewport3D();
viewport.Camera = new PerspectiveCamera(); ...

..this is what I thought when you asked for "C# code", please try for yourself should be easy. All type and property names are the same in C# as in XAML...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900