0% found this document useful (0 votes)
329 views

SP 3 Dprogguide 082014-1

Uploaded by

sclee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
329 views

SP 3 Dprogguide 082014-1

Uploaded by

sclee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 70

Intergraph Smart™ 3D

Programmer’s Guide

Version 2014R1 August 2014 DSP3D-PE-200039I


Copyright
Copyright © 2009-2014 Intergraph Corporation ®. All Rights Reserved. Intergraph is part of Hexagon.
Including software, file formats, and audiovisual displays; may be used pursuant to applicable software license
agreement; contains confidential and proprietary information of Intergraph and/or third parties which is protected by
copyright law, trade secret law, and international treaty, and may not be provided or otherwise made available
without proper authorization from Intergraph Corporation.
Portions of the user interface copyright 2012-2013 Telerik AD.

U.S. Government Restricted Rights Legend


Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c) of the
Contractor Rights in Technical Data clause at DFARS 252.227-7013, subparagraph (b) of the Rights in Computer
Software or Computer Software Documentation clause at DFARS 252.227-7014, subparagraphs (b)(1) and (2) of the
License clause at DFARS 252.227-7015, or subparagraphs (c) (1) and (2) of Commercial Computer Software---
Restricted Rights at 48 CFR 52.227-19, as applicable.
Unpublished---rights reserved under the copyright laws of the United States.
Intergraph Corporation
300 Intergraph Way
Huntsville, Alabama 35813

Documentation
Documentation shall mean, whether in electronic or printed form, User’s Guides, Installation Guides, Reference
Guides, Administrator’s Guides, Customization Guides, Programmer’s Guides, Configuration Guides and Help
Guides delivered with a particular software product.

Other Documentation
Other Documentation shall mean, whether in electronic or printed form and delivered with software or on
eCustomer, SharePoint, or box.net, and documentation related to work processes, workflows, and best practices that
is provided by Intergraph as guidance for using a software product.

Terms of Use
a. Use of software product and Documentation is subject to the End User License Agreement (EULA) delivered
with software product unless the Licensee has a valid signed license for this software product with Intergraph
Corporation. If the Licensee has a valid signed license for this software product with Intergraph Corporation,
the valid signed license shall take precedence and govern the use of this software product and Documentation.
Subject to the terms contained within the applicable license agreement, Intergraph Corporation gives Licensee
permission to print a reasonable number of copies of the Documentation as defined in the applicable license
agreement and delivered with the software product for Licensee’s internal, non-commercial use. The
Documentation may not be printed for resale or redistribution.
b. For use of Documentation or Other Documentation where end user does not receive a EULA or does not have a
valid license agreement with Intergraph, Intergraph grants the Licensee a non-exclusive license to use the
Documentation or Other Documentation for Licensee’s internal non-commercial use. Intergraph Corporation
gives Licensee permission to print a reasonable number of copies of Other Documentation for Licensee’s
internal, non-commercial use. The Other Documentation may not be printed for resale or redistribution. This
license contained in this subsection b) may be terminated at any time and for any reason by Intergraph
Corporation by giving written notice to Licensee.

Disclaimer of Warranties
Except for any express warranties as may be stated in the EULA or separate license or separate terms and
conditions, Intergraph Corporation disclaims any and all express or implied warranties including, but not limited to
the implied warranties of merchantability and fitness for a particular purpose and nothing stated in, or implied by,
this document or its contents shall be considered or deemed a modification or amendment of such disclaimer.
Intergraph believes the information in this publication is accurate as of its publication date.
The information and the software discussed in this document are subject to change without notice and are subject to
applicable technical product descriptions. Intergraph Corporation is not responsible for any error that may appear in
this document.
The software, Documentation and Other Documentation discussed in this document are furnished under a license
and may be used or copied only in accordance with the terms of this license. THE USER OF THE SOFTWARE IS
EXPECTED TO MAKE THE FINAL EVALUATION AS TO THE USEFULNESS OF THE SOFTWARE IN HIS
OWN ENVIRONMENT.
Intergraph is not responsible for the accuracy of delivered data including, but not limited to, catalog, reference and
symbol data. Users should verify for themselves that the data is accurate and suitable for their project work.

Limitation of Damages
IN NO EVENT WILL INTERGRAPH CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
CONSEQUENTIAL INCIDENTAL, SPECIAL, OR PUNITIVE DAMAGES, INCLUDING BUT NOT LIMITED
TO, LOSS OF USE OR PRODUCTION, LOSS OF REVENUE OR PROFIT, LOSS OF DATA, OR CLAIMS OF
THIRD PARTIES, EVEN IF INTERGRAPH CORPORATION HAS BEEN ADVISED OF THE POSSIBILITY
OF SUCH DAMAGES.
UNDER NO CIRCUMSTANCES SHALL INTERGRAPH CORPORATION'S LIABILITY EXCEED THE
AMOUNT THAT INTERGRAPH CORPORATION HAS BEEN PAID BY LICENSEE UNDER THIS
AGREEMENT AT THE TIME THE CLAIM IS MADE. EXCEPT WHERE PROHIBITED BY APPLICABLE
LAW, NO CLAIM, REGARDLESS OF FORM, ARISING OUT OF OR IN CONNECTION WITH THE
SUBJECT MATTER OF THIS DOCUMENT MAY BE BROUGHT BY LICENSEE MORE THAN TWO (2)
YEARS AFTER THE EVENT GIVING RISE TO THE CAUSE OF ACTION HAS OCCURRED.
IF UNDER THE LAW RULED APPLICABLE ANY PART OF THIS SECTION IS INVALID, THEN
INTERGRAPH LIMITS ITS LIABILITY TO THE MAXIMUM EXTENT ALLOWED BY SAID LAW.

Export Controls
Intergraph Corporation's software products and any third-party Software Products obtained from Intergraph
Corporation, its subsidiaries, or distributors (including any Documentation, Other Documentation or technical data
related to these products) are subject to the export control laws and regulations of the United States. Diversion
contrary to U.S. law is prohibited. These Software Products, and the direct product thereof, must not be exported or
re-exported, directly or indirectly (including via remote access) under the following circumstances:
a. To Cuba, Iran, North Korea, Sudan, or Syria, or any national of these countries.
b. To any person or entity listed on any U.S. government denial list, including but not limited to, the U.S.
Department of Commerce Denied Persons, Entities, and Unverified lists, the U.S. Department of Treasury
Specially Designated Nationals List, and the U.S. Department of State Debarred List.
c. To any entity when Licensee knows, or has reason to know, the end use of the Software Product is related to the
design, development, production, or use of missiles, chemical, biological, or nuclear weapons, or other un-
safeguarded or sensitive nuclear uses.
d. To any entity when Licensee knows, or has reason to know, that an illegal reshipment will take place.
Any questions regarding export or re-export of these Software Products should be addressed to Intergraph
Corporation's Export Compliance Department, Huntsville, Alabama 35894, USA.

Trademarks
Intergraph, the Intergraph logo, Intergraph Smart, PDS, SmartPlant, SmartMarine, FrameWorks, I-Sketch,
IntelliShip, ISOGEN, SmartSketch, SPOOLGEN, SupportManager, and SupportModeler are trademarks or
registered trademarks of Intergraph Corporation or its subsidiaries in the United States and other countries.
Microsoft and Windows are registered trademarks of Microsoft Corporation. MicroStation is a registered trademark
of Bentley Systems, Inc. Other brands and product names are trademarks of their respective owners.
Intergraph Policy Against Software Piracy
When you purchase or lease Intergraph software, Intergraph retains ownership of the product. You become the
licensee of the product and obtain the right to use the product solely in accordance with the terms of the Intergraph
Software License Agreement and the provisions of the various copyright laws.
You must have a valid license for each working copy of the product. You may also make one archival copy of the
software to protect from inadvertent destruction of the original software, but you are not permitted to use the
archival copy for any other purpose. An upgrade replaces the original license. Any use of working copies of the
product for which there is no valid Intergraph Software License Agreement constitutes Software Piracy for which
there are very severe penalties. All Intergraph software products are protected by copyright laws and international
treaty.
If you have questions regarding software piracy or the legal use of Intergraph software products, please call the
Intergraph Legal Department at 256-730-2333.
Updated July, 2003. Document No. DDGL562B0
Table of Contents

