Cwgraph3d variants in labview?

Hi there, first time poster - though I've been reading these forums for a long time.  They're quite helpful.  Anyways, on to my problem...
I'm using a 3d graph (cwgraph3d) in a simple labview vi and am trying to extract mouse position coordinates.   I can get the mouse events to fire correctly, but I can't figure out how to use the data that is provided in the event.  The event data is provided in a variant format, but I can't figure out how to convert the variants to anything I can use in LV.  I've tried using the "variant to data" function, but I get the error "LabVIEW:  The data type of the variant is not compatible with the data type wired to the type input."  no matter what data type I use.  Also, flattening the variant to a string results in an empty string.  Anyone have any ideas?
Thank you,
cwild

Hi cwild,
Welcome into the sunlight! You wrote "Hi there, first time poster - though I've been reading these forums for a long time."
Then you have heard us ask for an example to help us help you.
Post a quick demo of what you have so far and we may be amble to give you the "push" you need to get over this hump.
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction

Similar Messages

  • ActiveX variant to LabVIEW variant

    Hi Ppl,
    I'm reading ActiveX data from an application(TestStand) in LabVIEW. The data I get is of the type ActiveX Variant. When I use variant to data node I'm able to convert the data to the corresponding data type. Howevere in my application the data type varies dynamically and I cannot use the variant to data node.
    I will have to flatten it to string. But the flatten to string node does not work with ActiveX variants. It only works with LabVIEW variant types. So is there any way that i could convert ActiveX variant types to LabVIEW variant. I tried the to variant node too. I too does not convert it as expected.
    Thanks,
    Sathish
    Here is how both the variant types differ
    Activex variant (boolean):
    '': OLE Variant 
    Variant Type -> VT_BOOLValue -> FALSE
    LabVIEW variant(boolean):
    'Boolean': boolean (TRUE or FALSE) 
    FALSE

    Hi lordsathish,
    Unfortunately, there is no way in LabVIEW to access type data for OLE/ActiveX variant data.  However, you can obtain information about the datatype of a TestStand PropertyObject using the ValueType method:
    myObject.Type.ValueType
    This will return the data type (see the ValueType help entry for more details).  you can then use the specific type methods (getValBoolean, etc) to extract data.  In the case that you have an array, you can use the ArrayDimensions and ElementType to extract the data from the array.  In the case of a container, the contained items will be considered propertyObjects, so you can use the getNumSubProperties and getPropertyObject methods to access the contained items.
    Refer to the PropertyObjectType reference help for details on these methods
    I hope this clarifies!
    Al B.
    Staff Software Engineer - TestStand
    CTA/CLD

  • Pb with "Get Variant Attribute" LabVIEW 6

    hello
    I want to find the value corresponding to the variable name in a Variant structure. For this purpose I use the "Get Variant Attribute" function, but I do not get any good result : no result in the get value, and also when no string name input is given to get all the attribute of the variant.
    where is the bug ?
    thank you

    Hi,
    No bug, Get Variant Attribute returns values you've put in it using Set
    Variant Attribute.
    Unfortunately there is no way (I could think of) to get the text of a
    variant out of the variant in string format.
    Regards,
    Wiebe.
    "hub" wrote in message
    news:[email protected]..
    > hello
    > I want to find the value corresponding to the variable name in a
    > Variant structure. For this purpose I use the "Get Variant Attribute"
    > function, but I do not get any good result : no result in the get
    > value, and also when no string name input is given to get all the
    > attribute of the variant.
    > where is the bug ?
    > thank you

  • Is it possible to convert LabView data into OLE variant?

    Hi. I'm using Activex Data Objects (ADO) to communicate with MySQL. Some ActiveX methods give OLE variant output, with "Variant Type" like "VT_ARRAY|VT_UI1", "VT_UI1" or "VT_BSTR". With some deduction and trial and error is relatively simple to extract data from this OLE variants and convert them to LabView data types. The problem is when I try to input variant data to some ActiveX methods, it almost always give me errors, I suppose because it expects the same type of the outputs, this is: OLE variants. Now, the question is: ¿Is there any way to convert LabView data into OLE variant data? ¿How?
    I've been searching and found a lot of posts about problems when passing variant data into ActiveX, saying that sometimes SAFEARRAYs are needed, sometimes saying that there were some bugs in LV6, giving some workarounds to this bug and saying that it is fixed in LV7.1, but the supposed workarounds don't work and the bug is still present in LV7.1, if it is really a bug.
    I think that if I could put LV data into OLE variant shape I may find an answer and solution to this matter.
    Thank you
    Daniel R.
    UdeC - Chile

    Below I describe how to handle OLE Variants, but I wanted to mention that LabVIEW does have a Database Connectivity toolkit (http://sine.ni.com/nips/cds/view/p/lang/en/nid/6429) that has already created a set of VIs for ADO. You might check that out first.
    However, handling OLE Variants in LabVIEW is automatic. LabVIEW itself has a variant datatype. When you use the ActiveX property or invoke nodes and one of the parameters is an OLE Variant, it is automatically converted to a LV Variant. You can then use the LV Variant VIs (such as "Variant to Data" and "To Variant").
    Brian Tyler
    http://detritus.blogs.com/lycangeek

  • LabVIEW Variant Attributes get lost in TestStand?

    Hello,
    Example code attached.
    I'm using a LabVIEW variant as a lookup table by using the attributes (see here: https://decibel.ni.com/content/docs/DOC-25371 (and others)).  It works well.  When I attempt to pass this variant from one TestStand step to another, I lose the attributes of the variant.  I've made a small example to demonstrate this.  Am I doing something wrong?  Why does the variant retain the value, but not the attributes?  Should I store this as another type in TestStand?  In the documentation for LabVIEW types in TestStand, it is claimed that a Variant in LabVIEW maps to "Anything" in TestStand.  When I tried to use a Boolean, however, I got an error and was instructed to use a Container.  Does that container need to have some specific suptype to retain the attributes?  Or does it have nothing to do with that?
    Thanks in advance
     

    Hey GarryG,
    Here is an excerpt from the NI Product Support Engineer's response on this issue:
    "Unfortunately, this is a known limitation with LabVIEW variants in TestStand.  When LabVIEW variant data is returned to TestStand from a LabVIEW code module, the data overwrites the property. TestStand does not have a mechanism to "fit" the returned variant data to the TestStand type, so unfortunately you will need to either remap the data to the type, or use a cluster rather than a variant."
    Essentially, it appears that variant data can not be guaranteed to work properly in TestStand. In order to ensure you have your data passed from your Code Modules correctly, I would recommended following the Product Support Engineer's advice of remapping or clustering the data. If this is not possible, the Flatten Variant to String.vi could be an alternative to try. I was able to confirm that this has not been fixed with TestStand 2014 either.
    Typecasting LabVIEW Variants in TestStand Forum Post:
    http://forums.ni.com/t5/NI-TestStand/typecasting-Labview-variant-in-Teststand/td-p/2160452/page/2
    I hope this helps!

  • How to print a componentworks graph in Labview?

    Can anyone give me an example of how to print a CWGraph3D object in labview please?

    Try this one out. I just modified the example found here
    http://venus.ni.com/stage/we/niepd_web_display.DISPLAY_EPD4?p_guid=C4380ADE4A6960DBE034080020E74861&p_node=%20DZ52085&p_submitted=N&p_rank=&p_answer=&p_source=Internal
    Attachments:
    Print_ActiveX.vi ‏17 KB

  • ActiveX Variant Pointer - Variant?

    Hello.
    I have an ActiveX control that requires a VARIANT to be passed in. The VARIANT needs to contain a SAFEARRAY of int32s. I have a DLL that assembles the variant SAFEARRAY from a standard LabVIEW array. However, because of limitations on Call Library Function Nodes my DLL function has arguments of long * and VARIANT *. So I end up with a VARIANT pointer rather than a plain VARIANT.
    Q. Why can't Call Library Function Nodes just return a VARIANT?
    Moving along, I wire the VARIANT pointer to a "To Variant" vi and then wire the output to my ActiveX control method.
    => The ActiveX control (IDL SetNamedArray) is meant to share memory with the container application. I assume this is possible by sharing the SAFEARRAY pointed to by p
    array within the VARIANT. The problem is that this doesn't work. The error returned is that "memory is locked" in the vi.
    Q. Does LabVIEW lock SAFEARRAYs?
    If anyone has had any experience manipulating SAFEARRAY VARIANTs in LabVIEW and passing them to ActiveX controls I'd be most interested to hear of any tricks and undocumented features.
    cheers,
    Novak.

    > But I need to do something different because wiring an LV array
    > straight into the method will copy the data into the IDL ActiveX
    > control but the memory is not shared between LV and IDL - I get the
    > memory locking error and the method fails (returns 0). Thats why I
    > tried making the VARIANT myself. I've contacted IDL and when I
    > resolve this issure I will post my findings because it might be of
    > general interest amongst users of ActiveX controls in LV.
    >
    If you want there to be shared memory between the two, then you should
    probably look to make additional methods, one that allocates if
    necessary and copies the LV data into the shared space, and another to
    return the value to the LV diagram from the shared memory.
    Greg McKaskl
    e

  • Is it possible for a cluster to be set to allow variable data input?

    I posted this question at the bottom of a different thread but it looks like that one has died out plus this is really a separate question. So I hope no one minds me starting a new thread here.
    I made the program Convert2Matfile.vi which I intend to use as a SubVI in other programs. How I want this program to work is I would like to bundle up double any quantity of 1D/ 2D arrays and or numeric values and pass them to this tool which will then convert what ever it is sent to an appropriate variable in a matlab file using the element name as the matlab variable name.
    The issue I am having here, is that currently I have a 1D, 2D and a numeric value sitting in the cluster definition on my front panel of the Convert2Matlfile.vi. Because I have this, the code is looking for every cluster to be structured exactally like the one I have in the front panel. How do I source that code more generically? See the photo below of the broken wire. Error message is as follows;
    You have connected two arrays of different dimensions.
    The dimension of input cluster -> array #2 is 1.
    The dimension of Cluster In -> array 2 is 2.
    So clearly it is looking for the Cluster to be exactally like the one it is looking for. Is there any way to do this more generically so it can accept any type of cluster of any quantity of values so long as they meet my criteria?
    Attachments:
    conv2mat.vi ‏49 KB
    Convert2Matfile.vi ‏58 KB
    Conv2Matlab Cluster Issue.png ‏33 KB

    Well it looks like I will likely need to treat this as a variant. Unfortunatley for me I hate dealing with Variants in LabVIEW likely more as a result as a lack of understanding when it comes to how to deal with them than anything. My stratedgy I would think should be as follows figure out how many items are in my variant that are either a numeric, a 1D or a 2D array. Then one by one go to each of those values. If say it is a numeric get the numerical value, get the label name and send it over to my convert to Matlab program one by one.
    So that would be the theory behind how I would try to do this. Now how the heck do I actually do anything along those lines? I can't even figure out how to get the number of elements in my variant. I would have thought the "Get Variant Attribute function" would be a great place to start. So I made up the exploreVariant.vi below. See the images of the code plus the front panel after execution. I followed the instructions from the following location;
    http://zone.ni.com/reference/en-XX/help/371361J-01​/lvhowto/retrievingattribsfromvard/
    Add the Get Variant Attribute function to the block diagram.
    Wire variant data to the variantinput of the Get Variant Attribute function.
    Leave the name input and the default valueinput of the Get Variant Attribute function unwired.
    Right-click the names output and select Create»Indicatorfrom the shortcut menu.
    Right-click the values output of the Get Variant Attribute function and select Create»Indicatorfrom the shortcut menu to retrieve the values associated with each attribute.
    Run the VI.
    Even after following the instructions above nothing shows up in either the names or values collumn. So how the heck do I actually do what I want to do? I just can't seem to figure out how to index through a variant at all.
    Attachments:
    exploreVariant.vi ‏10 KB
    variantcode.png ‏35 KB
    VariantFrontPanel.png ‏73 KB

  • How do I post data in HTML fields

    Hi.
    I need to log onto a web server from LabVIEW 7.1. I have this working in VB, but I don't know how to use the Microsoft Web Browser ActiveX object (specifically how to find the types of some variants).
    In VB, I'd do the following to post data into two fields and click a button:
    WebBrowser1.Document.frames(1).loginform.UserName.Value = "username"
    WebBrowser1.Document.frames(1).loginform.Password.Value = "password"
    WebBrowser1.Document.frames(1).loginform.Item(2).Click
    From the web browser object in LV I can navigate to the URL, and decode the Document variant which seems to be of type MSHTML.DispHTMLDocument. How do I proceed from here? How do I access the different frames, forms, data fields and buttons on the web page?
    Since variants in LabVIEW carry type descriptors internally, it'd be nice to have some way to access this so I wouldn't have to guess what object prototype to convert the variant with.
    Regards
    Steen Schmidt
    CLA and CTA. Worked with LabVIEW from 4.0 to 2010 and counting...

    Hi Steen,
    I was workin in an application of accessing frames, forms and then buttons in web pages in background...
    In labview there was a problem in the MSHTMLDocument.frames functions and so will not be able to get the frames ..
    but it is possible to access forms in a page directly...i have an eg for searchin in google..(i have attached the vi)
    I need to know whether it is possible in VB to go to a particular frame in a page and then if the frame has a form i need to login in form in that frame...
    Could you please share me the code in VB (for the same)..so that it would be helpful for me...and also is it possible to make dll in vb and use in other enviorment like VC++..
    REGARDS
    vevek
    Attachments:
    autologin.vi ‏67 KB

  • Sql decimal datatype

    I'm using labview 7.1 with the database connectivity toolkit to interact with a sql server.  One column is of the datatype float, but when I send 0.95, it stores 0.94999999.  I've read about this before, but trying to use numeric or decimal causes a different problem.  When the column is of one of these datatypes and I do a fetch of the data, nothing in that column comes back.  I'm leaving the data as a variant in labview, so it isn't a conversion issue.  I get just a blank variant box.  It works only for float.  And the other columns all work fine. 
    Are decimal and numeric types not supported by labview, and if so how do I get around the inaccuracy of float datatypes?

    Fractional floating point numbers can often not be represented exactly in binary, even if they are nice and round in decimal.
    0.95 for example is actually 0.949999999999999955(DBL) or 0.9499999880791(SGL). There is nothing wrong with that. You simply need to set your display to only show the desired number of significant digits.
    ejoseph wrote:
    Are decimal and numeric types not supported by labview, and if so how do I get around the inaccuracy of float datatypes?
    There is no real inaccuracy. The difference between 0.94999999 and 0.95 is 0.00000001 or about 1 in 100000000! (This is just the diplayed part, the difference in real life is even less. Is your number really more precise that 52bits? (or 23bits for SGL).
    LabVIEW Champion . Do more with less code and in less time .

  • Daq 6024e + IR encoder

    Hi,
    I am using IR sensor to calculate the rpm of my wheel-- my problem is when I am using "low freq with one counter" initially it gives me rpm but then as I increase the rpm it gives me message that "data was overwritten before it could be read try using DMA or divide the signal before measurement" now I can not divide the signal in this method I assume-- now when I change the counter to other method like "high range or large range with with 2 ctr" it tells me immediately your signal is too slow for this type of method and increase the measurement time-- I even did that increased the time to upto 50.0 but same problem
    My Vi is attached -- How should I resolve this issue. As my wheel will move from rest and will gain some rpm and then stop-- so it will go from low to high to low.
    Thanks
    Attachments:
    counterencoder.vi ‏59 KB

    Hi tmdar,
    Were you able to see any changes upon changing the "samples per channel" parameter? You're right, it is possible that noise in the signal is being picked up as an event as well. Also, avoid running any unnecessary applcations on your computer while running this, or try running on a different machine to see if the results vary.
    LabVIEW comes with a Filter Express VI (Express >> Analysis >> Filter) which you can experiment with to perform different types of filtering. However, since this filtering is performed after the data has been acquired, it may not help with the data acquisition issue. You may need an external filter. Before taking this step, you should verify if the problem is in fact signal noise. Since you're using one counter for "Low Frequency with 1 Counter", you can use the other counter to generate a pulse train, which you can feed as the input for your counting, to see if you can get up to a higher frequency. If this works, the problem is likely with the signal source. Otherwise, the issue would likely be the system or the code (please verify that you're using the shipping example, "Measure Dig Frequency - Low Freq 1 Ctr")
    Thanks,
    Lesley Y.

  • Engineering software. Should I buy a MAC?

    Hi, people. This is my first post on this forum. Sorry, I didn't now exactly where to put this thread.
    I'm engineering student, and I work in a company where I have to use diverse software tools for engineering... My tasks, both at the university and at the company, are related with mechatronics: some topics with mechanical design 3D, and others with programmable logic controllers (PLCs), robotics, communication, sensors... So, have to use the laptop with varied software (LabView, Solid Edge, AutoCAD,...), even in the future maybe I will need to use more specific programs, special drivers for devices and machines, etc., not so well-know like previous mentioned.
    I'm thinking about buying a laptop, and the idea of acquire a MAC attracts me, due to its robustness and its very high graphic proccesing performance, I think ideal for those programs for 3D mechanical design. But, of course, the idea of leave Windows, have compatibility problems and begin learning a new OS frightens me. I don't know if I will find all this software I need (varied engineering software). And, if I don't find it, I don't know if my MAC will run slowly when I had to execute Windows parallely in it. Furthermore, I don't know where do I have to get the software I need (both these programs I already use, but in MAC version; and those analogous to these I use but own of MAC).
    On the other hand, I don't if I will need many time to get used to this new OS, or maybe, I will use it with normally in few days.
    So, is here anybody in a similar situation to me?; in general, what do you recommend me in my situation?, should I buy a MAC?
    Thanks in advance.
    Regards,
    Francisco

    I kind of have a similar question. I already own an imac and was wondering if there was any software of any sort that could be used as an equivalent for some of the software I'm using. I will be using bootcamp (already paralleling but not pleased with performance) for my school applications. But I'm hoping to use Leopard as often as possible. Is there ANY engineering programs (3D CAD, modelling, element analysis, stress visualizsers etc.) that I could use? if you don't know of any off hand do you know a place where I could find them?
    And for Porras78, I love my imac. never regretted my decision to buy one for a second even with the compatibility issues with programs that are needed for engineering schooling. Some cool scientific programs out there. and the performance is outstanding. I highly recommend even with the pain of finding niche programs.
    Thanks to all posters,

  • How can I use CWGraph3D for Visual C++,How the Variant operate?

    I have a VC++ project that use CWGraph3D to show data.
    How I use it's method Plot3DCurve(VARIANT& xVector,...)
    what's the VARIANT type.
    How do I use the VARIANT type to do this job?

    Thank you for response this question so soon.
    Because I do not have Measurement Studio for VC++,
    I do not have CNiVector data type.
    Now I have CCWSafeArray from Chris Matthews,
    National Instruments.
    I could use it's contructor and AccessData() method
    to create an array like this:
    double xArray[3]={0,1,2};
    double yArray[3]={0,1,2};
    double zArray[3]={7,8,9};
    double wArray[3]={0,0,0};
    CCWSafeArray xSafeArray(xArray,3);
    CCWSafeArray ySafeArray(yArray,3);
    CCWSafeArray zSafeArray(zArray,3);
    CCWSafeArray wSafeArray(wArray,3);
    m_Graph.Plot3DCurve(xSafeArray,ySafeArray,zSafeArray,wSafeArray);
    It works very well.
    But now I would like to use Plot3DSurface() method.
    I write C++ code like this:
    double xArray[3]={0,1,2};
    double yArray[3]={0,1,2};
    dou
    ble zMatrix[3][3]={{1,2,3},{4,5,6}.{7,8,9}};
    double wMatrix[3][3]={0};
    CCWSafeArray xSafeArray(xArray,3);
    CCWSafeArray ySafeArray(yArray,3);
    CCWSafeArray zSafeArray2D(zArray,3,3);//error line
    CCWSafeArray wSafeArray2D(wArray,3,3);//error line
    m_Graph.Plot3DSurface(xSafeArray,ySafeArray,zSafeArray2D,wSafeArray2D);
    It could not work.Complier tell me:
    error C2664: '__thiscall CCWSafeArray::CCWSafeArray(unsigned short,long,long,long)' : cannot convert parameter 1 from 'double [3][3]' to 'unsigned short'
    I don't know what's wrong.

  • How do you pass an ActiveX Variant from an external application to LabVIEW?

    Background: I created a LabVIEW ActiveX server. I can access it with my external application (Matlab). I have a control variable in my LabVIEW executable. I want to use Active X to set the value of my control variable from my external application.
    Documentation: The only reference in the documentation for this task is in the Using ActiveX with LabVIEW in the LabVIEW 2009 help. It simply says "Use the variant control and indicator to pass data to or from ActiveX controls." I also went through all the ActiveX examples in the example finder and did not find any vis that passed variables using ActiveX.
    Questions:
    What should my control variable look like in LabVIEW? Should it be a refnum, a variant, or a data type? Does it have to be wired to a vi connector?
    Do I need to do any magic on this variable, such as change its properties?
    How do I pass the value from my external application to the variable in my LabVIEW executable?
    Thank you.

    Hello Lyn,
     The control variable should be a refnum and it would have to be wired to Automation Open with the correct reference.
    Here are some great examples of using ActiveX Server in LabVIEW
    LabVIEW Executable Used as ActiveX Server in LabVIEW
    http://decibel.ni.com/content/docs/DOC-9647
     Calling ActiveX Code from LabVIEW
     http://decibel.ni.com/content/docs/DOC-9073
    Andy Chang
    National Instruments
    LabVIEW Control Design and Simulation

  • Labview How to specify 1d array of clusters as data types for variant to data

    Hi, I'm new to labview. Can anyone tell me how to specify 1d array of clusters as data types for variant to data?

    First of all, you should be sure that there is such a data type within the variant; otherwise, you will run into errors.
    I recommend you to create the cluster and create a type definition from it. Then drop an array shell from the array palette and drop the cluster type into that array.
    Connect that constant to the data type input of the Variant To Data function.
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

Maybe you are looking for