July 07, 2009

The age of your features

Some weeks ago I showed you how to develop a DocumentAdminPage. This time I would like to take the same example and extend it a little bit.

The new plug-in does a pretty simple job. It goes through the TB_UFID table and analyzes when a feature has been modified the last time. The result of this analysis will be shown in the list view at the bottom. The plug-in also lets you decide if you want to analyze all or just some of the feature classes in the document.

Compared to the first version of the sample I have added a list of feature classes, an "Analyze" button and a list containing the results in the UI.

FeatureHistory   

The main logic is implemented in the Analyze() method (called from btnAnalyze_Click()).

 /// <summary>
 /// Analyzes the TB_UFID table for the selected feature classes.
 /// </summary>
 /// <returns>The number of features grouped by <see cref="Age"/>. </returns>
 private HashMap<Age, int> Analyze(IEnumerable<FeatureClass> featureClasses)
 {
  // create the result hashmap
  HashMap<Age, int> results = new HashMap<Age, int>();
  ...
 }

The method itself is pretty simple. It executes the following SQL statement:

  select touch_ts from TB_UFID where f_class_id = {0}

for each feature class and then it categorizes the features by age (older than...).

You have now two choices, try to develop it by yourself (~200 lines of code) or download the project file from here: 

Topobase.Insiders.FeatureHistory.zip (10.9K)

Of course this sample plug-in is not yet finished! Still a lot of important stuff is missing. For instance the Analyze method is working in the GUI thread which prevents the user from interacting with the Administrator. There is also no progress of the Analyze method visible to the user. The user just has to wait until the method finished. We'll see if we can fix that for the next week :-)

AUTODESK DOES NOT GUARANTEE THAT YOU WILL BE ABLE TO SUCCESSFULLY DOWNLOAD OR IMPLEMENT ANY SAMPLE CODE. SAMPLE CODE IS SUBJECT TO CHANGE WITHOUT NOTICE TO YOU. AUTODESK PROVIDES SAMPLE CODE "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL AUTODESK OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF DATA, OR LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, THAT MAY OCCUR AS A RESULT OF IMPLEMENTING OR USING ANY SAMPLE CODE, EVEN IF AUTODESK OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

June 23, 2009

Google, Bing and the Position Finder

Within Topobase there are plenty of possibilities to find features. The most powerful way is probably using the Topobase Forms. Here you can search for almost everything. Either with a simple filter, an SQL filter, a geographic filter or a projection through foreign keys. Another easy way is the Advanced Generate Graphic. This button can be found under the Generate Graphic button in the Home - Display ribbon. Within the Advanced Generate Graphic dialog we put a control called Position Finder. The position finder is a one to many steps guide for finding a feature. For instance the user wants to search for an address, then he starts the address search, selects first the street and in the next step he selects the right building number. After he has done that he generates the graphic around this feature.

I like the concept of the position finder because it is a guided process where the search will give the user in 100% of the cases the correct result. If he searches for a Hydrant, he'll find it.

Why not taking the position finder out of the Advanced Generate Graphic dialog and place it somewhere more prominent. We could put it for instance into an AutoCAD palette set. Do you also think that's a good idea? Watch the movie to get an impression how this looks like:

If you need this gimmick NOW, just go ahead and download it here (109.9K).

To install the tool you have to copy and paste the file Topobase.Insiders.PositionFinder.dll to your Topobase Client 2010 bin directory (e.g. C:\Program Files\Autodesk Topobase Client 2010\bin). Start Topobase Client, open a workspace and type NETLOAD in the command window, select the file Topobase.Insiders.PositionFinder.dll. In order to load the file automatically with Topobase Client you can type TBPFRegister in the command window (TBPFUnregister removes it from the registry). To start the Position Finder type TBPF. Or just place a new button in the ribbon:

Ribbon

June 08, 2009

Oracle Data Import - Domains

In the previous post I explained how to enable a Topobase document for import with the Oracle data import tool (here). 

In this article you will see how to link domains and their values.  In the SIMROSEWATER source schema the material of the pipe is stored in the MATERIAL table.  For each of these values there should be a corresponding value in the Topobase domain table WA_MATERIAL_TBD, and if there is no corresponding value, you will have to add it.  The Oracle data import allows you to add missing values in the target domain tables.


Open the Oracle data import tool. Select the mapping definition that you created in the previous post, and click Edit. The Edit Mapping Definition window is displayed.


Select the Domains tab.  Select MATERIAL under Source Domains for SIMROSEWATER, and select WA_MATERIAL_TBD under Final Domains for ATORAMIG. Click Link Domains.


The icon shows that the tables are linked. The link is listed under Linked Domains.

Link_domain 

Now you will map the values of the domain. Select the Domain Values tab. 

First, you need to relate the ID and VALUE of the domain table to the primary key and description of the source table (MAT_CODE and MAT_NAME).  Click Domain Settings.


Select the MAT_CODE Source Key Column and select the MAT_NAME Source Caption Column.  Retain the default values for the target columns (ID and VALUE).

