LabVIEW Shortcut Menu Plug-Ins

cancel
Showing results for 
Search instead for 
Did you mean: 

Create Icon from VI Name.llb

Author: haobo.li

Overview

A LabVIEW 2015 PopupMenus Plugin - Create Icon from VI Name

Description

From LabVIEW 2012 and later, if you set "Control Panel\Clock, Language, and Region\Region\Formats" as "Chinese(Simplified, China)",  fonts display in LabVIEW will be broken. Such as "small Fonts" in Icon Editor won't display Clearly. To work around this bug or "feature" ,you can just increase fonts bigger than 12 points, or change formats back to "English(US)".

But Some Application as IBM Notes Chinese Version require Formats set to "Chinese" to work well. So I write a LabVIEW plugin called "Create Icon from VI Name".

How to work:

  1. Put "Create Icon from VI Name.llb" in "\Documents\LabVIEW Data\PopupMenus\edit time panel and diagram".
  2. Right click SubVI and Select "Create Icon from VI Name", and the Icon will change to its name.

Warning:  This Plugin will try to SAVE the SubVI you select!

Hope this Plugin would be any help.

Any suggest would be welcome ,fell free to contact me at Mail@haobo.li

--------------------------------------------------------------------------------

LabVIEW 2012之后的版本一直有在中文系统里,字体显示模糊的bug,而且看起来是准备当作feature流传下去了。

在创建图标时,图标编辑器可以设置成12号字然后正好输四个汉字就可以规避这个问题。不过输入英文就不太方便了,因为只能显示大约6个字符。

所以我做了一个LabVIEW 2015的右键插件,可以从文件名自动产生图标,最多显示5735个英文字符或者数字。

使用方法:

  1. "Create Icon from VI Name.llb" 放到 "\Documents\LabVIEW Data\PopupMenus\edit time panel and diagram".
  2. 右键子VI选择 "Create Icon from VI Name",图标会变成VI名字。

注意:这个插件会尝试保存这个子VI

欢迎提出宝贵意见,我的邮箱:mail@haobo.li

Source Code

https://github.com/lhb5883/LabVIEW/tree/master/Create%20Icon%20from%20VI%20Name


Steps to Implement or Execute Code

  1. Put "Create Icon from VI Name.llb" in "\Documents\LabVIEW Data\PopupMenus\edit time panel and diagram".
  2. Right click SubVI and Select "Create Icon from VI Name", and the Icon will change to its name.

Requirements

Software

LabVIEW 2015 and later

Hardware

Additional Images or Video

Before:

Before.png

After:

After.png

Updated In 2015/08/12

Add Create Icon Tools for LabVIEW 2009 and later.

How to work:

  1. Put "Create Icon.llb" in "LabVIEW\Project" folder.Restart LabVIEW.
  2. Open the VI then select "Create Icon..."in Tools Menu. Icon Will be Create and autosave.

增加了工具栏版本,LabVIEW 2009以后均可使用:

  1. 把 Create Icon.llb 放到 LabVIEW安装目录的Porject目录里,重启LabVIEW。
  2. 打开要改图标的VI,然后到工具菜单里面选择 Create Icon... 图标即会自动创建。


 


 


CLA & CLED

Download All
Comments
crossrulz
Knight of NI Knight of NI
Knight of NI
on

There is a community specifically for these here: https://decibel.ni.com/content/groups/labview-shortcut-menu-plug-ins

You should post this there.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
AristosQueue (NI)
NI Employee (retired)
on

Why is this a right-click on the subVI node? Why didn't you write this tool and put it in the Tools menu as an edit to the VI you're currently working on? Having popup menu items to edit the VI that you're calling is very odd behavior -- popup menu items should edit the item you're popping up on, not its related thing.

lhb5883
Member
Member
on

That's sounds a good idea! Thanks!

I will Post In there later

--------------------------------------

Finished!

 


 


CLA & CLED

lhb5883
Member
Member
on

That's a good idea!

In this way , this Plugin could work for previous Version LabVIEW.

In LabVIEW 2015,This Plugin will create icons for Multiple SubVIs once you select, it should be a little convenient in my opinion .

 


 


CLA & CLED

tst
Knight of NI Knight of NI
Knight of NI
on

I didn't look at the code, but looking at the images, I see that you have 5 rows of text, which I assume means you're generating the text yourself. Would it be possible to use the icon editor API to set the text in the same way that the icon editor does, so that people can later go into the editor and change it, or will that not work with the font limitations you talk about and that should be a separate plugin?

AQ, I agree that invoking this on a subVI is weird (although I understand the multiple-subVIs at once arguments), but putting it in the tools menu makes it less accessible. It would be nice if this could be a right click on the icon, but the menu doesn't let us do that. With the JKI RCF, there was a loose convention where actions on VI are added to the menu if the menu is invoked on the FP with no objects selected, but I'm not sure if the current API allows that. Maybe if it does, both methods could be used to access the plugin.


___________________
Try to take over the world!
lhb5883
Member
Member
on