Table of Contents
Preface.................................................................................................................................7
Smart 3D Product Documentation................................................................................8
Administrative Guides ........................................................................................................ 8
Documentation Comments ...........................................................................................9

Introduction......................................................................................................................10
Visual Basic .NET™ ........................................................................................................ 10
What's New in Programming Resources ....................................................................11

Software Architecture .....................................................................................................12


Three-Tier Architecture ..............................................................................................13
Client Tier ......................................................................................................................... 13
Middle (Business) Tier ..................................................................................................... 14
Server Tier ........................................................................................................................ 14

Getting Started .................................................................................................................16


Resources and References ..........................................................................................17
Printed Documentation ..................................................................................................... 17

Debugging Your Code .....................................................................................................18


Adding the TaskHost Project to your Project .............................................................19
IFC Rules ....................................................................................................................20

Binding and Binary Compatibility .................................................................................21


Early Binding..............................................................................................................22
Late Binding ...............................................................................................................23

Command Priorities.........................................................................................................24

Error Handling.................................................................................................................25
Error Log Component.................................................................................................26

Referencing Data Type Libraries ...................................................................................27


Using the References Tool..........................................................................................28
Errors Occurring with Visual Basic 6.........................................................................30

Creating Custom Commands..........................................................................................32


Undo Functionality .....................................................................................................33

Customizing the Software ...............................................................................................34

Intergraph Smart™ 3D Programmer’s Guide 3


Table of Contents

Using ActiveX Components .......................................................................................35


Creating an Implementation.............................................................................................. 35
Customizing Naming Rules........................................................................................36
Custom Name Rule ........................................................................................................... 37
IJNameRule Interface ....................................................................................................... 37
ComputeName Method..................................................................................................... 37
GetNamingParents Method............................................................................................... 38
CNameRuleAE Object...................................................................................................... 39
IJNameRuleAE Interface .................................................................................................. 39
Frozen Property................................................................................................................. 39
NamingParentsString Property ......................................................................................... 40
NameGeneratorService Object ......................................................................................... 41
IJNameCounter Interface .................................................................................................. 41
GetCount Method ............................................................................................................. 42
GetCountEx Method ......................................................................................................... 43
GetCountRange Method ................................................................................................... 44
NamingRulesHelper Object .............................................................................................. 45
IJDNamingRulesHelper Interface..................................................................................... 45
AddNamingRelations Method .......................................................................................... 46
GetActiveNamingRule Method ........................................................................................ 46
GetEntityNamingRulesGivenName Method .................................................................... 47
GetEntityNamingRulesGivenProgID Method .................................................................. 47
IsGeneratedNameUnique Method .................................................................................... 48
Customizing Hangers and Supports............................................................................49
IJHgrAutomation Interface ............................................................................................... 49
CreateSupport Method...................................................................................................... 49
ModifySupport Method .................................................................................................... 52
CreateSupport Method Example....................................................................................... 54
Customizing Project Management..............................................................................55
ProjectMgmtEntitiesFactory Object ................................................................................. 57
AddLocation Method........................................................................................................ 58
AttachPDSProject Method................................................................................................ 59
CreateProjectRoot Method................................................................................................ 60
CreateModelDatabaseObject Method............................................................................... 61
CreateCatalogDatabaseObject Method............................................................................. 62
CreateFolder Method ........................................................................................................ 62
CreatePermissionGroup Method....................................................................................... 63
CreateAccessControlRule Method.................................................................................... 64
CreateReportsDatabaseObject Method............................................................................. 65
IJHierarchy Interface ........................................................................................................ 66
GetDisplayChildren Method............................................................................................. 67
Parent Property ................................................................................................................. 67
IJAccessRuleHelper Interface........................................................................................... 67
AddAccessControlRule Method ....................................................................................... 68
IJBackupRestoreHelper Interface ..................................................................................... 70
BackupPlantDatabases Method ........................................................................................ 71
RestorePlantDatabases Method ........................................................................................ 72
Customizing Drawings ...............................................................................................75
Package Versioning .......................................................................................................... 76
Using the Graphic Wrapper Modules ............................................................................... 77

4 Intergraph Smart™ 3D Programmer’s Guide


Table of Contents

IJDwgExternalModule...................................................................................................... 78
IJDwgWrapperCompound ................................................................................................ 79
IJDwgWrapperPseudoFilter.............................................................................................. 79

When to Use a Graphic Wrapper...................................................................................81


ElbowToSingleArc .....................................................................................................81
MakeDrawable............................................................................................................81
Equipment Nozzle Separator ......................................................................................82
ElbowToSingleArc Module .............................................................................................. 82
MakeDrawable Module .................................................................................................... 86
Equipment Nozzle Separator Module ............................................................................... 87
Vertical Vessel Supports Placement...........................................................................90
Creating Vertical Vessel Supports Example...............................................................93

Creating Part Occurrence Symbols in Visual Basic: An Overview ..........................105


Add a Symbol to Reference Data .............................................................................106
Distributing Symbols Automatically ........................................................................108
Distributing Symbols Manually................................................................................110
Creating Part Occurrence Symbols with the Part Definition Wizard: An Overview111
Workflow for Creating a VB Part Occurrence Symbol .................................................. 113
Visual Basic Part Definition Wizard............................................................................... 115
Step 1 - Create VB Project Page ..................................................................................... 116
Step 2 - Create Excel Spreadsheet Page.......................................................................... 119
Step 3 - Specify Definition Properties Page.................................................................... 121
Step 4 - Specify Occurrence Properties Page.................................................................. 123
Step 5 - Identify the Outputs Page .................................................................................. 125
Programming Notes for Visual Basic: An Overview ...............................................128
Defining Electrical Parts ................................................................................................. 128
Defining HVAC Parts ..................................................................................................... 131
Defining Hanger and Support Part Ports......................................................................... 133
Defining Piping Parts...................................................................................................... 135
Defining Nozzles ............................................................................................................ 136
Defining Parametric Components................................................................................... 140
Defining Valves .............................................................................................................. 143
Using SymbolHelper....................................................................................................... 146
Using Custom Aspects with a Symbol............................................................................ 149
Using String Type as an Input Parameter ....................................................................... 150
Using a Part as the First Input......................................................................................... 151
Converting PDS EDEN to Smart 3D Visual Basic Symbols: An Overview............152
EDEN Translator Workflow ........................................................................................... 153
EDEN Translator Command Line Structure................................................................... 154
EDEN Translator Outputs............................................................................................... 156
EDEN Translator Required VB Editing.......................................................................... 157
EDEN Translator Example ............................................................................................. 161
Symbol Definitions: An Overview ...........................................................................165

EDEN Functions Programming Reference .................................................................168


DefineActiveOrientation Method .............................................................................168

Intergraph Smart™ 3D Programmer’s Guide 5


Table of Contents

DefineNozzle Method...............................................................................................169
DefinePlacePoint Method.........................................................................................170
DefinePoint Method..................................................................................................171
DrawArc Method ......................................................................................................172
DrawComplexSurface Method .................................................................................173
DrawLine Method.....................................................................................................174
InitializeGlobals Method ..........................................................................................174
MoveAlongAxis Method ..........................................................................................175
MoveToPlacePoint Method ......................................................................................175
NozzleDefineDirectionVector Method.....................................................................176
NozzleInitialize Method ...........................................................................................176
NozzlePlace Method.................................................................................................177
RotateOrientation Method ........................................................................................178

Using the Equipment Symbol Upgrade Wizard..........................................................179


Introduction...............................................................................................................180
Before You Upgrade ....................................................................................................... 180
Register and Launch the Equipment Symbol Upgrade Wizard ...................................... 180
Log Files ......................................................................................................................... 181
Upgrade to the Equipment Component........................................................................... 181
Define Locations.......................................................................................................183
Equipment Symbol Upgrade Wizard - Step 1................................................................. 183
Search Equipment ProgIDs in Spreadsheets.............................................................184
Equipment Symbol Upgrade Wizard - Step 2................................................................. 184
Search VB Project Files for ProgIDs........................................................................185
Equipment Symbol Upgrade Wizard - Step 3................................................................. 185
Upgrade VB Projects and Spreadsheets ...................................................................186
Equipment Symbol Upgrade Wizard - Step 4................................................................. 186
Finish ........................................................................................................................188

Index................................................................................................................................189

6 Intergraph Smart™ 3D Programmer’s Guide


Preface

