当前位置: 首页 > article >正文

辅助--Inspector

辅助–Inspector

1.Introduction

This manual explains how to use the Inspector.

1.1.Overview

Inspector is a Qt-based library that provides functionality to interactively inspect low-level content of the OCAF data model, OCCT viewer and Modeling Data. This component is aimed to assist the developers of OCCT-based applications to debug the problematic situations that occur in their applications.

Inspector has a plugin-oriented architecture. The current release contains the following plugins:

PluginOCCT componentRoot class of OCCT investigated component
DFBrowserOCAFTDocStd_Application
VInspectorVisualizationAIS_InteractiveContext
ShapeViewModeling DataTopoDS_Shape
MessageViewModeling DataMessage_Report

Each plugin implements logic of a corresponding OCCT component.

Each of the listed plugins is embedded in the common framework, thus it is possible to manage, which plugins should be loaded by the Inspector, and to extend their number by implementing a new plugin.

1.2.Getting started

There are two launch modes:

  1. Launch TInspectorEXE executable sample. For more details see TInspectorEXE section;
  2. Launch DRAW, load plugin INSPECTOR, and use tinspector command. For more details, see Launch in DRAW Test Harness section.

Note. If you have no Inspector library in your build directory, make sure that OCCT is compiled with BUILD_Inspector option ON. For more details see Build procedure.

2.Inspector Plugins

2.1.Overview

Inspector consists of the following components:

  • buttons to activate the corresponding plugin;
  • view area to visualize the plugin content.

在这里插入图片描述

2.2.DFBrowser Plugin

2.2.1.Overview

img

This plugin visualizes the content of TDocStd_Application in a tree view. It shows application documents, the hierarchy of TDF_Labels, the content of TDF_Attributes and interconnection between attributes (e.g. references). Additionally there is a 3D view to visualize TopoDS_Shape elements stored in the document.

2.2.2.Elements

在这里插入图片描述

2.2.3.OCAF tree view

Each OCAF element has own tree view item:

TypeTree itemTextDescription
TDocStd_ApplicationApplicationTDocStd_ApplicationThe root of tree view. Its children are documents.
TDocStd_DocumentDocumententry : nameA child of Application item. Its children are Label and Attribute items. Text view is an entry of the root label and the value of TDataStd_Name attribute for the label if it exists.
TDF_LabelLabelentry : nameA child of a Document or another Label item. Its children and text view are the same as for Document item.
TDF_AttributeAttributeattribute type [additional information]A child of a Label. It has no children. Text view is the attribute type (DynamicType()->Name() of TDF_Attribute) and additional information (a combination of attribute values).

Additional information about TDF_Attributes:

TypeText
TDocStd_Owner[storage format]
TDataStd_AsciiString, TDataStd_Name, TDataStd_Real, other Simple type attributes[value]
TDataStd_BooleanList, TDataStd_ExtStringList, other List attributes[value_1 … value_n]
TDataStd_BooleanArray, TDataStd_ByteArray, other Array type attributes[value_1 … value_n]
TDataStd_TreeNode[tree node ID > Father()->Label()] (if it has a father) or [tree node ID < First()->Label()] (if it has NO father)
TDataStd_TreeNode(XDE)[XDE tree node ID > Father()->Label()] (if it has a father), [XDE tree Node ID < label_1, …, label_n] (if it has NO father)
TNaming_NamedShape[shape type : evolution]
TNaming_UsedShapes[map extent]

Custom color of items:

OCAF element TypeColor
TDF_Labeldark green, if the label has TDataStd_Name attribute, light grey if the label is empty (has no attributes on all levels of hierarchy), black otherwise.
TNaming_NamedShapedark gray for TopAbs_FORWARD orientation of TopoDS_Shape, gray for TopAbs_REVERSED orientation of TopoDS_Shape, black for other orientation.

Context pop-up menu:

ActionFunctionality
ExpandExpands the next two levels under the selected item.
Expand AllExpands the whole tree of the selected item.
Collapse AllCollapses the whole tree of the selected item.
2.2.4.Property Panel

