使用自定义模板和示例项目开发LabVIEW项目

简介: 使用自定义模板和示例项目开发LabVIEW项目

使用自定义模板和示例项目开发LabVIEW项目


创建项目时,LabVIEW会显示创建项目对话框,以帮助开发人员选择可用作起点的模板或样样例项目。如果要将创建的项目用作自定义模板和示例项目,则须将每个项目的源文件和元数据添加到相应的LabVIEW目录中。然后,开发人员可以使用自定义项目作为开发项目的起点。


选择LabVIEW目录来存储自定义内容


LabVIEW在两个位置搜索要在创建项目对话框中显示的内容。选择最适合希望如何使用自定义内容的位置:


<LabVIEW>\ProjectTemplates—如果具有版本管理的托管代码实用程序(如VI软件包管理器)安装了自定义内容,请使用此位置。


<LabVIEWData>\ProjectTemplates—如果没有对<LabVIEW>目录的写入权限,或者想要为多个LabVIEW版本单源自定义内容,请使用此位置。


注意:LabVIEW对<LabVIEWData>\ProjectTemplates目录中的所有模板和样样项目执行版本检查。如果项目的.lvproj文件保存在LabVIEW的更高版本中的LabVIEW中,则创建项目对话框中会省略该项目。


组织<LabVIEWData>目录


首次将模板和示例项目添加到<LabVIEWData>目录时,必须创建子目录以确保LabVIEW可以找到内容。


完成以下步骤来组织<LabVIEWData>目录:


1.       在<LabVIEWData>下创建项目模板目录。


2.       匹配<LabVIEW>\ProjectTemplates目录的文件层次结构,以便存在以下路径:


<LabVIEWData>\ProjectTemplates\CategoryOverrides


<LabVIEW Data>\ProjectTemplates\MetaData


<LabVIEW Data>\ProjectTemplates\Source


储源文件


源文件由每个自定义模板和示例项目的.lvproj文件、库、VI和支持文件(如图像和文档)组成。


在“ProjectTemplates\Source”目录中为要在“创建项目”对话框中显示的每个项目创建一个子目录,并将每个项目的源文件添加到其各自的子目录中。确保没有子目录包含多个项目的源文件。


注意:


确保您的自定义模板和示例项目不包含任何自动填充文件夹。


确保您的自定义模板和示例项目不包含任何受密码保护的源VI。


确保源.lvproj中引用的所有文件都包含在其各自的子目录中。当开发人员尝试使用“创建项目”对话框创建模板或示例项目的实例时,缺少项目文件可能会导致问题。


创建和存储元数据


元数据定义“创建项目”对话框中显示的内容。LabVIEW可识别XML格式的元数据。XML文件可以包含一个或多个项目的元数据。


完成以下步骤以创建和存储自定义项目的元数据:


1.       创建一个XML文件并添加<元数据>标记。此标记包含所有元数据。


2.       为要在“创建项目”对话框中显示的每个项目添加<ProjectTemplate>标记。此标记包含每个项目的元数据。


3.       使用以下标记定义每个模板或示例项目。该表的“示例项目”列列出了使用每个XML标记的项目。请参阅<LabVIEW>\ProjectTemplates\MetaData\NILV_Core_TemplateMetaData.xml中的文件,了解如何定义现有模板和示例项目的元数据。


aa32083257f4dcf971cf81daf30750b7.png



原文内容如下


UsingCustom Templates and Sample Projects to Develop LabVIEW Projects


Whenyou create a project, LabVIEW displays the Create Project dialogbox to help you select a template or sample project you can use as a startingpoint. If you want to use projects you create as custom templates and sampleprojects, you must add source files and meta data for each project to thecorresponding LabVIEW directories. Then, users can use the custom projects asstarting points to develop their projects. In addition to this document, referto the \ProjectTemplates directory to see how source files, meta data, andcategory overrides are stored for existing templates and sample projects. Usethese files as examples of how to create and store files for custom templatesand sample projects.


Selecting a LabVIEW Directory to StoreCustom Content

LabVIEWsearches for content to display in the Create Project dialogbox in two locations. Select the location that best suits how you want to usethe custom content:


§  <LabVIEW>\ProjectTemplates—Usethis location if a managed code utility with version management, such the VIPackage Manager, installs the custom content.


§  <LabVIEWData>\ProjectTemplates—Use this location if you donot have write access to the <LabVIEW> directory, or if you want to single-source the customcontent for multiple LabVIEW versions.


Note: LabVIEW performs a version check on all templates andsample projects in the <LabVIEWData>\ProjectTemplates directory. If the .lvproj filefor a project is saved in a later version of LabVIEW than the version currentlyrunning, the project is omitted from the Create Project dialogbox.

Organizing the <LabVIEW Data>Directory


Whenyou add templates and sample projects to the <LabVIEW Data> directory for the first time, you must createsubdirectories to ensure that LabVIEW can find the content.


Completethe following steps to organize the <LabVIEWData> directory:


1.     Create the ProjectTemplates directory under <LabVIEWData>.


2.     Match the file hierarchy of the <LabVIEW>\ProjectTemplates directory such that the following paths exist:


§  <LabVIEWData>\ProjectTemplates\CategoryOverrides


§  <LabVIEWData>\ProjectTemplates\MetaData


§  <LabVIEWData>\ProjectTemplates\Source


Storing Source Files

Sourcefiles consist of the .lvproj file, libraries, VIs, and support files, such as imagesand documentation, for each custom template and sample project.


Create a subdirectory in the ProjectTemplates\Source directory for each project you want to display in the CreateProject dialog box and add the source files for eachproject to their respective subdirectories. Ensure that no subdirectorycontains source files for multiple projects.


Notes:


§  Ensure that your custom templates and sample projects do notcontain any auto-populating folders.


§  Ensure that your custom templates and sample projects do notcontain any source VIs that are password-protected.


§  Make sure that all the files referenced in your source .lvproj areincluded in their respective subdirectories. Missing project files can causeproblems when developers attempt to use the Create Project dialogbox to create an instance of your template or sample project.


Creating and Storing Meta Data

Metadata defines the content that appears in the Create Project dialogbox. LabVIEW recognizes meta data in XML format. An XML file can contain metadata for one or more projects.


Completethe following steps to create and store meta data for custom projects:


1.     Create an XML file and add the <MetaData> tag. This tag encloses all meta data.


2.     Add a <ProjectTemplate> tag for each project you want to display in the CreateProject dialog box. This tag encloses meta data for eachproject.


3.     Use the following tags to define each template or sampleproject. The Example Project columnof the table lists projects that use each XML tag. Refer to the file located at <LabVIEW>\ProjectTemplates\MetaData\NILV_Core_TemplateMetaData.xml to see how the meta data for existing templates and sampleprojects is defined.


image.png

image.png


4.     Store the XML file in the ProjectTemplates\MetaData directory.


Overriding the Sorting Order forFilters

Theleft pane of the first page of the Create Project dialogbox lists all the filters you specify in the meta data XML file. By default,LabVIEW lists filters you create in alphabetical order.


Completethe following steps to override the default sorting order for the filter list:


1.     Create an XML file and add the <CategoryOverrides> tag. This tag encloses all category override data.


2.     Add a <Category> tag for each filter for which you want to specify customsorting behavior. This tag encloses the name and sorting priority of eachfilter.


3.     For each filter, create a <Name> tag and set the value to the name of the filter you usedin the meta data XML file.


4.     For each filter, create a <Priority> tag and set the value according to the behavior you want.


The value of this tag is an index number, so a value of 0 places the filter atthe top of the list. Any parent filter for which you specify a value less than100 appears above the default parent filters, such as Templates and SampleProjects. If you specify a value for any child filter, the filter appears abovethe default child filters, such as Desktop.


5.     Store the XML file in the ProjectTemplates\CategoryOverrides directory.


需要说明的是,上述的例程和文档,都是可以下载的,双击即可打开,其中压缩文件是可以采用粘贴复制的方式,拷贝到硬盘上。这不是图片,各位小伙伴看到后尝试一下,这个问题就不用加微信咨询了。有关LabVIEW编程、LabVIEW开发等相关项目,可联系们。附件中的资料这里无法上传,可去公司网站搜索下载。

相关文章
|
20天前
|
开发者 iOS开发
【教程】修改应用程序开发者名称的步骤
【教程】修改应用程序开发者名称的步骤
|
20天前
|
JavaScript Java
若依框架 - - - 自定义打印模版
若依框架 - - - 自定义打印模版
193 0
若依框架 - - - 自定义打印模版
|
20天前
|
XML 存储 文件存储
LabVIEW使用自定义模板和示例项目来开发LabVIEW项目
LabVIEW使用自定义模板和示例项目来开发LabVIEW项目
13 0
|
20天前
|
JavaScript 前端开发
若依 自定义实现导入功能
若依 自定义实现导入功能
50 1
|
12月前
tkintertools 模块实战一:任务清单小工具
tkintertools 模块实战一:任务清单小工具
83 0
|
C# 图形学
Unity之C#高级开发①
Unity之C#高级开发①
Unity之C#高级开发①
|
数据处理 C#
基于C#的ArcEngine二次开发39:GP工具的使用--界面、参数及示例代码
基于C#的ArcEngine二次开发39:GP工具的使用--界面、参数及示例代码
基于C#的ArcEngine二次开发39:GP工具的使用--界面、参数及示例代码
libzip开发笔记(一):libzip库介绍、编译和工程模板
libzip开发笔记(一):libzip库介绍、编译和工程模板
libzip开发笔记(一):libzip库介绍、编译和工程模板
|
小程序 API 数据安全/隐私保护
小程序模板及插件开发应用
本节对小程序模板和插件开发以及会涉及到的场景做了介绍。
小程序模板及插件开发应用
项目编写时的注意事项
标签(空格分隔): 个人总结 最近学了很多知识点,也通过几个作业、项目将这些知识点串联在一起,相互协作完成一个程序丰富的功能。 在写项目的时候,最大的困难是没有一个很好的编写流程。虽然对于项目的每一个功能都可以单独的分析并提出解决方法和思路,也可以写出对应的知识点来完成此功能。