Preface
This document is a user's guide for programming and customization using Intergraph
Smart™ 3D and provides information about custom commands, naming rules, project
management, symbol programming, and drawings customization.

Intergraph Smart™ 3D Programmer’s Guide 7


Preface

Smart 3D Product Documentation


Most of the software's documentation is available as Adobe Acrobat PDF files. Most
of the content is the same as online Help. To access these PDF documents, click Help
> Printable Guides in the software.

Administrative Guides
Intergraph Smart ™ 3D Installation Guide - Provides instructions on installing and
configuring the software.

Project Manager User’s Guide - Provides information about setting up permission


groups and specifications in the software.

Reference Data Guide - Provides instructions about the Bulkload utility and the
reference data common to several disciplines.

3D Symbols Reference Data Guide - Provides information about the three-


dimensional symbols used in all tasks.

8 Intergraph Smart™ 3D Programmer’s Guide


Preface

Documentation Comments
Send documentation comments or suggestions to [email protected].

Intergraph Smart™ 3D Programmer’s Guide 9


Introduction

Introduction
The Intergraph Smart 3D Programmer's Guide provides introductory information to
developers who want to create custom commands or custom programs using special
tools and the software. Before creating commands or programs, you must be very
familiar with the software interactively and understand its basic concepts of projects,
engineering, architecture, concurrency, and datastores.

For more specific information about creating commands using the software
application programming interface (API), please contact Intergraph Services.

This programming guide includes:

An overview of customization with the software using Microsoft Visual


Basic™.
Some of the tools that can be used to create commands.
Some of the user-definable methods of implementation, such as creating
commands.
Examples of customization and workflows.

Visual Basic .NET™


The programming interfaces in Smart 3D are subject to change as the software moves
to the .NET framework. Programmers should be aware that they may be required to
modify or rewrite their code to work with future versions of Smart 3D software.

10 Intergraph Smart™ 3D Programmer’s Guide


Introduction

What's New in Programming Resources


This section directs your attention to enhancements, changes, or special notes for this release of
the software.

In the Debugging Your Code section are instructions for users to increase the stack size
for Visual Basic before debugging IFC rules.

Intergraph Smart™ 3D Programmer’s Guide 11


Software Architecture

Software Architecture
The software has an architecture that is component-oriented and built on three tiers.
The software makes extensive use of the Microsoft® Component Object Model, or
COM. The COM paradigm is deeply rooted in the idea of separating the interface of
an object from its data. Interface names, such as IUnknown, IDispatch, and so forth,
begin with the letter I by convention. Interfaces developed in the software always
begin with IJ, such as IJAppInfo. The J distinguishes interfaces from other sources
and reduces the risk of namespace collision.

Because the software is task-oriented, it uses one datastore. The datastore is the entity
that stores the data of the persistent business object instances. The term task-oriented
means that, rather than developers producing one large executable file or several
smaller ones, all the major functional subdivisions of the software are built as
separable COM objects. These "COMponents" are known as tasks. One datastore
means that all these separate tasks operate against a single underlying database.

12 Intergraph Smart™ 3D Programmer’s Guide


Software Architecture

Three-Tier Architecture
The three-tier architecture of the software includes the client, middle, and server tiers.
These tiers separate the graphical user interface, or GUI, stored in the client tier, from
the business logic in the middle tier. The business logic is further separated from the
physical database in the server tier.

The architecture emphasizes programming ease in producing functionality for the


client tier. The client tier mainly consists of commands, plus some components,
ActiveX controls, and services.

Client Tier
The client tier's functionality is loaded on user demand in the form of tasks, services,
and commands.

The client tier contains the menus, toolbars, views, dialog boxes, and frames. In the
client tier, you can manipulate the GUI with services, such as the SelectSet and
GraphicViewMgr, and with software-supplied components, such as Locators,
Highlighters, and View manipulations.

A set of commands make up each task in the client tier. Eighty to ninety percent of
the code in a task is written in the form of a command or to support a command.

Each task has its own COMponent called the EnvironmentMgr and an associated
XML file. This XML file defines the look and feel for the task and specifies the
services that it uses.

Services and other components support the commands and tasks by providing a set of
commonly-used functionalities. Services should respond to task switches. When a
task starts or ends, services are notified of the event to initialize or to clean up.

A service implements one or more service-specific interfaces. Generally, a service


wraps a specific bit of re-usable functionality. A service exists as a singleton, which is
the one and only instance of its class.

A service can persist its state in a session file when the session file is saved. The
SessionMgr, a service, coordinates this activity. When a session is saved,
SessionMgr checks each service to see if it supports an interface for persistence. If
the service does support an interface for persistence, then this interface is called to
allow the service to save persistent information. When the SessionMgr loads a
session file, the reverse happens - the SessionMgr first creates the service; then, if the
service can persist, SessionMgr calls the service to restore saved information.

Intergraph Smart™ 3D Programmer’s Guide 13


Software Architecture

For more information about session files, see the Managing Sessions: An Overview
section of the Common User's Guide.

Middle (Business) Tier


A task and its commands manipulate business objects. Business objects correspond to
real-world things such as pipes, pumps, tanks, hulls, decks, propellers, engines, and
so forth and they populate the middle tier.

Relationships define how business objects interact with each other. The following are
examples of this interaction:

A pipe might need to be parallel to another pipe.


A propeller might require an engine to exceed some threshold horsepower.
A deck must maintain some minimum distance from the decks above and
below it.
Relationships are the software business rules. Relationships react to changes as they
take place, ensuring referential integrity and data consistency. Relationships and
business objects are closely tied to each other and the tasks that define and manipulate
them. A task or set of closely-related tasks defines business objects and relationships.

The RevisionMgr is a middle tier component that manages the associative


relationships between the objects and is the center of any engineering solution. This
service continuously keeps every entity consistent with all other data in the system.
This consistency is defined by the relationships of the entities.

The RevisionMgr works in cooperation with the business objects and relationships
by detecting changes to business objects. Using the relationships that business objects
are involved in, the RevisionMgr declares changes to any business objects defined as
outputs of the relationships. The RevisionMgr continues this promulgation until all
affected business objects are up-to-date.

The RevisionMgr notifies the TransactionMgr, a client tier service, after all
affected business objects have been modified. The TransactionMgr in turn notifies
any client tier services that are listening.

Server Tier
The server tier is made up of one or more physical datastores.

The server tier also provides storage for the metadata, which is contained in the
Repository. The Repository is the name of the location in which all the UML data is
saved. Metadata is the total description of all the classes, interfaces, relationships, and
semantics in the system.

14 Intergraph Smart™ 3D Programmer’s Guide


Software Architecture

The RevisionMgr service in the middle tier accesses this metadata.

Intergraph Smart™ 3D Programmer’s Guide 15


Getting Started

Getting Started
Before you begin customizing the software, you should be familiar with the
following:

Microsoft Visual Basic (6.0 or greater) at an advanced level. C++ is not a


requirement.
Basic understanding of the software functionality
Basic understanding of the software architecture
Basic understanding of relational databases
Engineering and project knowledge

16 Intergraph Smart™ 3D Programmer’s Guide


Getting Started

Resources and References


The best source for programming reference information is contained in the
documentation and Help provided with your programming tool, such as the Visual
Basic Programmer's Guide. Microsoft Visual Basic provides plenty of helpful
programming information in the Microsoft Visual Basic Help Topics in the Microsoft
Developer Network Online. You can display this information by selecting from the
Help menu in Visual Basic.

You can also use any language of your choice that is OLE compliant such as C#,
C++, J++, Smalltalk, Fortran, Cobol, and so forth. However, examples and
documentation are provided in Visual Basic 6.0 format only.

For additional sources of documentation, online training, and code samples, you can
connect to the internet and download files or read to learn more. For example, you
can access information about the following:

Microsoft Visual Basic


Visual Basic Resource Index
Microsoft Visual Studio Owners Area
Microsoft Developer Network Online
MSDN Library
MacMillan InformIT and links to other VB sites
Microsoft Multimedia Central, Online Seminars

Printed Documentation
Hardcore Visual Basic, Microsoft Press. Also available from the MSDN
Library.
Advanced Microsoft Visual Basic 6.0, Microsoft Press. Also available
from the MSDN Library.

Intergraph Smart™ 3D Programmer’s Guide 17


Debugging Your Code

Debugging Your Code


No matter how carefully you create your code, errors can occur. To handle these
errors, you need to add error-handling code to your procedures.