Property panel is used to display the result of TDF_Attribute::Dump() or TDF_Label::Dump() of the selected tree view item. The information is shown in one table.

img

2.2.5.Property Panel (custom)

Property panel (custom) is used to display the content of Label or Attribute tree view items or Search result view. The information is usually shown in one or several tables.

TDF_Attribute has the following content in the Property Panel:

TypeDescriptionContent
TDF_Labela table of [entry or attribute name, value]img
TDocStd_Owner, Simple type attributes, List type attributesa table of [method name, value]img
TDataStd_BooleanArray, TDataStd_ByteArray, other Array type attributes2 controls: - a table of [array bound, value], - a table of [method name, value]img
TDataStd_TreeNode2 controls: - a table of [Tree ID, value] (visible only if Tree ID() != ID() ), - a tree view of tree nodes starting from Root() of the tree node. The current tree node has dark blue text.img
TDataStd_NamedDatatab bar of attribute elements, each tab has a table of [name, value]img
TNaming_UsedShapesa table of all shapes handled by the frameworkimg
TNaming_NamedShape2 controls: - a table of [method name, value] including CurrentShape/OriginalShape methods result of TNaming_Tools, - an evolution table. Tables contain buttons for TopoDS_Shape export.img
TNaming_Naming2 controls: - a table of TNaming_Name values, - a table of [method name, value]img
2.2.6.Dump view

img

Dump view shows the result of TDF_Attribute::Dump() or TDF_Label::Dump() of the selected tree view item.

2.2.7.3D view

3D View visualizes TopoDS_Shape elements of OCAF attribute via AIS facilities.

DFBrowser creates two kinds of presentations depending on the selection place:

KindSource objectVisualization propertiesView
Main presentationTree view item: TPrsStd_AISPresentation, TNaming_NamedShape, TNaming_NamingColor: a default color for shape type of the current TopoDS_Shape.img
Additional presentationReferences in Property panelColor: whiteimg
2.2.8.Tree Navigation

Tree Navigation shows a path to the item selected in the tree view. The path is a sequence of label entries and attribute type names. Each element in the path is selectable - simply click on it to select the corresponding tree view item.

Navigation control has buttons to go to the previous and the next selected tree view items.

Update Button

Update button synchronizes content of tree view to the current content of OCAF document that could be modified outside.

Search

The user can search OCAF element by typing:

  • TDF_Label entry,
  • TDF_Attribute name,
  • TDataStd_Name and TDataStd_Comment attributes value.

img

As soon as the user confirms the typed criteria, the Property panel is filled by all satisfied values. The user can click a value to highlight the corresponding tree view item. By double click the item will be selected.

2.3.Elements cooperation
2.3.1.Tree item selection

Selection of tree view item updates content of the following controls:

  • Navigation line;
  • Property Panel;
  • 3D View (if it is possible to create an interactive presentation);
  • Dump View.

在这里插入图片描述

2.3.2.Property Panel (custom) item selection

If the property panel (custom) shows content of TDF_Label:

  • selection of the table row highlights the corresponding item in the tree view,
  • double click on the table row selects this item in the tree view.

If the property panel (custom) shows content of TDF_Attribute that has reference to another attribute, selection of this reference:

  • highlights the referenced item in the tree view,
  • displays additional presentation in the 3D view if it can be created.

在这里插入图片描述

Attributes having references:

TypeReferenceAdditional presentation
TDF_ReferenceTDF_Label
TDataStd_ReferenceArray, TDataStd_ReferenceList, TNaming_NamingOne or several TDF_Label in a container.
TDataStd_TreeNodeTDF_Label
TNaming_NamedShapeTDF_Label in Evolution tableTopoDS_Shapes selected in the property panel tables.
TNaming_UsedShapesone or several TNaming_NamedShapeTopoDS_Shapes of the selected TNaming_NamedShape.
2.3.3.TopoDS_Shape export