Domain_settings

Click Close.  The Link Domain Values area displays the values of the MATERIAL table listed by MAT_CODE – MAT_NAME. 

Source_values 

Before linking domain values, you need to analyze your data and know which entries you need to create in the Topobase domain table. It is recommended that you copy first the new values to the domain table.  Select the new values in the source table and Click Copy.


Now you can use the Autolink functionality to match values automatically in the source and target tables.  This process works in three levels: 

  • The string is exactly the same
  • Any of the words in the source string are contained in the target string
  • Using the soundex algorithm

Autolink matches the column with the first match in the alphabetically ordered list of target values.

Click Autolink and the values are linked automatically.

Afterwards, you can review the linked values, unlink any incorrect values or link manually values that were not automatically linked.  The resulting links should appear as shown in the figure below:

Domain_values 

In the next post I will show you how to link feature classes and attributes.

June 03, 2009

TBEXECUTE

One little-used command is TBEXECUTE, which provides access to defined workflows via the AutoCAD Command: line. This means workflows are available to AutoLISP and the menu system of AutoCAD.

For example, if you have a workflow called LightStandard, you could invoke it using a menu item like:

^C^C_tbexecute LightStandard

or you could create an AutoLISP routine to run it with the definition:

(defun c:lightstandard () (command "_tbexecute" "lightstandard") (princ))

A beneficial side-effect of the latter is that the command can then be repeated with the space bar.

This can really increase your speed for often used constructive workflows with only simple interactions that use the command line rather than a GUI.

May 29, 2009

Oracle Data Import

Autodesk Topobase 2010 provides a tool to migrate data among Oracle schemas. The source schema could be any Oracle schema; the target schema is a Topobase schema.


The user interface of the tool displays the tables of the source and target schemas; therefore it is easy for the user to link them.  The lookup tables or domains can also be easily linked. The tool provides automatic options to link the tables and fields.  As a result, the tool creates SQL statements for the migration, creates SQL Loader files or makes the inserts through the API. 


In this first post, I’d like to show you how to enable a Topobase document for import and I will explain you the interface of the tool.  In the next posts, I will show you how to link domains and feature classes.


First, you need to enable the Oracle data import extension in the document.  In Topobase Administrator, select the document, and in the Document Settings toggle on Oracle data import extension.

Enable_import

Click Save.  The document is updated and the system tables for the import (TB_MIG_*) are created in the document.

Now you have an additional option in the Import menu. Select Import > Oracle Data. The Source Document window is displayed, the target document is your current document (i.e. ATORAMIG).  Enter the name of the source document for the import (in this example SIMROSEWATER).

Source_document

Click Ok.  In the Import Oracle Data window, click New and enter a name for the mapping definition.


In the individual tabs you can link the domains and feature classes.  On the left-side you see the source tables displayed and on the right-side you see the target feature classes.  You have the option to link, unlink, do automatic links or copy the tables, attributes or domains in the target document.

Main_interface_1
 

In the next posts I will show you examples on how to link domains and feature classes.

May 26, 2009

Starting the third year

In 10 days the Topobase Insiders blog celebrates it's second anniversary. The first post has been published on the June 6th in 2007 and it was about increasing the productivity. You can find it here. If you are interested in other former posts try out the archive or the search on the right hand side.

We also took the opportunity and refurbished the design of the blog. We hope you'll like it! Feedback is of course welcome.

Andreas, Derrick and Jeff would like to thank you and all the other visitors and readers of this blog!

TopobaseInsiders

May 19, 2009

Extending the 1-Click Maintenance

Some days ago I published the 1-Click Maintenance plug-in here. I promised that I will also provide the source code. Here we go: Download source code (171.2K)

SourceCode  

If you are not a programmer you can stop reading. For all the others, you're welcome to take a look at the C# project and maybe even extend it...? Extending the plug-in is not that hard. And I know you already have some new database checks in your mind which you want to see in action.

So here is what you have to do in order to implement and run your own checks. Open the project in Visual Studio 2008 and locate the class SampleCheck:

class SampleCheck : DatabaseCheck, IFixable

The sample check gives you an idea what is necessary for a new database check. Just copy and paste this class or extend it. First you have to define the title and the description of the new database check. Then you have to implement the Analyze method, that's where the real logic is located:

public override void Analyze(IStatusDisplay statusDisplay)

Within the Analyze you probably find some issues, just add them to the Results list. If you need to show a message to the user don't show a message box, instead use the Messages property. One reason for that is that we don't want to interrupt the process and it also has to run in batch mode.

If your check can also fix the found issues you can implement the IFixable interface for your class. This should add a new method called Fix:

public void Fix(IStatusDisplay statusDisplay)

Within the Fix method make sure you iterate through the Results and fix one after the other. Keep in mind that the user might disable some results, so check the Active property of the result (result.Active). Also in this method you can log messages and errors in the Messages property.

After you have finished implementing your database check class you have to add it to the Controller. Locate the Controller.InitializeChecks() method and add a new instance of your class there.