You perform the process of locating and fixing bugs in applications by debugging the
code. Visual Basic provides several tools to help analyze how your application
operates. These debugging tools are useful in locating the source of bugs, but you can
also use the tools to experiment with changes to your application or to learn how
other applications work.

Note: You must add the TaskHost project to the integrated development environment
(IDE) before you can debug your Visual Basic project.

Before you can use the TaskHost project, you must set new paths in your computer's
environment variables. Click Start > Settings > Control Panel > System. Select the
Advanced tab and then click Environment Variables. Finally add the following path
statements according to the location in which you installed the software:

PATH=[Product Directory]\Core\Runtime; [Product


Directory]\GeometryTopology\Runtime

18 Intergraph Smart™ 3D Programmer’s Guide


Debugging Your Code

Adding the TaskHost Project to your Project


1. Open your Visual Basic .vbp project to debug.
2. Click File > Add Project.
3. Select the Existing tab.
4. Open SP3DTaskHost.vbp in the following path: ..\Debug\Container\Src\Host
5. In the Project window, right-click over SP3DTaskHost and then select Set as
Start Up.
6. Right-click again on SP3DTaskHost and then select SP3DTaskHost
Properties...
7. On the Project Properties dialog, change the Project Type to Standard EXE.
8. Set the breakpoint in your project to debug.
9. Click Run and wait for processing to begin. Your Visual Basic project becomes
active when the breakpoint is reached.
10. Click to view <your project>, which returns you back to the code view. Then step
through your code.
Important

Do not stop the debug process by clicking the End command. If you end processing
this way, you will throw an exception, crash all the software that is running, and lose
your changes.

To safely end processing, click File > Exit from the Smart 3D TaskHost software.

For more specific information about using the TaskHost project and creating
commands using the software's application programming interface (API), please
contact Intergraph Services.

Intergraph Smart™ 3D Programmer’s Guide 19


Debugging Your Code

IFC Rules
Before debugging IFC post processor rules, you must increase the stack size by 4
megabytes for Visual Basic. The default value is only 1 megabyte, but IFC rules
require a minimum of 4 megabytes of stack memory.

Using the Command prompt, run the following command to increase the stack size:
$EDITBIN.exe /stack:4096000 /heap:65536 "[VB 6.0 Installation
folder]\VB98\VB6.EXE"; default: ($EDITBIN.exe /stack:4096000 /heap:65536
"C:\Program Files (86)\Microsoft Visual Studio\VB98\VB6.EXE").

20 Intergraph Smart™ 3D Programmer’s Guide


Binding and Binary Compatibility

Binding and Binary Compatibility


One of the most important steps in Visual Basic programming is to preserve the
binary compatibility of your ActiveX components. You define whether the methods
and properties of your objects are exposed in the type library.

Intergraph Smart™ 3D Programmer’s Guide 21


Binding and Binary Compatibility

Early Binding
A client program can access this information at design time by statically binding to
the ClassID of the classes in the type library. This process is called "early binding".

The ClassID is a unique name given to each object class at compile time, representing
the status of the exposed methods and properties on the binary level. A binary-
compatible version of the type library retains the same ClassIDs, which indicates that
the binary footprint of all the methods and properties remains unchanged and
backward compatible.

22 Intergraph Smart™ 3D Programmer’s Guide


Binding and Binary Compatibility

Late Binding
If binary compatibility is not guaranteed, then the client program cannot statically
bind itself to the ClassID. Instead it must query the object at runtime to verify that it
continues to support the methods and properties required by the client. This
verification is called "late binding".

Intergraph Smart™ 3D Programmer’s Guide 23


Command Priorities

Command Priorities
When a command is started, it is assigned a priority, and (if successfully started) a
command ID is returned. Note that commands do not possess an intrinsic priority.
They are assigned one by the task that starts them. Thus, it is possible to start the
same command with different priorities in two different tasks. However, you should
avoid this practice unless there is a valid reason for this kind of implementation.

The command ID can be stored for subsequent use by issuing


IJCommandManager2.StopCommand. Otherwise, it can be ignored.

The priority is used to determine the stacking that can be done in conjunction with the
command. If the command being started is given a higher priority than the currently
active command, and the current command is suspendable (stackable), then the
current command is (suspended) stacked. If the current command is not suspendable,
or if its priority is equal to or less than the command being started, the current
command is stopped.

There are three possible priority values: Low, Normal, and High.

Caution:

High priority commands can not commit or abort transactions.


Normal priority commands can commit and abort transactions. They must
stop their transaction when they are stopped or when they fail (to leave the
system in a clean state).
Low priority commands can use transactions. They must stop their
transaction when they are stopped, suspended, or when they fail.
If these rules are not respected, a higher priority command could potentially terminate
a transaction opened by a stacked (lower priority) command. The stacked command,
upon being resumed, would be in a highly indeterminate state.

24 Intergraph Smart™ 3D Programmer’s Guide


Error Handling

Error Handling
Trapping and resolving errors is one of those tasks that all developers must address. It
is important to remember several guidelines when you add code to your projects for
error handling.

Never let an exception or error "escape" from a component.


For public methods and properties, always use: On Error GoTo
ErrHandler
Return errors at the interface level as defined by the interface
Provide a unique name for each error handler label in a procedure that will
not conflict with any other element in the procedure.
You should code your class modules to handle every error that occurs within that
module. You should also try to handle errors in the module that arise in an object
being referenced elsewhere, when the errors are not being handled by that object.

Intergraph Smart™ 3D Programmer’s Guide 25


Error Handling

Error Log Component


The error log component collects and stores errors in the software. However, it does
not replace standard error checking. It makes specialized error handling much easier.

This component provides dual error tracking for the software. It can assist when
trouble-shooting problems at a customer site as well as a debugging tool during
Visual Basic project development.

26 Intergraph Smart™ 3D Programmer’s Guide


Referencing Data Type Libraries

Referencing Data Type Libraries


The software consists of hundreds of type libraries that provide the programmatic
interfaces to the data model and its underlying data. These libraries consist of the
data model's interfaces and their methods and properties.

The ability to integrate user-definable components into the environment is a key


capability of the software. The mechanism of creating custom commands provides
this extensibility.

To reference the available type libraries in Visual Basic:

Click Project > References.


To perform the task of referencing your type libraries more quickly and efficiently:

Click Project > Speedy References.


For more information on using the Speedy References tool in Visual Basic, see Using
the References Tool, page 28.

Intergraph Smart™ 3D Programmer’s Guide 27


Referencing Data Type Libraries

Using the References Tool


The Speedy References tool is a very useful utility that you can use to locate and
reference type libraries quickly and easily. You only need to know the name of your
class object or variable in which to perform a search.
1. Open Visual Basic.
2. Click Add-Ins > Add-In Manager....
3. Select SP3D References and make sure that the Loaded/Unloaded and Load on
Startup boxes under Load Behavior are both checked.
4. Click OK.
5. Click Project > Speedy References to invoke the dialog.
If this is the first time that you have invoked the tool, it begins reading your system to
generate a data file that contains information about all existing registered type
libraries.

Enter a class or variable name to search - Text can be the complete name or the
first few letters of the item that you want to locate.

Find the typelib

Click the Find button.


The time your search requires depends on how many type libraries can be found
containing your information, but it usually takes only a few seconds.

I-> Result

If your search finds a match, it returns an output dialog consisting of columns that
contain the member name, the type library's complete file path and name, and the
type library description.

Check/uncheck to reference or not the typelib - Allows you to automatically


reference a type library. Being able to reference a type library here saves valuable
time otherwise spent searching using the Project > References command.

Member - The class or variable name to be located in a type library.

Typelib Filename - Complete file path and name.

Typelib Description - Matches the name that you can find in Available References,
when you click Project > References.

28 Intergraph Smart™ 3D Programmer’s Guide


Referencing Data Type Libraries

Display Options

Click to display a popup menu that provides two options: Exact Search
and Update Data.
Exact Search - Off by default and cannot be toggled on permanently. When it is
toggled off, and you enter IJCopy in the text box, the tool returns all references that
are related to this name. You must click Exact Search to return only the member
name IJCopy.

Update Data - Allows you to update your data file. When you update your system
with new or changed type libraries, you need to select this command to regenerate
your data file.

Intergraph Smart™ 3D Programmer’s Guide 29


