Jump to content

Code Capture Tool

From LabVIEW Wiki
Revision as of 15:47, 17 February 2008 by Tcplomp (talk | contribs)

Code Capture Tool

A video with a demo of the tool can be found here.

Introduction

The Code Capture Tool (or CCT) is a LabVIEW development tool targeted at LabVIEW users to capture images of their code and make it easier to share those images in online forums.

The CCT is based on an idea and earlier versions originally released by Chilly Charly on the NI Forums as starware.
Later, it evolved to a multiple OS and LabVIEW versions tool for creating code-shots and documentation shots.
A collaboration between Yen and Ton Plomp resulted in the 0.9.1 version of the CCT that is currently available through the LAVA CR at this site.

Interface

The CCT offers two interfaces to make and distribute images of LabVIEW code - a user interface and an API.

GUI

The user interface of the CCT allows the user to select which parts of a Front_Panel or Block_Diagram should be captured. The resulting image will be stored on disc and optionally the image or the path can be copied to the OS clipboard.

Code Capture Tool user interface

Front panel settings

The Front Panel listbox supplies the following options:

Listbox Item Captured parts
None Nothing
Selected All selected parts and items in between
Visible Everything visible in the current panel view
All Everything on the front panel

Block diagram settings

The Block Diagram listbox supplies the following options:

Listbox Item Captured parts
None Nothing
Selected All selected parts and items in between
Visible Everything visible in the current block diagram view
All Everything on the block diagram

Clipboard settings

The clipboard listbox supplies the following options:

Listbox Item Copied item Remarks
None Nothing
Path Path of the captured image
Image The captured image Only on Windows

Layout settings

The Layout picture ring supplies the following layout options:

Menu Ring Item Description
Front panel in top, block diagram below
Block diagram in top, front panel below
Front panel in left, block diagram on the right
Block diagram in left, front panel on the right

File settings

The file settings consists of two controls, the string control to name the file (a .png extension is added to the name automatically) and a browse button to set the folder where the file should be stored. To detect which folder is currently used hover over one of the two controls and the tip-strip will show the folder.

Resetting the folder

By default the storage folder is the LabVIEW temp folder (which by default is the same as the OS temp folder), and can be changed with the browse for folder button. To revert to the temp folder use this button .

Zoom function

The zoom slider allows the user to zoom in and out on the captured image and inspect it in detail. This only affects the preview image and will not change the stored image.

Help

The help button calls the about window of the CCT including a short description of the main functions, a link to the webpage, a list of know issues and licensing info.

Capture

The capture button will capture the image, save it, copy to the clipboard, save the currently selected options for the next time and close the window. This can also be done by pressing Enter.

Key navigation

The CCT has several key shortcuts for easier access:

Key Function
Enter Applies the current settings and does a capture
F1 Loads the about window centered on the help tab
Escape Closes the CCT without performing a capture

API

The API provides an interface to the various functions of the CCT. Its palette is accessible under user.lib\Code Capture Tool.

Methods <linkedimage>

img_src=Image:CCT_GetSessions.png wikipage=Code_Capture_Tool#Create_CCT_Instance </linkedimage>

<linkedimage>

img_src=Image:CCT_Capture_icon.png wikipage=Code_Capture_Tool#Capture_Image </linkedimage>

<linkedimage>

img_src=Image:CCT_SaveImage.png wikipage=Code_Capture_Tool#Save_Image </linkedimage>

<linkedimage>

img_src=Image:CCT_CopyToClipboard.png wikipage=Code_Capture_Tool#Copy_to_Clipboard </linkedimage>

<linkedimage>

img_src=Image:CCT_CloseSession.png wikipage=Code_Capture_Tool#Destroy_CCT_Instance </linkedimage>

<linkedimage>

img_src=Image:CCT_GenerateFileName.png wikipage=Code_Capture_Tool#Generate_File_Name </linkedimage>

Set properties <linkedimage>

img_src=Image:CCT_SetFP.png wikipage=Code_Capture_Tool#Set_Front_Panel_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_SetBD.png wikipage=Code_Capture_Tool#Set_Block_Diagram_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_SetLayout.png wikipage=Code_Capture_Tool#Set_Layout_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_SetClipboard.png wikipage=Code_Capture_Tool#Set_Clipboard_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_SetVI.png wikipage=Code_Capture_Tool#Set_VI_Ref </linkedimage>

<linkedimage>

