Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

CWGraph 3D problem - flat fill style

Dear Forum Members,

 

I'm new to C# programming and NI Measurement Studio. I'd like to visualize measurement data using the CWGraph 3D ActiveX component and I've probably encountered a bug.

 

In order to test the capabilities of CWGraph 3D, I've written a simple C# program, in which I'm trying to draw a checkboard. I've created the appropiate vectors xData, yData, zData, and made the plot using the following code (the vector zData simply consists of ones and zeros):

 

 

axCWGraph3D1.Plot3DMesh(xData, yData, zData);

 

As expected, I got the image below.

 

 checkboard.png

 

As a next step, I wanted to make it really look like a checkboard, with solid filled, purely black and white squares. And here is the problem: I've tried to set the fill style to flat in properties page ( Plots > Fill > Style: Flat ), and also tried to set it programatically, with the following code, without any success (absolutely nothing happens).

 

 

axCWGraph3D1.Plots.Item(1).FillStyle = CW3DGraphLib.CWFillStyles.cwFlat;

 

I've found a post with the same problem in the LabWindows/CVI category: http://forums.ni.com/ni/board/message?board.id=180&message.id=14821

Here is the image he attached: http://forums.ni.com/ni/attachments/ni/180/14909/1/maps.JPG (the one on the right hand side is the desired result)

 

He was told to switch back to the older version of the component, which worked well. I can't switch back to an older version, and I'm wondering if there is any other workaround for this problem.

 

If I add lighting to the plot in the properties page, than changing the fill style has some effect (but not the desired), so I think the code works well.

 

My development environment:

 

Microsoft Visual C# 2005

NI Measurement Studio 8.5.20.220

 

Thank you very much,

Gergo

0 Kudos
Message 1 of 5
(5,129 Views)

Hi

 

Here is a Knowledge Base document describing what you are seeing: http://digital.ni.com/public.nsf/allkb/CD1664E8981C13F386256FDD007B321C?OpenDocument

So the behavior is known and documented. 

As for your idea - creating the checkboard, could you please post the X,Y,Z values which you are using? As I understood it, you are trying to use a 3D graph to create a checkboard. So you want to look at the plot 'from top'. If you would like to see a checkboard, you would need to have a sharp transition between 2 flat fields. It will never be exactlty sharp, but you can come close to it.To understand it better (keep in mind - this is my guess)have a look at the attachement. I think you are trying to look from the top on a shape like the one on the left, while you need one similar to the one on the right. 

 

Regards

Best regards,
Maciej Antonik
National Instruments Poland
0 Kudos
Message 2 of 5
(5,076 Views)

Hello,

 

Thank you for your reply.

 

1) I haven't seen this KnowledgeBase entry before. In my opinion it's a little bit misleading and inaccurate. If I understood well that old forum thread I linked, the very old version of CWGraph3D could provide a 'pixelated view' with the flat fillstyle (see the image map.jpg I linked). The newer versions can't, this fillstyle has effect only on lighting, it's a completely different feature. I can see that the lighting really becomes flat or smooth when I change this property, but it doesn't have effect on the colormap. I think the old behaviour of this feature was much more useful, than the current one. So in my opinion enabling lighting is not a real solution, because one is probably looking for the 'pixelated appearance', which is not available anymore. But I understand the the OpenGL library is the responsible for this behaviour.

 

2) Thanks for your idea, the image you attached describes it pretty well. Here is my interpretation of your idea in one dimension:

 

 cwgraph_sol.png

So, if I add some extra data-points, I can achieve a sharper transition. I think the major drawback of this method is the extra memory consumption. I began to write this checkboard application only for testing the properties and features of the CWGraph 3D component. For example, for determining empirically the number of maximum data-points it can handle. In the real-life situation in which I wish to use it I will have about 400x400 data-points (X, Y, Z 'pairs') from measurements. In the one dimensional case above every data point needs another 2 data points to achieve the sharper transition. In 2D,  I have to add 4 extra data-points next to every original point, so the total number of data-points increases by a factor of 5. (I think if I want to get rid of the diamond-looking shapes and get proper squares, I need 8 extra points/original point.)

 

As drawing a checkboard is not my main purpose, I don't attach my X, Y, Z values, if you don't mind.

 

You are correct, I'm viewing the 3D graph 'from top'.  I don't need the fancy 3D features, like rotating, ligthing and so on. Keeping this in mind, is there an other Measurement Studio component which I can use to visualize X, Y, Z data-points? If I set the properties to show only the XY-plane projection, it's very close to the desired behaviour, it's a pity that the flat fill style doesn't work as expected.

 

Best regards,

Gergo

0 Kudos
Message 3 of 5
(5,072 Views)

Hello,

 

I have to correct myself. It's not necessary to have 8 or 5 visual data-points/measured datapoint, 4 is enough to achieve the desired  look where one little square (with relatively sharp edges) represents one measured datapoint.

 

Thank you again for your idea, it is really valuable.

 

Regards,

Gergo

0 Kudos
Message 4 of 5
(5,050 Views)

Hi

 

I don't know your exact requirement, but you might consider 2 options for displaying this kind of information:

- Scatter Graph

- Array of booleans

More info can be found herre: http://www.ni.com/mstudio/gallery/start.htm

Best regards,
Maciej Antonik
National Instruments Poland
0 Kudos
Message 5 of 5
(5,031 Views)