Referencing Data Type Libraries

Errors Occurring with Visual Basic 6


Several errors can occur when using the Speedy References tool with Visual Basic 6;
however these errors can be resolved with ease.

Speedy References can cause an error when Visual Basic 6 is launched.


This occurs because the tool attempts to add its command name under the
Project menu at the fifteenth position. If the menu has been modified and
doesn't contain at least fourteen items, restore the Project menu as
displayed by the following:

30 Intergraph Smart™ 3D Programmer’s Guide


Referencing Data Type Libraries

If you select the Project > Speedy References command, and it does not
display the utility, then the last screen position of the tool stored in the
Registry is out of the current screen resolution. To resolve this problem,
exit from all Visual Basic programs, and remove the following Registry
key:
HKEY_CURRENT_USER\Software\VB and VBA Program Settings\Speedy
References
This Registry key will be re-created when you start Visual Basic 6 again.

Intergraph Smart™ 3D Programmer’s Guide 31


Creating Custom Commands

Creating Custom Commands


The software provides developers with the ability to extend the software by creating
custom commands. Using Visual Basic, you can create custom commands that group
a series of commands and instructions into a single command in the software. As a
result, you can have customized commands that have direct correlation to the routine
in your particular operation.

The Command Wizard and Speedy References tool are each very useful in creating
custom commands.

The Command Wizard and Speedy References tool are delivered as part of the
Programming Resources. Refer to the Intergraph Smart ™ 3D Installation Guide for
information on installing the Programming Resources components.

The Command Wizard allows you to select relevant tools and methods for a new
Visual Basic project and build a basic command based on those selected
requirements.

The Speedy References tool allows you to locate and reference type libraries quickly
and easily. The ability to reference a type library with this tool saves valuable time
otherwise required when searching using the Project > References command in your
Visual Basic project.

32 Intergraph Smart™ 3D Programmer’s Guide


Creating Custom Commands

Undo Functionality
The TransactionManager service in the software provides the ability to perform
undo functionality in addition to other kinds of transaction notifications such as
commit, abort, or compute.

When you develop a custom command that requires undo functionality, be sure to
include a string in your project that serves as the marker for undo capability.
'////////////////////////////////
'Example of undo
'////////////////////////////////
Dim strPlacePipe As String
oTransaction.Commit(strPlacePipe)

Intergraph Smart™ 3D Programmer’s Guide 33


Customizing the Software

Customizing the Software


The software provides you with the ability of extending its capabilities by
programming in Microsoft Visual Basic using certain aspects of the application
programming interface (API).

ActiveX Components - You can create custom commands by referencing


available dynamic link libraries (DLLs) and run them by using the
Custom Commands command. For more information, see Using ActiveX
Components, page 35
Naming Rules - Each task in the software that creates new parts in the
model automatically generates a name using defined rules. You can create
a custom name rule by creating a COM object that implements the
IJNameRule interface and adds the name rule to the catalog. For more
information, see Customizing Naming Rules, page 36
Custom Supports - You can create a variety of support objects such as
Pipe, Duct, and Cable Tray supports by using available methods on the
IJHgrAutomation interface. For more information, see Customizing
Hangers and Supports, page 49
Project Management - You can create a variety of Project Management
objects such as plants, folders, and permission groups by using available
methods on the IJHierarchy interface and the
ProjectMgmtEntitiesFactory component. For more information, see
Customizing Project Management, page 55
Drawings - You can customize the software by using graphic wrappers to
assist in processing by the drawings generation process. Additionally, you
can customize automatic dimensioning rules by specifying values for
special XML tags. For more information, see Customizing Drawings, page
75

34 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

Using ActiveX Components


ActiveX code components are libraries of objects that can be used by client
components and are created as ActiveX dynamic link libraries (DLLs).

An interface serves as an abstract class or template, providing methods and properties


without any underlying implementation. As the foundation of COM, an interface can
be called an abstract data type, but it cannot be created as such. An interface
represents a contract through which a specific set of object behaviors can be invoked.

You can use an interface to create a reference to an object, but not the object itself.
An interface specifies the functionalities that are guaranteed by an object. One of the
advantages in using an interface is that it allows objects to grow without breaking
earlier functionality, as long as the objects continue to implement the original
interfaces.

The purpose of using interfaces is to encapsulate details (data layout) of the class's
implementation, instead of using data members, to which dependencies can be built.

Note: More than one class can implement the same interface.

Creating an Implementation
Create an ActiveX project as a DLL.
Reference the abstract class.
Include the Implements keyword followed by the name of the abstract
class inside the implementation class module, as follows:
Option Explicit
Implements <Abstract_Class_Name>
Implement your functions and properties of the abstract class in the new
class.

Intergraph Smart™ 3D Programmer’s Guide 35


Customizing the Software

Customizing Naming Rules


Each task in the software that creates new parts in the model automatically generates
a name using defined naming rules. You can use Visual Basic to write your own
custom naming rules by creating COM objects that implement the IJNameRule
interface. Then you can add the naming rule to the Catalog database.

Note: An Excel workbook contains the naming rule definitions, which is provided so
that the naming rules can be loaded into the Catalog database. For information about
the workbook implementation, see the section titled Naming Rules Reference Data:
An Overview in the Reference Data Guide available from the Help > Printable
Guides command in the software.

You can use the following COM objects to create new naming rules:

NameGeneratorService
NamingRulesHelper
CNameRuleAE
The following sections define the minimal set of references that a custom naming rule
needs to have referenced in the Visual Basic project.

The GSCADNameRuleSemantics component provides interfaces, methods, and


properties in which to generate object names automatically. Names for these objects
are composed of a base name, object type, and index. To begin using this component,
reference the Ingr Sp3d Generic NameRuleSemantics 1.0 Type Library,
NameRuleSemantics.dll, in your Visual Basic project.

The GSCADNameGenerator component provides interfaces, methods, and


properties in which to return names and indexes as appropriate. To begin using this
component, reference the Ingr Sp3d NameGenerator 1.0 Type Library,
NameGenerator.dll, in your Visual Basic project.

Important: When creating naming rules or using labels as weld identifiers for
isometric drawings, there must not be any spaces generated in the identifier.

Object Interface Methods/Properties


Custom Name Rule IJNameRule GetNamingParents
ComputeName
CNameRuleAE IJNameRuleAE Frozen
NamingParentsString
NameGeneratorService IJNameCounter GetCount
GetCountEx

36 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

NamingRulesHelper IJDNamingRulesHelper AddNamingRelations


GetActiveNamingRule
GetEntityNamingRulesGivenName
GetEntityNamingRulesGivenProgID
IsGeneratedNameUnique

Custom Name Rule


The custom name rule is the new component to be created. This component
implements the IJNameRule interface, which has the GetNamingParents and
ComputeName methods.

IJNameRule Interface
The IJNameRule interface supports the naming rule implementation for the
GSCADNameRuleSemantics component. The IJNameRule interface is
implemented as the actual naming rule.

The GetNamingParents and ComputeName methods of the IJNameRule interface


allow you to implement generation of object names automatically.

The IJNameRule interface, which implements the naming rule, contrasts with the
IJDNameRuleHolder interface, which holds the naming rule name.

ComputeName Method
Description

This method computes the name for the given entity.

Signature

Function ComputeName(pEntity, pParents, pActiveEntity)

Important: When creating naming rules or using labels as weld identifiers for
isometric drawings, there must not be any spaces generated in the identifier.

Parameters Data Type Description


pEntity Object Required. The object to be named.
pParents IJElements Required. The naming parents collection.

Intergraph Smart™ 3D Programmer’s Guide 37


Customizing the Software

pActiveEntity Object Required. Semantic Active Entity

GetNamingParents Method
Description

This method returns the naming parents from which the name should be derived.

Signature

Function GetNamingParents(pEntity) As IJElements

Parameters Data Type Description


pEntity Object Required. The new object to be named.

38 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

CNameRuleAE Object
The CNameRuleAE object is the active entity for the name rule. An active entity
serves as the hub or management node for relationships in the software.

The relationship mechanism maintains data model consistency when entities are
modified, copied, or deleted. This mechanism maintains referential integrity when
entities are created, connected, or disconnected.

CNameRuleAE is a persistent object that has a relationship to the named object as


well as the naming parents. This object implements the IJNameRuleAE interface.

The CNameRuleAE object is created by the system and is passed to the Custom
Name Rule component.