Property panel of TNaming_NamedShape attribute has controls to export TopoDS_Shape to:

  • BREP. Save file dialog is open to enter the result file name,
  • ShapeView plugin. The dialog for exporting element to ShapeView allows activating this plugin immediately.

2.4.VInspector Plugin

2.4.1.Overview

img

This plugin visualizes interactive objects displayed in AIS_InteractiveContext in a tree view with computed selection components for each presentation. It shows the selected elements in the context and allows selecting these elements.

2.4.2.Elements

在这里插入图片描述

2.4.3.Presentations tree view

This view shows presentations and selection computed on them. Also, the view has columns with information about the state of visualization elements.

VInspector tree items.

TypeDescription
AIS_InteractiveContextThe root of tree view. Its children are interactive objects obtained by DisplayedObjects and ErasedObjects methods.
AIS_InteractiveObjectA child of AIS_InteractiveContext item. Its children are SelectMgr_Selection obtained by iteration on CurrentSelection.
SelectMgr_SelectionA child of AIS_InteractiveObject. Its children are SelectMgr_SensitiveEntity obtaining by iteration on Sensitive.
SelectMgr_SensitiveEntityA child of SelectMgr_Selection. Its children are SelectMgr_SensitiveEntity obtaining by iteration on OwnerId.
SelectBasics_EntityOwnerA child of SelectMgr_SensitiveEntity. It has no children.

Custom color of tree view items:

OCAF element TypeColumnWhatColor
AIS_InteractiveObject0Textdark gray in ErasedObjects list of AIS_InteractiveContext, black otherwise
AIS_InteractiveObject, SelectMgr_SensitiveEntity, SelectBasics_EntityOwner1Backgrounddark blue, if there is a selected owner under the item, black otherwise
SelectMgr_Selection, SelectMgr_SensitiveEntity, electBasics_EntityOwnerallTextdark gray, if SelectionState of SelectMgr_Selection is not SelectMgr_SOS_Activated, black otherwise

Context popup menu in tree view:

ActionItemFunctionality
Export to ShapeViewAIS_InteractiveObjectExports TopoDS_Shape of the AIS_Interactive presentation to ShapeView plugin. It should be AIS_Shape presentation and ShapeView plugin should be registered in Inspector Dialog about exporting element to ShapeView is shown with a possibility to activate this plugin immediately.
ShowAIS_InteractiveObjectDisplays presentation in AIS_InteractiveContext.
HideAIS_InteractiveObjectErases presentation from AIS_InteractiveContext.
2.4.4.Update

This button synchronizes the plugin content with the current state of AIS_InteractiveContext and updates the presence of items and their current selection.

2.4.5.Elements cooperation

VInspector marks the presentations currently selected in AIS_InteractiveContext with a blue background in tree items. Use Update button to synchronize VInspector selected items state to the context.

It is also possible to perform selection in the context using “Selection controls” VInspector feature. However, this operation should be performed carefully as it clears the current selection in AIS_InteractiveContext.

Selection change:

FromToActionResult
AIS_InteractiveContextVInspectorPerforms selection in AIS_InteractiveContext.Click Update button in VInspector and check Selection column: AIS_InteractiveContext item contains some selected objects, the value of some AIS_InteractiveObject is filled if they are selected for this presentation or its entity owner.
VInspectorAIS_InteractiveContextActivates one of Selection controls and selects one or several elements in the tree view.The objects become selected in AIS_InteractiveContext.
2.4.6.VInspector tree view columns

Use context pop-up menu on the tree view header to select, which columns should be displayed.

img

Use the setting Lights (position, color) in the view.

img

2.4.7.VInspector property panel

Property panel shows the result of AIS_InteractiveContext::Dump() or AIS_InteractiveObject::Dump().

img

2.5.ShapeView Plugin

2.5.1.Overview

img

This plugin visualizes content of TopoDS_Shape in a tree view.

2.5.2.Property panel

