Drawing by Rule Programming Guide 2011R1
Drawing by Rule Programming Guide 2011R1
Programming Guide
January 2014
DSP3D-PE-200142A
Copyright
®
Copyright © 1999-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.
Terms of Use
Use of this software product is subject to the End User License Agreement ("EULA") delivered with this 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. 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.
Trademarks
Intergraph and the Intergraph logo are registered trademarks of Intergraph Corporation. Microsoft and Windows are registered
trademarks of Microsoft Corporation. Other brands and product names are trademarks of their respective owners.
Contents
Overview ....................................................................................................................................................... 5
Views .............................................................................................................................................. 19
Examples .................................................................................................................................................... 24
Document Setup ................................................................................................................................... 24
Index ........................................................................................................................................................... 27
Document Wrapper Class (on page 16) - A drawings by rule automation document class
wrapper that aggregates the DwgByRuleDocument business object. After the business object is
set, you can use this wrapper when the DwgByRuleDocument business object is also used.
Sheet Wrapper Class (on page 19) - A drawings by rule automation sheet class wrapper that
represents a single sheet within a document.
View Wrapper Class (on page 21) - A drawings by rule automation view class wrapper that
aggregates the DwgByRuleView business object. After the business object is set, you can use this
wrapper when the DwgByRuleView business object is also used.
See Also
Examples (on page 23)
IJDBRFactoryW Methods
Each method has the following return error codes:
CreateGraphicView
Returns a view class wrapper for a newly created graphic view business object. The method does
not generate the preview for the view.
CreateGraphicView(
ByVal pdispInputs as Object,
ByVal pViewDef as IJXDBRViewDefinition) as IJDBRViewW
Parameters
[in] pViewDef The view definition controlling the graphic view creation.
CreateSnapIn
Returns a snap-in class wrapper for a newly created snap-in business object.
CreateSnapIn(
ByVal pParent as IJDDwgParent,
ByVal bstrPackage as String) as IJDBRSnapInW
Parameters
[in] pParent The parent within the drawing hierarchy of the new snap-in business
object.
[in] bstrPackage The name of the package to use when creating of the snap-in business
object.
GetDBRObjectStorage
Returns the object storage for a view business object.
GetDBRObjectStorage(
ByVal bstrViewDBID as String,
ByVal bForceCreate as Boolean,
ByRef ppStorageMgr as IJDBRObjectStorageMgr,
ByRef ppStorage as IJDBRObjectStorage) as IJDBRSnapInW
Parameters
[in] bForceCreate A flag indicating that the object storage should be created if it does not
exist.
[out] ppStorageMgr The object storage manager, required to remove the object storage if it
was created by this call.
GetSnapIn
Returns a snap-in class wrapper for an existing snap-in business object.
GetSnapIn(ByVal vSnapIn as Variant) as IJDBRSnapInW
Parameters
[in] vSnapIn The snap-in to return for a class wrapper . This can be any of the
following:
The moniker of the snap-in business object
The actual snap-in business object
The DBID string of the snap-in business object
GetTemporaryFileName
Returns a snap-in class wrapper for a newly created snap-in business object.
GetTemporaryFileName(ByVal bstrExtension as String) as String
Parameters
IJDBRSnapInW Methods
Each method has the following return error codes:
AddNewDocument
Returns a document class wrapper for a newly created sheet business object.
AddNewDocument() as IJDBRDocumentW
This method has no parameters.
AddUnassignedView
Adds the view as being unassigned in the snap-in.
AddUnassignedView(ByVal pViewW as IJDBRViewW)
Parameters
AddUnassignedViews
Adds the views within the collection as being unassigned in the snap-in.
AddUnassignedViews(ByVal pViews as IJDObjectCollection)
Parameters
GetCustomData
Gets the keyed custom data related to the snap-in business object.
GetCustomData(ByVal bstrKey as String) as Variant
Parameters
[in] bstrKey The key to the stored data. By specifying different keys, more than one
piece of custom data can be stored for a snap-in business object.
GetCustomDataFile
Gets the keyed custom data file related to the snap-in business object.
GetCustomDataFile(ByVal bstrKey as String) as String
Parameters
[in] bstrKey The key to the stored data file. By specifying different keys, more than
one custom data file can be stored for a snap-in business object.
GetDocument
Returns a document class wrapper contained within the snap-in.
GetDocument(ByVal bstrDBID as String) as IJDBRDocumentW
Parameters
[in] bstrDBID The DBID of the sheet business object to return for the document class
wrapper.
GetView
Returns a view class wrapper that is unassigned contained within the snap-in.
GetView(ByVal vView as Variant) as IJDBRViewW
Parameters
[in] vView The view in which to return a class wrapper. The view can be any of
the following:
The moniker of the view business object
The actual view business object
The DBID string of the view business object
PrepareForCommit
Prepares the API for a commit to be done. All business objects are released.
PrepareForCommit(ByVal bFlushRAD as Boolean)
Parameters
[in] bFlushRAD Indicates that all RAD pointers should also be released.
You should call this method before every Commit/Abort is done in the calling unit.
RemoveUnassignedView
Removes the view as being unassigned in the snap-in.
RemoveUnassignedView(ByVal pViewW as IJDBRViewW)
Parameters
SetCustomData
Sets the keyed custom data related to the snap-in business object. The data is currently blobbed
as a string in the database.
SetCustomData(ByVal bstrKey as String, ByVal vData as Variant)
Parameters
[in] bstrKey The key to the stored data. By specifying different keys, more than one
piece of custom data can be stored for a snap-in business object.
SetCustomDataFile
Sets the keyed custom data file related to the snap-in business object. The file is zipped and
blobbed in the database.
SetCustomDataFile(ByVal bstrKey as String, bstrFileName as String)
Parameters
[in] bstrKey The key to the stored data file. By specifying different keys, more than
one custom data file can be stored for a snap-in business object.
[in] bstrFileName The full path of the file to be saved to the database.
IJDBRSnapInW Properties
Each property has the following return error codes:
Documents
The collection of document class wrappers contained within the snap-in.
Documents() as IJDObjectCollection
Modifiability: Read only
Template
The template class wrapper to be used by the snap-in.
Template() as IJDDBRTemplateW
Modifiability: Read only
IJDBRTemplateW Methods
Each method has the following return error codes:
GetNewDocument
Returns a document class wrapper that contains a newly created RAD document that is not
associated with a sheet business object.
GetNewDocument() as IJDBRDocument
This method has no parameters.
IJDBRTemplateW Properties
Each property has the following return error codes:
DocumentAssignmentRule
The document assignment rule specified within the template.
DocumentAssignmentRule() as String
Modifiability: Read only
DocumentNamingRule
The document naming rule specified within the template.
DocumentNamingRule() as String
Modifiability: Read only
SheetAssignmentRule
The sheet assignment rule specified within the template.
SheetAssignmentRule() as String
Modifiability: Read Only
SheetNamingRule
The sheet naming rule specified within the template.
SheetNamingRule() as String
Modifiability: Read Only
SnapIn
The snap-in class wrapper to which this template belongs.
SnapIn() as IJDBRSnapInW
Modifiability: Read Only
IJDBRDocumentW Methods
Each method has the following return error codes:
Delete
Deletes the sheet business object associated with this document class wrapper.
Delete()
This method has no parameters.
No other methods or properties should be called on the document class wrapper after
Delete has been called.
RunLayout
Runs the layout on the document.
RunLayout(ByVal pProgress as IJDDwgProgress)
Parameters
[in] pProgress The progress object on which to send messages. You can use a NULL
value.
RunRules
Runs the rules on a document, resulting in the following:
Runs the collation rule on each view definition in the setup.
Creates all needed views.
Generates the preview for all newly created views.
Assigns the views to the document and runs the layout.
Creates overflow documents if supported and continues placing views and running layout on
those overflow documents.
Places any remaining views into the unassigned folder of the snap-in.
Moves any views no longer needed from the document to the unassigned folder of the snap-in.
RunRules(ByVal pProgress as IJDDwgProgress)
Parameters
[in] pProgress The progress object to send messages to. You can use a NULL value.
For more information on rules, see the followingsections in the Drawings and Reports
Reference Data Guide:
Collation Rules in Drawings by Rule
Orientation Rules in Drawings by Rule
Layout Style Rules in Drawings by Rule
IJDBRDocumentW Properties
Each property has the following return error codes:
Sheets
The sheet class wrappers within this document.
Sheets() as IJDObjectCollection
Modifiability: Read Only
SnapIn
The snap-in class wrapper to which this document belongs.
SnapIn() as IJDBRSnapInW
Modifiability: Read Only
ViewBuilder
The setup for this document, implemented as an IJXSetUp object.
ViewBuilder() as Object
Modifiability: Read Only
Views
The view class wrappers in this document.
Views() as IJDObjectCollection
Modifiability: Read Only
IJDBRSheetW Methods
Unless otherwise noted, each method has the following return error codes:
AssignView
Assigns the view to this sheet. This method returns True if the sheet accepts the view or False if
the sheet rejects the view.
AssignView(ByVal pViewW as IJDBRViewW) as Boolean
Parameters
AssignViews
Assigns the views within the collection to this sheet. Returns a collection of view class wrappers
that are rejected by the sheet.
AssignViews(ByVal pViews as IJDObjectCollection) as IJDObjectCollection
Parameters
RunLayout
Runs the layout on the sheet.
RunLayout(ByVal pProgress as IJDDwgProgress)
Parameters
[in] pProgress The progress object on which to send messages. You can use a NULL
value.
IJDBRSheetW Properties
Each property has the following return error codes:
Regions
The regions contained on this sheet.
Regions() as IJDObjectCollection
Modifiability: Read Only
IJDBRViewW Methods
Unless otherwise noted, each method has the following return error codes:
GeneratePreview
Generates the preview for the view.
GeneratePreview()
This method has no parameters.
GetViewStyle
Returns the view style object for this view.
GetViewStyle() as IJXViewStyle
This method has no parameters.
Setup
Sets up the view based on the inputs and the view definition.
Setup(ByVal pdispInputs as Object, pViewDef as IJXDBRViewDefinition)
Parameters
UpdateQueries
Updates the stored query for the view when parameter inputs are different than current inputs.
Returns True when an update occurs or False when an update does not occur.
UpdateQueries(ByVal pdispInputs as Object) as Boolean
Parameters
IJDBRViewW Properties
Each property has the following return error codes:
Sheet
The sheet class wrapper for this view.
Sheet() as IJDBRSheetW
Modifiability: Read Only
Examples
Document Setup
This sample code shows the calls to the API for running setup at the document level.
try
{
// create a new factory class wrapper to get the snapin
Type TYPE_DBRFactoryW =
Type.GetTypeFromProgID("DrawingByRuleAPI.DBRFactoryW");
API.IJDBRFactoryW oFactoryW =
(API.IJDBRFactoryW)Activator.CreateInstance(TYPE_DBRFactoryW);
oFactoryW.GetSnapIn("{000FDE93-0000-0000-6D01-1669D5521F04}");
(API.IJDDwgProgress)Activator.CreateInstance(TYPE_CShipDwgLog2);
I V
IJDBRDocumentW Methods • 16 View Wrapper Class • 21
IJDBRDocumentW Properties • 18 ViewBuilder • 18
IJDBRFactoryW Methods • 7 Views • 19
IJDBRSheetW Methods • 19
IJDBRSheetW Properties • 20