IJNameRuleAE Interface
The IJNameRuleAE interface supports the naming rule implementation for the
GSCADNameRuleSemantics component.

This interface has two properties, Frozen and NamingParentsString.

Frozen Property
Description

This property returns whether the name of the object is frozen or not.

Signature

Frozen As Long

Intergraph Smart™ 3D Programmer’s Guide 39


Customizing the Software

NamingParentsString Property
Description

This property returns the naming parents string, which contains the Base Name.

Signature

NamingParentsString As String

Important: When creating naming rules or using labels as weld identifiers for
isometric drawings, there must not be any spaces generated in the identifier.

Remarks

This string is returned after generating the name of an object. Then it is used with the
ComputeName method of the IJNameRule interface to decide whether there should
be a new index number created.

40 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

NameGeneratorService Object
The NameGeneratorService class supports the naming rule implementation for the
GSCADNameGenerator component.

This class is the middle tier service that implements the IJNameCounter interface.

IJNameCounter Interface
The IJNameCounter interface supports the naming rule implementation for the
GSCADNameGenerator component.

The GetCount, GetCountEx, and GetCountRange methods of the IJNameCounter


interface provide a counter based on the base name. The base name is translated into a
moniker and resolved in the database.

Intergraph Smart™ 3D Programmer’s Guide 41


Customizing the Software

GetCount Method
Description

This method returns a new index number when the NamingParentsString property
of the IJNameRuleAE interface and the current base name are different.

Signature

Function GetCount(pResourceManager, strBaseName) As Long

Parameters Data Description


Type
pResourceManager Unknown Required. The new object to be named.
strBaseName String Required. The name translated into a moniker and
resolved in the database.

Remarks

If the base name is found in the database, the counter is incremented by one. If not, a
new object is created and the count is returned as one.

42 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

GetCountEx Method
Description

This method returns the count and the location prefix.

This method returns a new index number when the NamingParentsString property
of the IJNameRuleAE interface and the current base name are different.

Signature

Function GetCountEx(pResourceManager, strBaseName, strLocation) As Long

Parameters Data Description


Type
pResourceManager Unknown Required. The new object to be named.
strBaseName String Required. The name translated into a moniker and
resolved in the database.
strLocation String Required. The specified area at the site containing
the databases.

Remarks

If the base name is found in the database, the counter is incremented by one. If not, a
new object is created and the count is returned as one.

Intergraph Smart™ 3D Programmer’s Guide 43


Customizing the Software

GetCountRange Method
Description

The GetCountRange method returns a unique index to a counter based on the base
name and an option to customize the user range.

This method is similar to the GetCountEx method except that the user range received
from the COM server can be customized. To reduce gaps between numbers, a lesser
value than ten (default) can be passed in for user range. If less than ten is entered,
more DCOM calls will be made to the COM server, which impacts performance.

Signature

Function GetCountRange(pResourceManager, strBaseName, strLocation,


userRange) As Long

Parameters Data Description


Type
pResourceManager Unknown Required. The new object to be named.
strBaseName String Required. The name translated into a moniker and
resolved in the database.
strLocation String Required. The name of the location.
userRange Long Required. The user range - default = 10. Lower
values reduce the gaps. Range should be less than
range at the COM server.

Remarks

Error Codes

S_OK = operation succeeded

E_INVALIDARG = invalid argument passed in

E_UNEXPECTED = unexpected exception occurred during execution

44 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

NamingRulesHelper Object
The NamingRulesHelper object is the middle tier service that implements the
IJDNamingRulesHelper interface.

IJDNamingRulesHelper Interface
The IJDNamingRulesHelper interface is used by commands to associate a business
object to a name rule and to determine if a name is unique.

The GetEntityNamingRulesGivenName, GetEntityNamingRulesGivenProgID,


AddNamingRelations, GetActiveNamingRule, and IsGeneratedNameUnique
methods of the IJDNamingRulesHelper interface provide the ability for commands
to get naming rules, to add naming relations, and to get the active naming rule to be
used for naming the object.

The IsGeneratedNameUnique method is typically used by a custom name rule to


verify that the name is unique. It is typically only used when one of the methods on
the IJNameRuleCounter interface is not used to return a unique counter for a name.

The other methods listed are used by commands that are assigning a name rule to an
object or getting a list of name rules for a specific object type.

Intergraph Smart™ 3D Programmer’s Guide 45


Customizing the Software

AddNamingRelations Method
Description

This method adds naming relations after creating the active entity and returns a
reference to the IJNameRuleAE interface of the active entity object created. The
method deletes the active entity if it is there before creating the new one so it can also
be used to delete the relations. If nothing is sent as the pNameRuleHolder argument,
the method deletes the existing relations.

Signature

Function AddNamingRelations(pDispEntity, pNameRuleHolder, pActiveEntity)

Parameters Data Type Description


pDispEntity Object Required. The new object to be named.
pNameRuleHolder IJDNameRuleHolder Required. The interface of the naming
rule.
pActiveEntity IJNameRuleAE Required. The interface of the active
entity object.

GetActiveNamingRule Method
Description

This method returns a reference to the IJDNameRuleHolder interface of the active


naming rule that is being used for naming the input object. The pNameRuleHolder
argument returns nothing if there are no active naming rules on the object.

Signature

Function GetActiveNamingRule(pDispEntity, pNameRuleHolder)

Parameters Data Type Description


pDispEntity Object Required. The new object to be named.
pNameRuleHolder IJDNameRuleHolder Required. The interface of the naming
rule.

46 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

GetEntityNamingRulesGivenName Method
Description

This method returns a reference to the IJElements interface of the first object in a
collection of the naming rules. These rules are available in the Catalog database for
the given object name input.

Signature

Function GetEntityNamingRulesGivenName(strEntityName, NamingRules)

Important: When creating naming rules or using labels as weld identifiers for
isometric drawings, there must not be any spaces generated in the identifier.

Parameters Data Type Description


strEntityName String Required. The new object's name.
NamingRules IJElements Required. The interface of the first object in the
collection.

GetEntityNamingRulesGivenProgID Method
Description

This method returns a reference to the IJElements interface of the first object in a
collection of the naming rules. These rules are available in the Catalog database for
the given class ProgID input.

Signature

Function GetEntityNamingRulesGivenProgID(strEntityProgID, NamingRules)

Parameters Data Type Description


strEntityProgID String Required. The ProgID of the new object to be named.
NamingRules IJElements Required. The interface of the first object in the
collection.

Intergraph Smart™ 3D Programmer’s Guide 47


Customizing the Software

IsGeneratedNameUnique Method
Description

The IsGeneratedNameUnique method returns a Boolean specifying whether the


new name is unique in the domain specified by the given oFilter parameter. The
name is unique if the method returns True.

Signature

Function IsGeneratedNameUnique(oEntity, oFilter, strGenName, [strIID],


[strAttributeName]) As Boolean

Important: When creating naming rules or using labels as weld identifiers for
isometric drawings, there must not be any spaces generated in the identifier.

Parameters Data Type Description


oEntity Object Required. The new object to be named.
oFilter IJSimpleFilter Required. The interface of the Filter to use in
determining the uniqueness.
strGenName String Required. The generated name string.
strIID String Optional. An IID as a string to help in making
the determination. If the IID is provided then
strAttributeName must be provided. The default
is a null string.
strAttributeName String Optional. An AttributeName as a string to help
in making the determination. The default is a null
string.

Remarks

This method is typically used by a custom name rule to verify that the name is
unique. It is typically only used when one of the methods on the
IJNameRuleCounter interface is not used to return a unique counter for a name.

48 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

Customizing Hangers and Supports


The HgrSupProgAutoComp component provides the following methods in which to
create different types of support objects such as pipe, duct, and cable tray supports.

Object/Interface Methods
IJHgrAutomation CreateSupport
ModifySupport

Before using the HgrSupProgAutoComp component, a connection to the data store


must be established. This connection is made by starting the services of the Session
Manager, Transaction Manager, and Command Manager.

To begin using this component, reference HgrSupProgAutoComp.dll in the Visual


Basic project.

IJHgrAutomation Interface
The IJHgrAutomation interface supports the creation and modification functionality
for the HgrSupProgAutoComp component.

The CreateSupport and ModifySupport methods of the IJHgrAutomation


interface allow you to create and modify support objects such as pipes, ducts, and
cable trays.