Property panel shows properties for TopoDS_Shape based on DumpJson.

img

2.5.3.Elements

在这里插入图片描述

2.5.4.TopoDS_Shape View

The view elements are TopoDS_Shape objects. The shape is exploded into sub-shapes using TopoDS_Iterator of the TopoDS_Shape. Children sub-shapes are presented in the view as children of the initial shape. By iterating recursively through all shapes we obtain a tree view of items shown in the ShapeView.

The columns of the View show some information about TopoDS_Shape of the item. The first column allows changing the visibility of the item shape in the 3D view.

Context pop-up menu in tree view:

ActionFunctionality
Load BREP fileOpens the selected file and appends the resulting TopoDS_Shape into the tree view.
Remove all shape itemsClears tree view.
BREP viewShows the text view with BREP content of the selected item. Creates the BREP file in a temporary directory of the plugin.
Close All BREP viewsCloses all opened text views.
BREP directoryDisplays the folder, where temporary BREP files have been stored.
2.5.5.Elements cooperation

Selection of one or several items in TopoDS_Shape View creates its AIS_Shape presentation and displays it in the 3D View.

2.5.6.ShapeView tree view columns

Use context pop-up menu on the tree view header to select, which columns should be displayed.

img

2.5.7.MessageView Plugin

MessageView plugin is used to display content of Message_Report.

2.5.8.Message report tree view

Message report tree view shows the content of the Message_Report.

Context pop-up menu in message report tree view:

ActionFunctionality
Export ReportExports the report as json file.
WallClock Metric statisticCreates the table that sums the number of calls and the time spent on the functionality inside the value and shows it in Property panel (custom). It’s necessary to activate “WallClock metric”.
Preview children presentationsDisplays presentations of children items of selected items if found.
DeactivateDeactivates all types of metrics for the current report.
ActivateAppends items to activate report metrics.
ClearClears message report.
Activate metricSwitches active state in report for clicked type of metric.
Test metricSends several alerts to check metric of message-alert-tool mechanism.
Test Message_MessengerSends several alerts to check property panel/presentations of messenger-alert-tool mechanism.
Test Tree of messagesSends several alerts to check tree of alerts.

img

2.5.9.3D View

3D View shows the selected item (TopoDS_Shape) in message report tree view.

img

2.5.10.Dump panel

Shows Dump() information of the selected item if the item has Dump().

img

2.5.11.Property panel (custom)

Shows the table for WallClock Metric statistic option.

img

2.5.12.Elements

在这里插入图片描述

2.6.Common controls

2.6.1.Tree View

This control shows presentation hierarchy of the investigated OCCT element, e.g. TDocStd_Application for DFBrowser, see Overview. The first column contains the name, other columns are informative.

The tree view has a context menu with plugin-specific actions.

2.6.2.Tree View preferences

It is possible to define visibility and width of columns. This option is available in a view that contains more than one column, e.g. VInspector tree view columns and ShapeView tree view columns.

在这里插入图片描述

2.7.3D View

2.7.1.Overview

img

This control for OCCT 3D viewer creates visualization view components and allows performing some user actions in the view.

2.7.2.Elements

在这里插入图片描述

3D View contains the following elements:

ElementFunctionality
3D viewV3d viewer with mouse events processing.
ContextAllows choosing another context that should be used in the plugin. The following contexts are available: Own - the context of this view, External - the context of the external application, which initializes the plugin, None - the visualization is not performed at all (useful if the presentation is too complex).
Multi/SingleThe buttons define what to do with the previously displayed objects: Multi displays new presentations together with already displayed ones, Single removes all previously displayed presentations.
CleanRemoves all displayed presentations.
Trihedron displayShows the trihedron.
View cube displayShows the view cube.
Fit AllScene manipulation actions (Fit All is checkable. If checked(by double click), display/hide of new objects will perform Fit All of the scene.)
Display ModeSets AIS_Shading or AIS_WireFrame display mode for all presentations.

Context popup menu:

ActionFunctionality
Set View OrientationShows the list of available V3d_View projections. Selection of an item with change the view.

img

2.7.3.3D View preferences.

View preferences store the current view orientation.

2.7.4.Preferences context menu

img

Context menu contains:

ElementFunctionality
Tree Level Line,
PropertyPanel,
PropertyPanel (custom),
Dump,
View
Names of dock widgets in the active plugin. If the button is checked, dock widget is visible.
Store PreferencesCreates “.tinspector.xml” preferences file with the current settings for each plugin.
This file is created in TEMP/TMP directory (by default) or in a user-defined directory.
Remove PreferencesRemoves preferences file. After the Inspector is restarted, default values will be applied.

The following controls have store/restore preferences:

ElementPreferences
GeometryInspector window size and position. State of dockable widgets : visibility, position, size.
Tree View preferencesColumns visible in the tree view and their width.
3D View preferences3D view camera direction.

2.8.Getting Started

2.8.1.TInspectorEXE sample

This sample allows trying Inspector functionality.

Use inspector.bat script file placed in a binary directory of OCCT to launch it.

This script accepts the names of plugin’s DLL that should be loaded. By default it loads all plugins described above.

img

Click on the Open button shows the dialog to select a file.

img

Depending on the active plugin, it is possible to select the following files in the dialog:

  • DFBRowser: OCAF document or STEP files;
  • VInspector: BREP files;
  • ShapeView: BREP files.

Click the file name in the proposed directory and enter it manually or using Browse button.

By default, TInspectorEXE opens the following files for plugins:

Plugin DLL library nameFiles
TKDFBrowserstep/screw.step
TKVInspectorocc/hammer.brep
TKShapeViewocc/face1.brep, occ/face2.brep

These files are found relatively to CSF_OCCTDataPath.

2.8.2.TInspectorEXE preferences

The application stores recently loaded files. On the application start, the last file is activated. Open file dialog contains recently loaded files. Selection of a new file updates the container of recently loaded files and rewrites preferences.

Source code of TIspectorEXE is a good sample for using the Inspector in a custom application.

2.8.3.How to launch the Inspector in DRAW Test Harness

TKToolsDraw plugin provides DRAW commands for Qt tools. Use INSPECTOR parameter of pload command to download the commands of this library. It contains tinspector command to start Inspector under DRAW. See more detailed description of the tinspector command.

The simple code to start Inspector with all plugins loaded:

pload INSPECTOR
tinspector

img

This command does the following:

  • all available Plugins are presented in the Inspector. These are DFBrowser, VInspector, ShapeView and MessageView;
  • DFBrowser is the active plugin;
  • OCAF tree is empty.

After this, we should create objects in DRAW and update tinspector. The examples of using Inspector in DRAW can be found in OCCT source directory /tests/tools.

2.8.4.How to use the Inspector in a custom application

The example of using the Inspector in a custom application is presented in OCCT qt sample - FuncDemo. For building qt samples, switch on BUILD_SAMPLES_QT variable in Configuration process.

In general, the following steps should be taken:

  • Set dependencies to OCCT and Qt in the application (Header and Link);
  • Create an instance of TInspector_Communicator;
  • Register the plugins of interest in the communicator by DLL library name;
  • Initialize the communicator with objects that will be investigated;
  • Set visible true for the communicator.

Here is an example of C++ implementation:

#include <inspector/TInspector_Communicator.hxx>
static TInspector_Communicator* MyTCommunicator;
void CreateInspector()
{
  NCollection_List<Handle(Standard_Transient)> aParameters;
  //... append parameters in the list
  if (!MyTCommunicator)
  {
    MyTCommunicator = new TInspector_Communicator();
    MyTCommunicator->RegisterPlugin ("TKDFBrowser");
    MyTCommunicator->RegisterPlugin ("TKVInspector");
    MyTCommunicator->RegisterPlugin ("TKShapeView");
    MyTCommunicator->RegisterPlugin ("TKMessageView");
    MyTCommunicator->Init (aParameters);
    MyTCommunicator->Activate ("TKDFBrowser");
  }
  MyTCommunicator->SetVisible (true);
}