img_src=Image:CCT_SetFolder.png wikipage=Code_Capture_Tool#Set_Folder </linkedimage>

<linkedimage>

img_src=Image:CCT_SetFileName.png wikipage=Code_Capture_Tool#Set_Filename </linkedimage>

Get properties <linkedimage>

img_src=Image:CCT_GetFP.png wikipage=Code_Capture_Tool#Get_Front_Panel_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_GetBD.png wikipage=Code_Capture_Tool#Get_Block_Diagram_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_GetLayout.png wikipage=Code_Capture_Tool#Get_Layout_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_GetClipboard.png wikipage=Code_Capture_Tool#Get_Clipboard_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_GetVI.png wikipage=Code_Capture_Tool#Get_VI_Ref </linkedimage>

<linkedimage>

img_src=Image:CCT_GetFolder.png wikipage=Code_Capture_Tool#Get_Folder </linkedimage>

<linkedimage>

img_src=Image:CCT_GetFileName.png wikipage=Code_Capture_Tool#Get_Filename </linkedimage>

Support <linkedimage>

img_src=Image:CCT_Support.png wikipage=Code_Capture_Tool#Support </linkedimage>

<linkedimage>

img_src=Image:CCT_CaptureFP.png wikipage=Code_Capture_Tool#Capture_Front_panel </linkedimage>

<linkedimage>

img_src=Image:CCT_CaptureBD.png wikipage=Code_Capture_Tool#Capture_Block_diagram </linkedimage>

<linkedimage>

img_src=Image:CCT_ShowGUI.png wikipage=Code_Capture_Tool#Show_CCT_GUI </linkedimage>

<linkedimage>

img_src=Image:CCT_70Container.png wikipage=Code_Capture_Tool#7.0_container_VI </linkedimage>

<linkedimage>

img_src=Image:CCT_80_Container.png wikipage=Code_Capture_Tool#8.0_container_VI </linkedimage>

Methods

Methods <linkedimage>

img_src=Image:CCT_GetSessions.png wikipage=Code_Capture_Tool#Create_CCT_Instance </linkedimage>

<linkedimage>

img_src=Image:CCT_Capture_icon.png wikipage=Code_Capture_Tool#Capture_Image </linkedimage>

<linkedimage>

img_src=Image:CCT_SaveImage.png wikipage=Code_Capture_Tool#Save_Image </linkedimage>

<linkedimage>

img_src=Image:CCT_CopyToClipboard.png wikipage=Code_Capture_Tool#Copy_to_Clipboard </linkedimage>

<linkedimage>

img_src=Image:CCT_CloseSession.png wikipage=Code_Capture_Tool#Destroy_CCT_Instance </linkedimage>

<linkedimage>

img_src=Image:CCT_GenerateFileName.png wikipage=Code_Capture_Tool#Generate_File_Name </linkedimage>

These VIs are used to activate methods for the CCT.

Create CCT Instance

Creat CCT Instance

This VI must be called for every instance of the CCT, it creates a GOOP dataspace that will contain the data of the instance. Calling this VI must be done with a valid VI reference.

Capture Image

Capture Images

This VI will apply the current settings and store the captured image in the CCT instance, additionally it returns the image itself.

Save Image

Save Image

This VI will save the image to the path specified by a folder and filename stored in the CCT instance.

Copy to Clipboard

Copy to Clipboard

This VI will store the data specified by the clipboard settings to the clipboard.

Destroy CCT Instance

Destroy CCT Instance

This VI must be called to close the CCT Instance and will free up used memory resources.

Generate File Name

Generate filename

This VI will generate a default filename based on the captured parts and VI name. This filename will not be stored inside the CCT session.

Set properties

Set properties <linkedimage>

img_src=Image:CCT_SetFP.png wikipage=Code_Capture_Tool#Set_Front_Panel_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_SetBD.png wikipage=Code_Capture_Tool#Set_Block_Diagram_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_SetLayout.png wikipage=Code_Capture_Tool#Set_Layout_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_SetClipboard.png wikipage=Code_Capture_Tool#Set_Clipboard_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_SetVI.png wikipage=Code_Capture_Tool#Set_VI_Ref </linkedimage>

<linkedimage>

img_src=Image:CCT_SetFolder.png wikipage=Code_Capture_Tool#Set_Folder </linkedimage>

<linkedimage>

img_src=Image:CCT_SetFileName.png wikipage=Code_Capture_Tool#Set_Filename </linkedimage>