CreateSupport Method
CreateSupport Method Example, page 54

Description

This method creates the support object.

Signature

Function CreateSupport(eHgrDisciplineType, [oParent], [dblMaxLoad],


[oSupportedObjects], [oSupportingObjects], [oLocation], [bRule],
[oSupportAssembly], [strSupportName], [strSupportRuleName]) As Object

Intergraph Smart™ 3D Programmer’s Guide 49


Customizing the Software

Parameters Data Type Description


eHgrDisciplineType HgrDisciplineType Required. The discipline type of the
support that is being created:
HgrPipingDisciplineType = 1
HgrHVACDisciplineType = 2
HgrPipingHVACDisciplineType = 3
HgrCableWayDisciplineType = 4
HgrCableWayPipingDisciplineType = 5
HgrCableWayDuctDisciplineType = 6
HgrCableWayPipingDuctDisciplineType
=7
HgrConduitDisciplineType = 8
HgrConduitPipingDisciplineType = 9
HgrConduitDuctDisciplineType = 10
HgrConduitPipingDuctDisciplineType =
11
HgrConduitCableWayDisciplineType =
12
HgrEquipmentDisciplineType = 16
HgrCombinedDisciplineType = 256
HgrAllDisciplineType = 511
oParent Object Optional. The parent for the support.
dblMaxLoad Double Optional. The maximum load a support
can carry.
oSupportedObjects Object Optional. The supported object collection
for the support.
oSupportingObjects Object Optional. The supporting object
collection for the support.
oLocation Object Optional. The location of the support by
point case.
bRule Boolean Optional. The flag to indicate whether to
run the assembly selection rule.
oSupportAssembly Object Optional. The support assembly for the
support.
strSupportName String Optional. The name of the support.
strSupportRuleName String Optional. The naming rule for the
support.

50 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

Remarks

If bRule and oSupportAssembly are specified, then the support assembly is considered
only when the rule fails. If strSupportName and strSupportRuleName are given, then
strSupportName is ignored.

Intergraph Smart™ 3D Programmer’s Guide 51


Customizing the Software

ModifySupport Method
Description

This method modifies the support object.

Signature

Function ModifySupport(oSupport, [oParent], [dblMaxLoad], [oSupportedObjects],


[oSupportingObjects], [oLocation], [bRule], [oSupportAssembly], [strSupportName],
[strSupportRuleName]) As Object

Parameters Data Type Description


oSupport IJHgrSupport Required. The support that is being modified.
oParent Object Optional. The parent for the support.
dblMaxLoad Double Optional. The maximum load a support can
carry.
oSupportedObjects Object Optional. The supported object collection for
the support.
oSupportingObjects Object Optional. The supporting object collection for
the support.
oLocation Object Optional. The location of the support by point
case.
bRule Boolean Optional. The flag to indicate whether to run
the assembly selection rule.
oSupportAssembly Object Optional. The support assembly for the
support.
strSupportName String Optional. The name of the support.
strSupportRuleName String Optional. The naming rule for the support.

52 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

Remarks

If bRule and oSupportAssembly are specified, then the support assembly is considered
only when the rule fails. If strSupportName and strSupportRuleName are given, then
strSupportName is ignored.

Intergraph Smart™ 3D Programmer’s Guide 53


Customizing the Software

CreateSupport Method Example


For more specific information about using the IJHgrSupport interface and the application
programming interface (API), please contact Intergraph Services.
'/////////////////////////////////////////////////////////////////////////
Dim oHgrAutomation As IJHgrAutomation
Dim oHgrSupport As IJHgrSupport

Set oHgrAutomation = New HgrSupProgAutoComp.ProgAutoComp

'/////////////////////////////////////////////////////////////////////////
'// System, supported objects, supporting objects, and support assembly
'// to be supplied by user.
'////////////////////////////////////////////////////////////////////////
Set oHgrSupport = oHgrAutomation.CreateSupport(1, oSystem, 10#,
SupportedList, _
SupportingList, Nothing, True, oSupportAssembly, "Automation")
- - - -
- - - -
- - - -
- - - -
'/////////////////////////////////////////////////////////////////////////
'// Set the maximum load for the support with the MaxLoad method
'////////////////////////////////////////////////////////////////////////

oHgrSupport.MaxLoad = 10.0

54 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

Customizing Project Management


The following objects and methods allow you to create Project Management objects
using Automation such as plants/ships, folders, and permission groups. The
ProjectMgmtEntitiesFactory object and IJHierarchy and
IJBackupRestoreHelper interfaces are accessed by referencing the Ingr Sp3d
ProjectMgmtEntities 1.0 Type Library.

Object/Interface Methods
ProjectMgmtEntitiesFactory AddLocation
AttachPDSProject
CreateProjectRoot
CreateModelDatabaseObject
CreateCatalogDatabaseObject
CreateFolder
CreatePermissionGroup
CreateAccessControlRule
CreateReportsDatabaseObject
CreateDBObject
GetNameGeneratorServerPath
GetPDSSite
ValidateNameServer

In addition to creating objects, the following methods of the IJHierarchy interface


allow you to return the collection of plant/ship objects and, given a plant/ship object,
to traverse the project folders and permission groups.

IJHierarchy GetDisplayChildren
Parent

In addition to creating objects, the following method of the IJAccessRuleHelper


interface allows you to add access control rules by returning the
IJAccessControlRule interface. This interface is accessed by referencing the Ingr
SP3D ProjMgmt 1.0 Type Library.

IJAccessRuleHelper AddAccessControlRule

The following methods on the IJBackupRestoreHelper interface allow you to


perform validated backup and restore functionality.

Intergraph Smart™ 3D Programmer’s Guide 55


Customizing the Software

IJBackupRestoreHelper BackupPlantDatabases
RestorePlantDatabases

56 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

ProjectMgmtEntitiesFactory Object
The ProjectMgmtEntitiesFactory object provides the methods in which to create
objects such as Plant/Ship, Folder, Permission Group, Access Control Rule, and
so forth.

Before using the ProjectMgmtEntitiesFactory object, a connection to the data store


must be established. This connection is made by starting the services of the Session
Manager, Transaction Manager, and Command Manager.

To begin using this object, reference Ingr Sp3d ProjectMgmtEntities 1.0 Type
Library, ProjectMgmtEntities.dll, in the Visual Basic project.
'///////////////////////////////////////////////////
'// Example using ProjectMgmtEntitiesFactory object
'///////////////////////////////////////////////////////////////////
Dim oProjectMgmtEntitiesFactory As IJProjectMgmtEntitiesFactory
Set oProjectMgmtEntitiesFactory = New ProjectMgmtEntitiesFactory

Intergraph Smart™ 3D Programmer’s Guide 57


Customizing the Software

AddLocation Method
Description

The method creates a Location object.

Signature

Function AddLocation(pResourceManager As Unknown) As Object

Parameters Data Description


Type
pResourceManager Unknown Required. Resource Manager of the Project
connection for adding access control rules in the
case of project root and database. For adding rules
for permission groups, this should be defined for
Model or Catalog connections depending on the
location of the permission group under the model or
the catalog.

Remarks

You must define the project connection as the active connection on the WorkingSet.

58 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

AttachPDSProject Method
Description

This method references a PDS project (Model) to the selected model (Plant/Ship).

Signature

Function AttachPDSProject(pResourceManager, pIJDProjectRoot, pIJLocation,


PDSDBName) As Object

Parameters Data Description


Type
pResourceManager Unknown Required. Resource Manager of the Model or
Catalog connection depending on whether created
under plant/ship or catalog
pIJDProjectRoot Unknown Required. Plant/Ship or Project Root object
pIJLocation Location Optional. Can be NULL.
PDSDBName String Required. PDS Project name

Remarks

You must set the permission group ID of the Project Root = active condition ID and
the project connection = active connection on the WorkingSet. There can be only one
PDS project attached (referenced) to a plant/ship.

Intergraph Smart™ 3D Programmer’s Guide 59


Customizing the Software

CreateProjectRoot Method
Description

This method creates the Plant/Ship object.

Signature

Function CreateProjectRoot(pResourceManager, pIJLocation) As Object

Parameters Data Description


Type
pResourceManager Unknown Required. Resource Manager of the Project
Connection
pIJLocation Location Required. The specified area at the site containing
the databases.

Remarks

