Jump to content

bjustice

Members
  • Posts

    152
  • Joined

  • Last visited

  • Days Won

    10

Posts posted by bjustice

  1. Hi Hooovahh!

    I think I found something that could be considered a bug?

    I saw that a sort option was added to the remove 1D duplicates VI.

    It looks like the old version of this VI was left in the package.  (Presumably to protect backwards compatibility)

    However, something must have happened, and I'm seeing that the connector pane on the old version of the VI got rotated.

    image.png.9695da372702d2361d548db4f1a780d6.png

  2. 7 hours ago, Rolf Kalbermatter said:

    It may be not as fast as MoveBlock but has been fast enough so far for me

    Via the afformentioned benchmark test, the unflatten from string method is on-par with the "To String/Typecast" method.
    My VIM is still beating those noticeably for little endian operations.
    So, I'm going to try using my VIM for a project and I'll see how that goes.

    image.png.bc94947a8664e741bb3a8607db4d9cc5.png

     

  3. In THIS THREAD, Rolf suggested that the TypeCast primitive should have an endianness selector.
    So, I took the code that I created above and slapped a byte order input on it!
    Of course, this isn't as flexible as the real primitive.  But this fills a wide use-case from a project that I'm working on.
    image.png.19a9d28a28799f524eb6c165fd07fa72.png

     

    Why is this interesting to me?:
    On more than one occasion now, I've run into situations where I have to receive a stream of bytes at high rate over the network, and TypeCast these into LabVIEW numerics.
    and usually when this happens, I'm getting those bytes sent to me in little-endian order.  Because that's what dominates the industry these days it seems.
    I use the TypeCast primitive to convert the byte stream into numerics, but this means that I have to reverse array order before handing the data over to TypeCast.
    And then, depressingly, TypeCast performs another set of byte swapping against the data.
    So, I was hoping to remove all the byte swap operations with this VIM.

    I plugged my VIM into the benchmark tester, and the results seem to make really good sense to me:

    image.png.c9070de9a3492fc66381b4975d92ff96.png

    1 = My VIM with "Big Endian" input      --> My VIM must perform array reversing; this makes it slower than all other methods thus far.
    2 = My VIM with "Little Endian" input   --> My VIM does not have to perform array reversing;  This makes it almost as fast as MoveBlock with preallocation.

    Would love to know what you guys think

    TypeCast.zip

  4. Ok, I made a VI that emulates the TypeCast primitive with a few notable differences:

    • Uses the MoveBlock command to perform the memory copy
    • Input "x" restricted to u8 byte array type.  (Common use-case)
    • input "type" restricted to scalar or 1D numeric types.  (Common use-case)
    • Assumes platform endianness = Little Endian.  (Valid due to above convos)

    What's cool about this is that it gives me control over whether or not I want to perform the endianness conversion.
    (You can see that I use the reverse 1D array primitives to handle this.)
    If your byte array is already little-endian ordered, then you can remove the reverse 1D array functions and reclaim that performance.

    image.png.9f86135ac0b87a9b635bd4d99280a2e2.png

    TypeCast using MoveBlock.vim

  5. On 9/29/2022 at 1:18 AM, Rolf Kalbermatter said:

    If LabVIEW ever gets a Big Endian platform again

    Revisiting this thread for a new project.
    (Rolf, your posts here have been very educational.)

    A bit of an academic question here (I'm mostly trying to make sure that I understand how this all works):
    1) Are there any primitives in LabVIEW that would return the endianness of the platform?  (I supposed this would be absurdly boring if LabVIEW only ships on little-endian platforms at the moment.)

    2) If this primitive existed, could I theoretically use this in conjunction with the MoveBlock command to replicate the behavior of the TypeCast primitive?
    My understanding:

    IF platform endianness = big endian, then perform memory copy without byte swaps
    IF platform endianness = little endian, then perform memory copy with byte swaps


     

  6. 2 hours ago, Zou said:

    You can get a semi-circle from the Classic Tank.

     

    I had no idea what you were suggesting here until it clicked for me.

    The semi-circle decoration that daddreamer found apprears to be the exact same decoration used on the classic tank control.
    If you edit the classic tank control, then you are able to copy/paste the semi-circle onto your front panel and it then becomes a color-able decoration.
    I wasn't aware that it was possible to "steal" decorations from control like that.  Neat

    image.png.a290a417fb2fead51abc5cb2472cc92f.png

  7. yarr, thanks for looking.  Appreciated.

    I recognize that I could probably just go and do things in a proper photoshop editor like GIMP, but sometimes it's just easier to make quick little custom graphics in LabVIEW using LabVIEW decorations.  The decorations are then easy to color and tweak without having to go back into photoshop editor.  However, even having something as simple as right angle triangles or half/semi-circles would go a long way towards making so much easier to make more complex looking-things in LabVIEW with decorations.  So, if anyone has happened to figure out how to make those types of decorations, I'd be pretty stoked.

    For reference, here's a fun example of a thing that I made in LabVIEW using only decorations.
    I ran into 2 major frustrations:
    - Lack of right angle triangles means that you have to get tricky with squares and normal triangles to get the same effect
    - Lack of semi-circles means that I had to use a full-circle for the mouse, and then overlap it with a black square.  


    image.png.651ee3dfd4ad6b058a10c72504241964.png

    you can see that it was a bit convoluted and annoying to make the little key icons without right angle triangles:
    image.png.0ac4bd8c9ac0e56c40e223948a978e38.png

    image.png

    decoration fun.vi

  8. Thanks Hooovahh!

    I don't have time to turn this into a polished Qcontrol or anything like that at the moment.

    However, I did make a small improvement to the code:
    You can now use the horizontal and vertical table scrollbars, and the rotated header will update accordingly.

    related note: I discovered that ActiveCellPosLeft will return a 0 if the active cell is not visible.  That's so lame.
    Fortunately, it's still possible to calculate offscreen CellPos by reading cell width (which apparently still works for offscreen cells), and then doing math from the nearest visible cell's position.

    image.png.7df1e53987de807a25c65ccce2affa6b.png

    RotatedColumnHeader_scrollbar.zip

    • Like 2
  9. I ran into a situation where I really needed a rotated column header for a table due to having long column header names and not enough space.

    After doing a bunch of looking around, it didn't really seem like this capability existed anywhere for LabVIEW, so I'm sharing a little piece of code that I created for this here.

    LabVIEW doesn't natively support rotated strings, so that wasn't an option.
    LabVIEW 2D picture controls would theoretically let you write, and then rotate text.  But LabVIEW 2D picture controls don't support aliasing, so I didn't perceive this to be an option.
    @hooovahh recently posted a fun .NET picture control library to VIPM, and that inspired me to go down the .NET picture control rabbit hole.
    Having to deal with opening and closing all the .NET references is a bit of a hassle, but I'm surprised by how much capability exists with the .NET picture control.  High complexity ceiling.
    Looking back, I wonder if I should have tried the LabVIEW 3D picture control instead.

    Anyways, this demo provides the following capability:
    - rotated column headers by specified angle
    - anti-aliased text
    - column headers size to table column width/positions

    image.png.d6e8cc8fbf555a2aa207c1f7a98b8b10.png

    RotatedColumnHeader.zip

    • Like 2
  10. oh wow, I had not even considered using a flat box with a transparent border.  That does indeed create a 3 pixel, non-aliased line.  It's a bit clunkier than I would like, but it does get me exactly what I need with respect to creating something that is effectively equivalent to the pre-2021 thick line.

    That unblocks me for now.  I might contact NI though and make a bit of a fuss.  Maybe they can add a thick line back into LabVIEW on a hidden palette without aliasing.  grumble grumble

  11. This is a cross-post from the darkside:

    https://forums.ni.com/t5/LabVIEW/LV-2021-thick-line-decoration-changed/m-p/4280737

    After a month, I didn't get any hits there though, so reposting here in hopes that someone might have insight.

    In LabVIEW 2021, the thick line decoration changed to include aliasing.  This is a total bummer for me.  I use this line for drawing fluid lines, and the aliasing makes the fluid lines fuzzy, which is not a desire for me.

    If anyone here might have any idea how to create or get back a 3-pixel width line without aliasing, you would be my friend.

    image.png.26048fbbc9ac1bcfc29546a2cd000d0d.png

     

  12. On 7/22/2020 at 6:00 AM, hooovahh said:

    I also was a bit frustrated by this some times.  So attached is a demo of some panel movement code.  It has a few main functions. 

    The first is sometimes I'd have a dialog I wanted to pop up, but I wanted it to be centered on whatever monitor the mouse was on.  My thought was that this was the monitor the user was using, and they probably just clicked something, so put it there. 

    I also had times that I would pop up a dialog under the mouse and so I wanted the panel to be centered on the mouse as best it can, but stay on the same monitor.  This doesn't always work well with taskbars that can be hidden, and size and position not being consistent but it mostly works.

    And lastly I sometimes had a need to set a panel to maximize on a specific monitor.  We typically would have 2 or 3 set side by side in the system.  So this VI can set a panel to maximize on the "Primary", "Left", "Right", "Second from Left" or a few others.

    As you noticed this won't fix LabVIEW native dialogs, and any solution I can think of for those will be a bit hacky.

    Panel Movement Center Maximize Demo.zip 97.17 kB · 35 downloads

    @hooovahh I find myself using this code for so many things that I do.

    I feel like it makes sense to build this into a little VIPM package.  (Especially since I'm about to release a package to VIPM that uses this code.)

    If I were to turn this into a VIP, is there an appropriate way for me to credit you?

  13. Oh wow, Zou is right, you can copy item parts to clipboard, and then paste these item parts over other item parts.  This seems to carry more than just a static image - this carries the item part type and properties.

    I'll keep poking at it with this new information, thanks.

     I really wish LabVIEW had a more full-featured custom control editor.

  14. Here, I made a demo illustrating what I'm trying to accomplish.  It's kinda cool:

    image.png.2166fc8e75c0aa4aa7f62550477ffaa9.png

    Note how I've been able to create a button using custom (rectangular) images, but I still have an oval click area.  That way, clicking the corners does nothing.  Which is good!

    The only thing missing: This demo button only has 4 item-parts.  I really wish I could get a control with this behavior, but also with 6 item parts.  (So that I can import custom images for the mouse over states.)

    demo round custom button.vi

  15. The DMC GUI Suite has buttons that have:

    1) "Boolean Button" --> 6 part items

    2) "Boolean Light" --> 4 part items

    I can't seem to figure out how they were able to make this combination, because I can't find any control on the native palette with these item parts.

    image.png.38496159954190ffca46f847fbce7160.png

     

    For what it's worth, I'm really hoping to be able to create a custom button that has a circular click-radius, but also allows for me to important custom pictures for all 6 boolean states.

    Importing custom pictures into a NxG or System button control is easy to get work.

    What's slightly more difficult is that I'm hoping to be able to use a transparent "Boolean glyph" item part as the thing that dictates the click-bounds.  That way the button doesn't appear as a circular image, with a square click bound.

    I recognize that there are lots of workarounds here, but I'm sorta just hoping that maybe there is some way to create the control with the item parts that I desire.  This DMC button is sooooo close to being exactly what I need.

  16. Request: A button that has the "parts":

    1) Boolean Button --> round shape with 6 part items

    2) Boolean Glyph --> must also have 6 part items

     

    For example, the standard LED is close to what I want, but it only has 4 item states, so there is no 5/6th states for hover-over value.

    image.png.ed5be03ce0aaf843f020720268f7bcf5.png

     

    Taking this a bit further:
    The NxG buttons all have 6 item parts.  However, the NxG buttons don't have a "Boolean Glyph" item part.

    So, naturally, I would like to understand: am I able to "import" the "boolean glyph" item part from the LED into a NxG button control?

     

    All of the forum posts that I've found thus far only document how to add decorations, or how to modify existing item parts in a control.  There is no documentation on how to actually add item parts to a control... which I suspect is sorta getting into a layer of code not exposed to me.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.