Yes, I generate the Text myself to aviod the fonts issue.You can see the detail in my github source code:I use Fonts.vi to import bmp to LabVIEW pixmap data, then use it to Convert Strings to pixmapdata.

It's GREAT IDEA to Set the New Icon to a new Icon Layer.Thank Very Much! I will work on the icon editor API.

 


 


CLA & CLED

Hooovahh
Proven Zealot Proven Zealot
Proven Zealot
on

AQ you said something that I'd like more of an opinion on

AristosQueue wrote:


                       

Having popup menu items to edit the VI that you're calling is very odd behavior -- popup menu items should edit the item you're popping up on, not its related thing.


                   

I don't see this as being that odd of a thing to do.  Are you saying that you don't suggest making plugins, that modify a subVI that is called?  One application I'm sorta in the middle of would allows to edit a subVI based on a right click menu, or optionally create a new copy of that VI to be saved somewhere, and then edit that copy.

Hopefully I'll have an example of my code and show how I can see a use for this soon.

AristosQueue (NI)
NI Employee (retired)
on

Brian Hoover wrote:

> One application I'm sorta in the middle of would allows to edit a subVI based on a right click

> menu, or optionally create a new copy of that VI to be saved somewhere, and then edit

> that copy.

Various usability guidelines exist to make sure that right-click menus have the scope that a user expects them to have. In most cases, we interpret this for LabVIEW as meaning the right-click menus should only modify the thing you clicked on, not modify a thing referenced by the thing you clicked on. A right click can open the thing that is referenced so that you can modify it there, but not make the edit directly.

A right-click that says "clone the VI and replace THIS CALL to the VI with the new clone" would be an approrpriate use of the right click because you aren't changing any of the other call locations for this VI -- it is a localized edit. A right-click that said "make this subVI reentrant" would be an inappropriate use of the right click because it affects all callers everywhere. Even if you know that the scope is all callers everywhere, it is reasonable for a user to expect that the popup somehow makes just this one call reentrant.

Yours, Brian, sounds like a gray area. lhb5883's plug-in is clearly in the wrong. It places functionality for editing the VI at the call site instead of within the VI being edited.

Now, having said that, if you want to write such a plug-in, go for it -- it's your environment and you know how it works. But that's not the same as having a good plug-in to promote to the community. If this were proposed to ship with LV, I'd nix it on usability grounds.

Hooovahh
Proven Zealot Proven Zealot
Proven Zealot
on

Thanks for the explanation, as you probably already know (because I'm guessing you get emails when replies are in this community) I was referencing this plugin.  I did wonder how things like undo would be handled if the code to be undone, was code generated not from that VI.  Admitedly I never tested that.

Oh and this plugin is a little harmless right?  I mean I realize there could be issues but editing an icon?  It isn't editing the code in the VI that is called in multiple places.  I agree on principal, and I never expect to see this shipped with LabVIEW, but I'm not sure I care too much.

AristosQueue (NI)
NI Employee (retired)
on

Brian Hoover wrote:

Oh and this plugin is a little harmless right?

Well, kind of. You point out "undo" -- even if the plug-in does its own transaction management (and I hope that it is doing so), if a user picks this menu item, edits the icon, and then decides they don't like the new icon, hitting ctrl+z will undo... something unrelated on their diagram! But it won't undo the icon change. That's fairly bad behavior. It isn't a transaction on the local document, so you have to go to the other document to undo it.

lhb5883
Member
Member
on

Thanks for your advice!

It seems that I shouldn't to auto save the SubVI. Lost VI undo ability is worse than lost of the auto creatable Icons. It annoy my self sometimes

If I Open the SubVI first , then change the VI icon would be better? Should I add dialog to Confirm It?It seems that It is suit to create a “icon manager” in Tools Menu instead a right click menu,Isn't it?I totally agree with you.

I will try this possibility later,it is a lot work to do with this plugin.

 


 


CLA & CLED

AristosQueue (NI)
NI Employee (retired)
on

> If I Open the SubVI first , then change the VI icon would be better?

It would definitely make it _better_ but still not good, in my opinion. As I said, I would not put it in the right-click menus at all. I would just put this in the Tools menu of the VI to edit that VI. So the sequence is "double click on the subVI to open it, then go to Tools >> Autoset Icon Using Name" or something like that.

Your "Execute" VI is basically the exact VI that would be needed in the Tools menu, except you have to get the VI refnum using the Active VI property (I think that's its name... you'll have to double check) instead of having it passed in to you.

Darren
Proven Zealot
Proven Zealot
on

AristosQueue wrote:


                       

...you have to get the VI refnum using the Active VI property (I think that's its name... you'll have to double check) instead of having it passed in to you.


                   

For any utility VI launched from the Tools menu, make sure you call this subVI as the first thing on your diagram:

vi.lib\VIServer\Menu Launch VI Information.vi

It will give you the Application Instance and VI Name of the VI from which the Tools menu VI was launched.

Contributors