You must define the project connection = active connection and the condition ID on
the WorkingSet = "8" (PROJMGMT_PERMISSIONID).

Error Codes

E_ACCESSDENIED = -2147024891

60 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

CreateModelDatabaseObject Method
Description

This method creates the Model database object.

Signature

Function CreateModelDatabaseObject(pResourceManager, pIJDProjectRootUnk,


pIJLocation, strDatabaseProviderType, schema, server, physDbName,
[bIsDatabaseInitialised]) As Object

Parameters Data Description


Type
pResourceManager Unknown Required. Resource Manager of the Model or
Catalog connection depending on whether
created under plant or catalog
pIJDProjectRootUnk Unknown Required. Plant/Ship or Project Root object
pIJLocation Location Required. The specified area at the site
containing the databases.
strDatabaseProviderType String Required. The database provider type
schema String Required. Schema connection string
server String Required. Server name
blsDatabaseInitialised Boolean Optional. Default = True

Remarks

You must define the project connection = active connection on the WorkingSet.

Error Codes

lDISK_NO_SPACE = -2147216355

E_ACCESSDENIED = -2147024891

Intergraph Smart™ 3D Programmer’s Guide 61


Customizing the Software

CreateCatalogDatabaseObject Method
Description

This method creates the Catalog database object.

Signature

Function CreateCatalogDatabaseObject(pResourceManager, pIJDProjectRoot,


pIJLocation, strDatabaseProviderType, physDbName, server,
strSchemaDatabaseName, strSchemaServerName) As Object

Parameters Data Description


Type
pResourceManager Unknown Required. Resource Manager of the Project
Connection
pIJDProjectRoot Unknown Required. Plant/Ship or Project Root object
pIJLocation Location Required. The specified area at the site
containing the databases.
strDatabaseProviderType String Required. The database provider type.
physDbName String Required. Actual database name
server String Required. Server name
strSchemaDatabaseName String Required. Schema database name
strSchemaServerName String Required. Schema server name

Remarks

You must define the project connection = active connection on the WorkingSet.

Error Codes

E_ACCESSDENIED = -2147024891

CreateFolder Method
Description

This method creates the Folder object.

Signature

Function CreateFolder(pResourceManager, pParentFolder) As Object

Parameters Data Description


Type

62 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

pResourceManager Unknown Required. Resource Manager of the Model or


Catalog connection depending on whether created
under plant or catalog
pParentFolder IJFolder Required. Folder Parent object

Remarks

You must define the active connection on the WorkingSet as follows:

Creating Folder under Model (Plant/Ship) = Model connection


Creating Folder under Catalog = Catalog connection
The condition ID of the plant or catalog under which the folder is created should be
set as the active condition ID on the WorkingSet.

If the folder is created under another folder, the Input folder parent object should be
set = "Nothing".

Error Codes

E_INVALIDHIERARCHY = -2147220224

E_ACCESSDENIED = -2147024891

CreatePermissionGroup Method
Description

This method creates the Permission Group object.

Signature

Function CreatePermissionGroup(pResourceManager, pFolder, pIJLocation) As


Object

Parameters Data Description


Type
pResourceManager Unknown Required. Resource Manager of the Model or
Catalog connection depending on whether created
under plant/ship or catalog
pFolder IJFolder Required. Folder object
pIJLocation Location Required. The specified area at the site containing
the databases.

Remarks

Intergraph Smart™ 3D Programmer’s Guide 63


Customizing the Software

You must define the active connection on the WorkingSet as follows:

Creating Folder under Model (Plant/Ship) = Model connection


Creating Folder under Catalog = Catalog connection
The condition ID of the plant/ship or catalog under which the folder is created should
be set as the active condition ID on the WorkingSet.

You must define the project connection = active connection on the WorkingSet.

Error Codes

E_INVALIDHIERARCHY = -2147220224

E_ACCESSDENIED = -2147024891

CreateAccessControlRule Method
Description

This method creates the Access Control Rule object.

Signature

Function CreateAccessControlRule(pResourceManager) As Object

Parameters Data Description


Type
pResourceManager Unknown Required. Resource Manager of the Project
connection for adding access control rules on the
Plant/Ship or Catalog. For creating rules for
permission groups, this should be defined for Model
or Catalog depending on the location of the
permission group. If permission group is under
Model/Catalog database, then that type of
connection is required.

Remarks

You must define the active connection on the WorkingSet as follows:

For Plant/Ship or Catalog objects = Project connection


For Permission Groups under Model/Catalog = Model/Catalog connection
Note: Default permissions should be defined after the Access Control Rule objects
are created for the Plant/Ship or Catalog. There should be at least one user defined
with "Full Control".

64 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

Error Codes

E_ACCESSDENIED = -2147024891

CreateReportsDatabaseObject Method
Description

This method creates the Reports database object.

Signature

Function CreateReportsDatabaseObject(pResourceManager, pIJDProjectRoot,


pIJLocation, ReportDbName, DatabaseServer, SchemaName, SchemaServer) As
Object

Parameters Data Description


Type
pResourceManager Unknown Required. Resource Manager of the Project
Connection
pIJDProjectRoot Unknown Required. Plant/Ship or Project Root object
pIJLocation Location Required. The specified area at the site containing
the databases.
ReportDbName String Required. Reports database name
DatabaseServer String Required. Reports database server name
SchemaName String Required. Reports schema name
SchemaServer String Required. Reports schema server name

Remarks

You must define the project connection = active connection on the WorkingSet.

Error Codes

lDISK_NO_SPACE = -2147216355

E_ACCESSDENIED = -2147024891

Intergraph Smart™ 3D Programmer’s Guide 65


Customizing the Software

IJHierarchy Interface
In addition to creating objects, GetDisplayChildren and GetParent methods of the
IJHierarchy interface allow you to return the collection of plant objects and, given a plant
object, to traverse the project folders and permission groups.

The classes that implement the IJHierarchy interface are ProjectCollection, ProjectRoot,
Database, Folder and PermissionGroup classes respectively.
'/////////////////////////////////////////////////////////////////////////
'// Example using methods of IJHierarchy and the ProjectCollection object.
'// Similarly, use the GetParent method to return the parent.
'///////////////////////////////////////////////////////////////////////
Dim oProjectsColl as IJProjectsCollection
Set oProjectsColl = oProjMgmtfactory. GetProjectsCollectionObject _
(oConnection.ResourceManager)
Dim oHierarchy As IJHierarchy
Set oHierarchy = oProjectsColl
Dim oChildren as IJDObjectCollection

Set oChildren = oHierarchy.GetDisplayChildren(oConnection.ResourceManager)

66 Intergraph Smart™ 3D Programmer’s Guide


Customizing the Software

GetDisplayChildren Method
Description

This method returns the children of the object.

Signature

Function GetDisplayChildren(pResourceManager) As IJDObjectCollection

Parameters Data Description


Type
pResourceManager Unknown Required. Resource Manager of the
Project/Model/Catalog connection, depending on
the object that is used

Remarks

You must input the connection resource managers as follows:

Project Collection For Project connection


Project Root For Model connection
Catalog Database For Catalog connection
Folder Under a Plant/Ship - For Model connection
Under a Catalog - For Catalog connection
Permission Group Under a Plant/Ship - For Model connection
Under a Catalog - For Catalog connection

Parent Property
Description

This property returns the parent of the object.

Signature

Parent As Object

IJAccessRuleHelper Interface
The IJAccessRuleHelper interface provides the means for access control rules to be
added.

Intergraph Smart™ 3D Programmer’s Guide 67


Customizing the Software

AddAccessControlRule Method
Description

The method returns the access control rule as IJAccessControlRule.

Signature

Function AddAccessControlRule(pResourceManager As Unknown, strUserName


As String, strAccessRight As String, [IsCurrentUser As Boolean = False]) As
IJAccessControlRule

Parameters Data Description


Type
pResourceManager Unknown Required. Resource Manager of the Project
connection for adding access control rules in the
case of project root and database. For adding rules
for permission groups, this should be defined for
Model or Catalog connections depending on the
location of the permission group under the model or
the catalog.
strUserName String Required. If IsCurrentUser = True, define = NULL.
strAccessRight String Required. If IsCurrentUser = True, define = NULL.
IsCurrentUser Boolean Optional. Default value = False. If True, define
strUserName and strAccessRight = NULL.

68 Intergraph Smart™ 3D Programmer’s Guide

You might also like