These VIs are used to change properties for the CCT instance.

Set Front Panel Mode

Set FP mode

This VI will change the current front panel capture mode.

Set Block Diagram Mode

Set BD mode

This VI will change the current block diagram capture mode.

Set Layout Mode

Set Layout mode

This VI will change the current layout orientation.

Set Clipboard Mode

Set Clipboard mode

This VI will change the current clipboard mode.

Set VI Ref

Set Clipboard mode

This VI sets the reference of the VI that needs to be captured

Set Folder

Set Folder

This VI will change the folder where the images will be saved.

Set Filename

Set Filename

This VI will change the filename of the stored image.

Get properties

Get properties <linkedimage>

img_src=Image:CCT_GetFP.png wikipage=Code_Capture_Tool#Get_Front_Panel_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_GetBD.png wikipage=Code_Capture_Tool#Get_Block_Diagram_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_GetLayout.png wikipage=Code_Capture_Tool#Get_Layout_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_GetClipboard.png wikipage=Code_Capture_Tool#Get_Clipboard_Mode </linkedimage>

<linkedimage>

img_src=Image:CCT_GetVI.png wikipage=Code_Capture_Tool#Get_VI_Ref </linkedimage>

<linkedimage>

img_src=Image:CCT_GetFolder.png wikipage=Code_Capture_Tool#Get_Folder </linkedimage>

<linkedimage>

img_src=Image:CCT_GetFileName.png wikipage=Code_Capture_Tool#Get_Filename </linkedimage>

These VIs are used to retrieve properties from the CCT instance.

Get Front Panel Mode

Get FP mode

This VI will read the current front panel capture mode.

Get Block Diagram Mode

Get BD mode

This VI will read the current block diagram capture mode.

Get Layout Mode

Get Layout mode

This VI will read the current layout orientation.

Get Clipboard Mode

Get Clipboard mode

This VI will read the current clipboard mode.

Get VI Ref

Get VI Reference

This VI returns a reference to the that is currently captured in this isntance

Get Folder

Get Folder

This VI will read the folder where the images will be saved.

Get Filename

Get Filename

This VI will read the filename of the stored image.

Support

Support <linkedimage>

img_src=Image:CCT_CaptureFP.png wikipage=Code_Capture_Tool#Capture_Front_panel </linkedimage>

<linkedimage>

img_src=Image:CCT_CaptureBD.png wikipage=Code_Capture_Tool#Capture_Block_diagram </linkedimage>

<linkedimage>

img_src=Image:CCT_ShowGUI.png wikipage=Code_Capture_Tool#Show_CCT_GUI </linkedimage>

<linkedimage>

img_src=Image:CCT_70Container.png wikipage=Code_Capture_Tool#7.0_container_VI </linkedimage>

<linkedimage>

img_src=Image:CCT_80_Container.png wikipage=Code_Capture_Tool#8.0_container_VI </linkedimage>

This submenu shows additional low level functions of the CCT.

Capture Front panel

Capture front panel

Use this VI to have direct access to the capturing of a front panel.

Capture Block diagram

Capture block diagram

Use this VI to have direct access to the capturing of a block diagram.

Show CCT GUI

Show CCT GUI

Use this VI to show the user interface of the CCT.

7.0 container VI

7.0 container

Use this VI if you want to build a source distribution or an executable and need to make sure all dynamic VIs are included. For LabVIEW 7.0 and up.

8.0 container VI

8.0 container

Use this VI if you want to build a source distribution or an executable and need to make sure all dynamic VIs are included. For LabVIEW 8.0 and up, don't forget to include the 7.0 container.

Known issues

Description Status
After using a non-default path and resetting it to the default, the new setting (temp) is not used Solved in version 1.0
Installing on Linux fails due to case sensitivity Solved in version 1.0
Capturing a non-visible part on a multi-pane front panel fails A limitation due to the LabVIEW implementation of panes, most-likely not fixable
Saving an empty image returns an error Solved in version 1.0
Opening the CCT from the Getting Started Window locks up LabVIEW Solved in version 1.0

Version History

==Version 1.0.0 Release date 27 February 2008 Bug-fixes Support for panning of the preview

Version 0.9.1

Release date 7 November 2007 Support for LabVIEW 7.x and up Support for all OS'es Support for orientation Support for selection Support for customized naming Support for customized folder

Licensing

The CCT is licensed under the BSD license