Give one the following objects for a plugin using a container of parameters:

Pluginto be initialized by
TKDFBrowserTDocStd_Application
TKVInspectorAIS_InteractiveContext
TKShapeViewTopoDS_TShape
TKMessageViewMessage_Report

2.9.Build procedure

2.9.1.Building with CMake within OCCT

By default the Inspector compilation is off. To compile it, set the BUILD_Inspector flag to “ON”. See Configuration process.

When this option is switched ON, MS Visual Studio project has an additional tree of folders:

img

2.9.2.Sources and packaging

OCCT sources are extended by the /tools directory.

Distribution of plugin packages :

Source packagesPlugin
DFBrowser, DFBrowserPane, DFBrowserPaneXDE, TKDFBrowserDFBrowser
VInspector, TKVInspectorVInspector
ShapeView, TKShapeViewShapeView
MessageView, TKMessageViewMessageView

Other packages:

Source packagesUsed in
TInspectorAPI, TKInspectorAPIInterface for connection to plugin.
ViewControl, TKTreeModelClasses for property view, table, table model.
TreeModel, TKTreeViewItems-oriented model to simplify work with GUI tree control.
View, TKView3D View component.
TInspector, TKTInspectorInspector window, where plugins are placed.
ToolsDraw, TKToolsDrawPlugin for DRAW to start Inspector.

In MSVC studio, a separate folder contains Inspector projects.

2.9.3.Glossary
  • Component – a part of OCCT , e.g. OCAF, VISUALIZATION, MODELING and others.

  • Plugin

    – a library that is loaded in some executable/library. Here, the plugins are:

    • DFBrowser,
    • ShapeView,
3D View component.
TInspector, TKTInspectorInspector window, where plugins are placed.
ToolsDraw, TKToolsDrawPlugin for DRAW to start Inspector.

In MSVC studio, a separate folder contains Inspector projects.

2.9.3.Glossary
  • Component – a part of OCCT , e.g. OCAF, VISUALIZATION, MODELING and others.

  • Plugin

    – a library that is loaded in some executable/library. Here, the plugins are:

    • DFBrowser,
    • ShapeView,
    • VInspector.

http://www.kler.cn/a/500116.html

相关文章:

  • 时序数据库的订阅对比:TDengine vs InfluxDB 谁更强?
  • QT + Opencv 实现灰度模板匹配
  • DSP+Simulink——点亮LED灯(TMSDSP28379D)超详细
  • 西电-神经网络基础与应用-复习笔记
  • QT + Opencv 实现灰度模板匹配
  • SVM赛道概览:MoveVM落地,SVM能走多远
  • 食堂采购系统源码:基于PHP的校园食堂供应链管理平台开发全解析
  • web前端-html
  • phpenc加密程序源码
  • 快速上手Git——Windows系统下Git的安装与简单使用流程
  • 【网络云SRE运维开发】2025第2周-每日【2025/01/09】小测-【第9章 VRRP原理及基本配置考试】理论和实操解析
  • 代理模式简介
  • 【深度学习】运算符
  • 树莓集团:数字资产什么意思?包括哪些?
  • vscode 无法使用npm, cmd命令行窗口可以正常执行
  • OpenCV的双边滤波函数
  • RabbitMQ 交换机、队列和路由键的命名规范
  • 大数据高级ACP学习笔记(4)
  • 【数据库】四、数据库管理与维护
  • 初识verilog HDL
  • 数学建模_基于支持回归向量机SVR的回归预测之预测新数据+Matlab代码包教会使用,直接替换数据即可
  • PHP与ThinkPHP连接数据库示例
  • 【漫话机器学习系列】043.提前停止训练(Early Stopping)
  • Java(五十)java-IO流-缓冲流(BufferedInputStream和BufferedOutputStream)