That's it. If you need more detailed information take a look at the other database checks.

ReferencePath In order to compile and run the plug-in you have to set the correct reference path for the Topobase related assemblies (go to Project - Properties - Reference Paths) and the correct build path (Project - Properties - Build - Ouput path). 

BuildPathFinally select the Topobase 2010 Administrator executable to start and debug the plug-in (Project - Properties - Debug - Start external program).


You are welcome to send me any feedback (or new database checks :-)

Thanks!

AUTODESK DOES NOT GUARANTEE THAT YOU WILL BE ABLE TO SUCCESSFULLY DOWNLOAD OR IMPLEMENT ANY SAMPLE CODE. SAMPLE CODE IS SUBJECT TO CHANGE WITHOUT NOTICE TO YOU. AUTODESK PROVIDES SAMPLE CODE "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL AUTODESK OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF DATA, OR LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, THAT MAY OCCUR AS A RESULT OF IMPLEMENTING OR USING ANY SAMPLE CODE, EVEN IF AUTODESK OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

May 14, 2009

1-Click Maintenance

We created a new Topobase plug-in for you! It's called 1-Click Maintenance and can be downloaded below.
 
The tool performs some very basic maintenance checks and if possible tries to fix the found issues.
As you will see, most of these checks can already be executed within the Topobase Client or Administrator, but not all of them in one single place. And that’s exactly the goal of this plug-in. I hope it can also help you maintaining your Topobase documents on a regular basis!

The tool is implemented as a plug-in for the Topobase Administrator and it works with the official Topobase 2010 version. The tool runs against any Topobase document, no matter which modules or extensions are applied. It also works against job-enabled and job-disabled documents.

But before you run the plug-in, please make sure no user is connected to this document. And make sure you have an up-to-date backup of your documents before you start fixing the issues.
 
You find all the detailed information about the tool and how to run it in the readme:

Download Readme (884.3K)

Download Plug-in (136.5K)

Maybe you know other pitfalls within a Topobase document which are not yet addressed by this tool? If yes, you will be able to implement new checks! I will share the full source code of this tool soon. Stay tuned! 

Disclaimer (we give no support for this tool):
AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC. DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED OR ERROR FREE.

May 07, 2009

How to develop a new Topobase Administrator page

Since a few releases it's possible to not only extend the Topobase Client and Web applications with own plug-ins. Developers can now also extend the Topobase Administrator with new functionality. The easiest way to do that is to create a new DocumentAdminPage or an ApplicationAdminPage. The only difference between them is wether they relate to one document or not. All the AdminPages are listed in the tree on the left side of the Topobase Administrator. Of course , the DocumentAdminPages are not loaded and displayed until the user opens a workspace with at least one document.

I'll show you a step by step guide how to develop such a DocumentAdminPage.

After you have setup a new solution and project you can add a new class inherited from DocumentAdminPage:

 public partial class MyAdminPage : DocumentAdminPage

The DocumentAdminPage is in the namespace Topobase.Forms.Desktop:

 using Topobase.Forms.Desktop;

Within the constructor you have to set the name of your DocumentAdminPage:

 this.Text = "myAdminPage";

Please note that within the constructor you don't have access to the Document or the Connection instance.

If you would like to access an open Topobase connection you have to catch the event ActivatedFirstTime. Therefore open your DocumentAdminPage in the designer, in the properties window of the MyAdminPage switch to the Events and double click the ActivatedFirstTime event. Visual Studio now generates a new method where you can implement your initialization logic.

 private void MyAdminPage_ActivatedFirstTime(object sender, EventArgs e)
 {
 }

Like for every other plug-in you also need a TBP file to let Topobase know that there is a new plug-in available. Within the new TBP file add the following node:

  <DocumentAdminPage ClassName="MyAdminPage" />

MyAdminPage That's it. You should now be able to compile the DLL and copy it together with the TBP to the Topobase Administrator bin directory and test it. If that doesn't work try to download the following sample project. I have developed it in C# against the released version of Topobase 2010 (7.00.41).

Download MyAdminPage.zip (7.2K)

I plan to provide more How-To posts in the next couple of weeks to show you step by step how to develop a nice AdminPage.

April 30, 2009

Model I/O

The Topobase Administrator provides an easy way to manually create and maintain the data model for each document. However, there is a need to be able to accurately and repeatably replicate a data model, for example when moving from a development to a testing or production environment. Topobase has a very rich API for this purpose and a mechanism called structure update. This is used by vertical modules to ensure that the expected data model is present when they are added to the document. But somebody has to write the code to create the structure update.

With this use-case in mind, the open source project ModelIO comes to the rescue. It provides a way to extract a Topobase data model to an XMI file, and conversely, generate a data model based on an XMI data file - so no one has to write the code. The project also includes an FDO utility to perform the same actions on an FDO data store.

Although documentation is a little scarce at the moment, a new version targeting Topobase 2010 has been created. Give it a try.

The Topobase Insiders

Search