Saturday, 26 December 2015

Map tools

There was the wish to simplify some workflows in Map. Here are a few commands we have added:

WIN_FDO_CONVERT_LINES - converts FDO line features to ACAD polylines (layers and color is hard coded, only geometry is converted, not the display style) 
WIN_INTERSECT_LINES - draws point at intersection between two lines (CAD or FDO lines)
WIN_INTERSECT_LINEPOINT - draws point at intersection between existing line (CAD or FDO) and line defined by two points

WIN_FDOLAYER_ISOLATE - isolates the Map layer for selected features
WIN_FDOLAYER_TURNOFF - turns Map layer off for selected features
WIN_FDOLAYER_RESTORE - restores the original visibility settings for Map layers
WIN_FDOLAYERGROUP_VISIBILITY - lets you turn on/off visibility of Map layer groups

For easy use we have put all commands in toolbar:




Maybe there are useful for someone else. 

Instructions:

a) download
b) extract ZIP file
c) unblock the two dll files (otherwise they won't be loaded in Map)
d) copy the two "bundle" folders (WIN_FDO_DynFeatures.bundle, WIN_FDO_Layertools.bundle) to one of Map's default plugin folders (C:\Users\<<user>>\AppData\Roaming\Autodesk\ApplicationPlugins
 or C:\ProgramData\Autodesk\ApplicationPlugins)
e) start Map - dlls will be loaded automatically

Language: german, english.
WIN_FDO_DynFeatures - will not run with Civil
WIN_FDO_Layertools - should run with Map and Civil

Both dlls are more or less tested with Map 2013 but newer version should work as well.

I don't have the time to finish the tools. They do their work in our environment. If you find bugs let me know.

Download


DWG-Export - Missing/wrong z-value

With Map 2013 height information (attribute data in Industry Model) of point features will not be exported as z-value for AutoCAD points/blocks. 
In newer versions of Map the attribute value will be exported but apparently there is a bug so that the AutoCAD points/blocks might get a wrong z-value.

Here is a little tool which assigns the z-value to blocks after exporting the drawing. DWG export needs to include XDATA:
- export the drawing (command: maptoacad) and include XDATA
- configure the XML file according to your needs
- open the exported drawing and run the tool.

Configuration file explanation:
<Block>
        <Infotext>AV - 17.7.2014</Infotext>                    
        <Layername>AV_Höhenfixpunkte</Layername>
        <SpaltennameHoehe>HOEHE</SpaltennameHoehe>                  
        <SpaltennameNummer>PUNKTNUMMER</SpaltennameNummer>
</Block>

<Infotext> - just some information, not processed
<Layername> - AutoCAD layername where to find the blocks
<SpaltennameHoehe> - name of the attribute containing the z-value (your feature class or view needs to have the z-value as attribute in order to get it exported as XDATA)
<SpaltennameNummer> - name of the attribute containg a point number (appears in report)

attribute names in FDO feature source - data needs to be exported as XDATA
This is a stripped down version of a tool containing further dwg export post processing features. Sample drawing is included. Tested with Map 2013, should run with newer versions as well. In german language only.

a) download
b) extract ZIP and unblock DLL (otherwise it won't load in Map)
c) open sample drawing
d) command: netload to load DLL file
e) command: WIN_DWGEXPORTPOSTPROC to run tool
f) load attached sample XML configuration file

Download


Wednesday, 16 December 2015

MapGuide - Server Admin

MapGuide / AIMS mapagent web site contains a section called "Server Admin". If you try to execute one of the commands you will probably get an error message:

MapGuide Server Admin Service Tests
Problem:\nCannot establish connection to the Infrastructure Map Server.\n\nPossible Causes:\n-Your session has been idle for too long;\n-Infrastructure Map Server is no longer responding;\n-Internet connection problems.\n\nSolution:\nRestart your application / session, restart the Infrastructure Map Server service, or contact with the server administrator.Problem:\nCannot establish connection to the Infrastructure Map Server.\n\nPossible Causes:\n-Your session has been idle for too long;\n-Infrastructure Map Server is no longer responding;\n-Internet connection problems.\n\nSolution:\nRestart your application / session, restart the Infrastructure Map Server service, or contact with the server administrator.


If so then change "localhost" to "127.0.0.1" in file "serveradminhelper". The file can be found in the mapviewer sub folder. Depending on your installation your viewer is either .net, Java or PHP based. For a .net based view the path is:

\www\mapviewernet\

The line in question is (für ASPX):

 serverAdmin.Open("localhost", cred);
and needs to be changed to
 serverAdmin.Open("127.0.0.1", cred);


AIMS 2013.

Wednesday, 9 December 2015

Migration project finished

For quite some time we were busy migrating TB2 to AutoCAD Map 2013. The poject is now finished, all TB2 clients have been removed, MapGuide 6.5 has been switched off for good. With that the last remaining XP workstations and W2003 servers have been retired as well.
So, what comes next? Upgrade to 2016...

FlexLM - FlexNet Licensing error:-1,359.

I installed FlexLM on W2008R2 and set up our licenses.
When my colleague performed a server status check he received the following error message:

--------
Status
--------
Flexible License Manager status on Wed 12/9/2015 14:13

[Detecting lmgrd processes...]
Error getting status: Cannot find license file.
The license files (or license server system network addresses) attempted are 
listed below.  Use LM_LICENSE_FILE to use a different license file,
or contact your software provider for a license file.
Filename:      C:\flexlm\license.dat
License path:  C:\flexlm\license.dat;
FlexNet Licensing error:-1,359.  System Error: 2 "No such file or directory"
For further information, refer to the FlexNet Licensing documentation,
available at "www.flexerasoftware.com".

When I did the same I just got the server status report as expected.

It turned out that my colleague's registry profile contained a key under

HKEY_CURRENT_USER\Software\FLEXlm License Manager

which pointed to "C:\flexlm\license.dat".

I did not have that key in HKEY_CURRENT_USER.

Deleting the  key in HKEY_CURRENT_USER solved the issue.

FlexLM - Version v11.12.1.4


Tuesday, 24 November 2015

Map crashes when changing dimension style properties

If you open the Dimension-Style Manager (command: _dimsty) and change a property Map/AutoCAD might crash:


DIMSTY crashes AutoCAD...

On the AutoCAD discussion forum it was mentioned that the problem is related to VBA enabler - which we have installed as well. To work around the issue you can use "Overwrite" instead of "Modify" in DimStyle Manager.

Map 2013, SP2

Tuesday, 17 November 2015

MapGuide/AIMS - WMS: wrong URL in GetCapabilities

I set up some WMS layers on AIMS 2013. In Site Admin I configured server name and script name as required. But in my GetCapabilities document I still got the previous server name and script name (http://localhost:8008/mapagent/mapagent.fcgi). Any wms request therefore didn't work.

Solution: restart IIS service (World Wide Web Publishing Service).

Friday, 30 October 2015

There was a problem adding data to Map

In summer we got raster files for a project and one colleague loaded the files into Map via FDO and worked with the files. Then the project was stopped and has been restarted only recently. But the files could not be added to Map anymore - we only received the message: 

"There was a problem adding data to Map"

Nothing seemed to have changed - we still have Map 2013, the raster files are the same. So why didn't it work anymore?

Autodesk support pointed me to the following KB article:

"AutoCAD Map 3D: Error: "There was a problem adding data to Map" when adding WMS or Rasterfiles"


Issue:

Connect to WMS or Raster files via FDO, the connection work but cannot add the layer to Autodesk® AutoCAD® Map 3D

Causes:

The issue could be related to permission, or lack of them.

Solution:

Open AutoCAD Options menu >Files tab and locate “Temporary External Reference File Location”. This revealed the path where program copies the remporary FDO files.
FDO needs full rights to this location C:\Users\<username>\appdata\local\temp\
Alternatively create folder with full permission at C:\TEMP and set “Temporary External Reference File Location” to that path. 


Funny though as my setting for "“Temporary External Reference File Location”" was already "C:\temp". But then I realised that we applied a new AutoCAD profile to all workstations couple of weeks ago and that the new profile probably has to do with the issue.

I created a new (empty) profile and added the images succesfully to Map. The setting for the Temporary External Reference File Location is now "C:\Users\<<>>\AppData\Local\Temp\" again. When I change it to C:\Temp I cannot add the files anymore.

Conclusion - it works for me but exactly the other way round as described in the KB arcticle. Anyway, as long as it works....

Map 2013, SP2

Edit:
ok, the difference is "full rights". As normal user I do not have full rights on c:\temp and I cannot change that myself. Whereas with C:\Users\<username>\appdata\local\temp\ I have full access. At least in our corporate environment.

Thursday, 22 October 2015

Intersection with guest user


When performing an intersection in Map with a guest user you will receive an error message stating that a specific feature class could not be emptied due to insufficient privileges.

The table in question has been set up with Select, Insert, Update, Delete permissions in the guest user.

Autodesk support explained, that the table content is not deleted but the table is truncated. Therefore the Delete permission on the table is not sufficient.

The following workarounds have been proposed:

- perform intersection in Map-Admin accross whole area 
- perform intersection in data document

One other possibility is to grant "drop any table" to the guest user. But giving the guest user such as privilege might not be a good solution either.

Map 2013 SP2

Wednesday, 2 September 2015

Map - and GIS analysis

There was a posting at CAD.DE regarding a specific task to be accomplished by using Map.

Here is a short description:

A drawing file contains two different sets of point features.

point feature set 1 - blocks, including an ID (block attribute), labelled as "b1"
point feature set 2 - points, including an ID (Map object data table) labelled as "s1"

Here is a screenshot:





The task was to create a list where each point of feature class "s1" is linked to the closest point in feature class "b1".

Several suggestions were made how to solve the issue with Map - but either it involved laborious manual work or wouldn't always return the closest point. One suggestion was to use a spatial database to get the desired result.

I then decided to try whether that would be possible without installing any software and using only freely available tools.

Here is a short description of what I did using SQLite and Spatialite:

(1) export both point data sets (including block attributes and Map object data table) to SQLite using _mapexport


(2) download spatialite_gui.exe (http://www.gaia-gis.it/gaia-sins/index.html) - doesn't require an installation


(3) in spatial_lite connect to SQLite file
        Spatialite recognises the Map/FDO SQLite data model and geometry columns. There are accessible as "virtual tables" meaning that they cannot  be modified. It also seems that you cannot run spatial queries on the virtual tables - at least I didn't work for me. But I'm not experienced with spatial lite and might have just done something wrong.


(4) copy data from virtual tables to normal SQLite tables using CTAS (create table as select)
        With spatialite you need to create a geometry column in a very special way. First you have to create the table, afterwards you add the geometry column using the following statement: SELECT AddGeometryColumn(...). As I created my two tables with CTAS I did not get "proper" geometry columns. But for the task in question it didn't matter. The only drawback I noticed with my approach was that I couldn't export to SHP. This requires proper geometry columns.


(5) looking around I found some SQL statements for SQLite for similar tasks, I tried and played around a bit and found the following statement to return correct results:

SELECT
s1.featid as sn_id, b1.nr as b_nr, min(ST_Distance(s1.geom, b1.geom))  as dist, x(s1.geom) as xgeom , y(s1.geom) as ygeom
FROM b1, s1
group by s1.featid
ORDER BY s1.featid ;

(6) I created a new table using the select statement above


(7) to perform a visual check I wanted to load the result into Map again. As I had modified the SQLite database - by adding tables - Map refused to connect to the file. Anyway - even I had been able to load the file into Map it wouldn't have recognized the spatial_lite geometry column as Map/FDO and spatialite use different structures to store geometries. I therefore exported the table as CSV file.

(8) Now as I thought it would take too long to convert the CSV file into a spatial feature class using Map I just loaded the CSV file into QGIS and exported it as SHP data set which I then connected to in Map.

(9) overlaying the SHP file and the original drawing file I could visually check the correctness of the result.








Construction (Cogo) - no feature class available in "Save options"

When you perfom certain CoGo operations you will be presented with the following dialog box:


Cogo - intersection dialog box


In case the Feature class drop down list beneath "Save options"  is empty or certain feature classes are missing - check that you have choosen a suitable profile in the Industry Model explorer. Only  feature classes included in the active profile will be availabe in the drop down list:
Map - IM Explorer - profiles
Map 2013, SP2

Monday, 10 August 2015

MapGuide Alias - UNC

I just tried to set up an alias for MapGuide / Infrastructure Mapserver 2013. I tried a few different UNC path options (for instance with concluding backslash) but no - it just didn't work. Finally I found my mistake - just the UNC path for the share is not sufficient. I had to add a folder to get it to work.

Does not work:

\\bla.net\fachappli$\MG_DATEN  (>> just the share)

Does work:

\\bla.net\fachappli$\MG_DATEN\Raster (share and subfolder)




Friday, 7 August 2015

Guest user/role - strange issue #2, solved

As mentioned yesterday we encountered a strange issue related to guest users/roles. Basically it seemed that it is not possible to create a new feature (no matter for which feature class) when working with an guest user/role in our job enabled LandManagement industry model. Instead my colleague got an error message regarding a missing spatial index. Confusing was, that it seemed to work when using a Map-Admin user. Further confusion was caused by the fact that when working directly on the data user the problem did not occur either. When I performed a test on my computer I was not able to reproduce the issue at all.  

As it turns out our testing was not so comprehensive as it should have been in the first place and with hindsight the behaviour we observed can be explained.

Culprit seems to be a setting in Map's Global Enterprise Industry Model options (setting is replicated in IM options) : "Vicinity For Digitising Points [m] "






If "Vicinity For Digitising Points [m] " is turned on we get the error message, otherwise we don't. The setting itself is probably not to blame - we actually misunderstood the meaning of the option and can now safely turn it off. I think the option will cause Map to look through all point feature classes and if one of them doesn't have a spatial index one will get the error message.....

The issue is not related to topologies or guest user or non Map-Admin user. As we used different Map users and different industry models (data or guest user) during testing the aformentioned option was not uniformly set, caused therefore different results.


Map 2013, SP2




Thursday, 6 August 2015

Guest user/role - strange issues

We had two strange issues in AutoCAD Map related to guest users/roles (SecurityAdmin). Complexity is raised by the fact that we also have an job-enabled industry model and a topology.

Issue #1
Map crashed when we deleted a feature in "Live" state (from a certain feature class beloging to an area-topology)  when using a guest user/role (SecurityAdmin). 

The feature actually got deleted - the issue was the crash.

CER report and Map log file contained the following piece of information:

System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
 bei Autodesk.Map.IM.Data.FeatureClass.GetChildrenFeatureIDs(IEnumerable`1 fids, HashMap`2 parentToChildren, Int32 depth, Boolean geometryFeaturesOnly)
 bei Autodesk.Map.IM.Map.MapLogicImpl.RegenenerateFromModificationLog(Boolean regenerate)
 bei Autodesk.Map.IM.Map.MapLogicImpl.MapDrawBurstDisposed(MapDrawBurstImpl burst, Boolean disposing)
 bei Autodesk.Map.IM.Map.MapDrawBurst.Dispose()
 bei Autodesk.Map.IM.Map.MapLogicImpl.DeleteFidTidArray(FidTidArray fta)
 bei Autodesk.Map.IM.Map.MapLogicImpl.DeleteFeatures(String prompt)
 bei Autodesk.Map.IM.Map.MapDocument.Delete_Interaction(Object sender, InteractionEventArgs e)
 bei Autodesk.Map.IM.CommandRegistry.API.BaseCommandRegistry.Execute(String globalName, CommandExecute commandCallback, Boolean async, Document document, Object[] args)
 bei Autodesk.Map.IM.CommandRegistry.API.BaseCommandRegistry.Execute(String globalName, Boolean async, Object[] args)


 This issue has been resolved by re-creating the Guest-user/role in SecurityAdmin.

Issue #2

It was not possible to create a new feature (for a certain feature class beloging to an area-topology) in an "open" job when:

- using a guest user/role (Security Admin)
and
- using a non-Admin Map user.

We got the following error message : 

Vorgang ist fehlgeschlagen, da ein Spatial-Index nicht in der Fachschale vorhanden ist.

(Industry model does not have a spatial index. )

No message appeared in Map's log file.

There was no issue creating the feature when logging in with a Map user who has Admin permission (Map-Admin, not Windows or Oracle Admin). 

My colleague showed me the issue on his machine yesterday. He had done several tests over the last two days. The issue always occured whilst testing. Today I did a test on my machine and the issue did not occur. Then my colleague did test on his machine again and got the same result.. We tried to find out if the issue is related to a certain workflow but to no avail. 

Map 2013, SP2






Tuesday, 14 July 2015

Map workflow - separate files for specific area

Situation: ca 7000 tiled raster files in one folder but only a subset for a specific area is required, SHP file containing tiles and filenames and SHP file with area of interest available

raster tiles (green), area of interest (blue)



workflow:

1 - load both SHP files into Map
2 - spatial query to select tiles for area of interest


raster tiles for area of interest


3 - export attribute data for selection


shp with tiles (selection for area of interest) - export attribute data (filenames) 

4 - open attribute data in Excel
5 - extract exact filename with Excel and add addtional parameters (DOS commands), as result you need something like this: 

...
copy 6895_2595_r3x.tif c:\temp\dom
copy 6895_2600_r3x.tif c:\temp\dom
copy 6895_2605_r3x.tif c:\temp\dom
...


further processing in Excel

6 - copy result into new textfile, save as BAT file into folder with raster files and execute



What happens if you do not have a SHP file containg tiles and filenames?

This might be an option to create one with Map:

- load raster files into Map (command: _mapiinsert), choose option to show frame only (do not load thousands of raster files, only let Map display the frames)


_mapiinsert - show frames only


- add AutoCAD layer with image frames to DisplayManager (query current drawing)

- add a label to the newly add layer, choose ".IMAGENAME" as label text



label added to iamge frames - path to file is used as text


- export as SHP (command: _mapexport), export option "Text" : you will get a Point SHP with text insertion points as points and label text as attribute

- use point shape for spatial query




Friday, 10 July 2015

MapGuide / AIMS - show number of sessions

As shown in Jackie's blog one can easily count the number of current sessions. I put such a counter on our internal web site where we keep links to different web interfaces and scripts related to our AIMS/MapGuide installations:




The script is written in PHP:

 <?php  
 // for remote server  
 //  
 // (1) INLCUDE ../vaw_settings.php;  
 //  
 // for local server  
 //  
 // (1) INLCUDE Verweis mit ./vaw_settings.php;  
 //  
 include './vaw_settings.php';  
 $fi = new FilesystemIterator($pathSessionRepository, FilesystemIterator::SKIP_DOTS);  
 //  
 $number = (iterator_count($fi)-1)/2 ;   
 // for remote server  
 //  
 // (2) echo $number;  
 //  
 // for local server  
 //  
 // (2) return $number;  
 //   
 return $number;  
 ?>  

The vaw_settings.php file contains only the path to MapGuide session repository ($pathSessionRepository).

The script for counting current sessions is called from within another PHP script which runs on one of the AIMS servers. It also calls the slightly modified version of the script on the remote server:

 ...  
 $script_number_users = 'misc/count_logged_users.php';  
 ...  
 //local server  
 //only relative path to script  
 $request_url = $script_number_users;  
 echo "# of users logged in ($label_server1):____".include($request_url).".";  
 //remote server  
 //complete url  
 $request_url = $basis_url_server3.$url_vaw_scripte.$script_number_users;  
 echo "# of users logged in ($label_server3):____".file_get_contents($request_url).".";  

Depending on whether the script runs locally or remotely it needs to be modified slightly (see comments in scripts) and the way the script is called varies as well (relative path vs. complete URL, include vs. file_get_contents). 


AIMS/MapGuide 2013

Thursday, 9 July 2015

create view with unique FID

We have an Oracle view where no unique FID can be retrieved. Without an unique FID Map will not display the data in a form (industry model).

In our situation we only need a unique ID for the sake of the FID requirement by Map. To generate such a unique ID we chose the following approach:

- the view is wrapped by a select statement which includes rownum:


 create or replace view my_view as select  
 rownum fid, t.* from  
 (   
  ... view definition ...  
  ) t;  

As we need to show the data of the view only occasionally performance is not a major concern here.

Map 2013, SP2

Tuesday, 30 June 2015

MapGuide / AIMS - performance, file access

We run AIMS on virtualized W2008R2 machines with 6 GB RAM. Most data displayed as maps comes directly from Oracle Spatial. Only for one job enabled Map industry model  we decided to export 40+ feature classes and views to an SDF file. File size is roughly 200MB.

In order to speed things up I created a RAM Disk on the server and did some performance tests:
- hard disk access (read/write) was already much better then on my physical machine
- depending on RAM disk driver and test performed read access was faster by up to factor 6 compared to hard disk access

Surprisingly moving the SDF file to the RAM disk did not help improving performance in AIMS/MapGuide. 

Conclusion seems to be that W2008R2 has already cached the SDF file and no further improvement is possible here. As the SDF file is used in all web mapping projects and layers based on file are visible by default I assume that the file will be cached all the time. 


Here are a few screenshots related to the testing:

- hard disk performance, local machine:



- hard disk performance, virtualized 2008r2 server




- ram disk performance, local machine (imdisk)




- ram disk performance, w 2008r2 (softperfect)





- AIMS/MapGuide performance test with sdf based map - sdf file on disk on virtualized w2008r2 server




- AIMS/MapGuide performance test with sdf based map - sdf file on ram disk on virtualized w2008r2 server



AIMS 2013

Wednesday, 24 June 2015

Feature with wrong geometry type for feature class

We had one feature (Industry Model) which was not displayed in Map. 1 Click Maintenance reported an unsupported geometry type for a polygon feature class. A closer look unveiled that the feature had been migrated as line feature and not as polygon feature:
  
Line string feature in a polygon feature class (Map Industry Model)

The geometry itself was correct - so it could not be "repaired" in Oracle Spatial. Here is one way to solve the issue:


1. connect via FDO Oracle and add feature class to Map 
   FDO Oracle will create a layer containing lines and polygons - the feature in question will therefore be displayed in Map.


Adding table via FDO Oracle - line and polygon features are displayed

2. save layer as sdf, add sdf to Map and remove layer based on FDO Oracle from Display Manager
3. rectify geometry in SDF based layer - for instance via "extract geometry" 
4. open form for Industry model feature where geometry type is incorrect
5. link rectified geometry with feature - confirm "Feature has already a geometry - replace?" 

Map 2013, SP2

Wednesday, 17 June 2015

ora-01950 no privileges on tablespace "string"

I was looking into a slow running query and wanted to re-create a spatial index.
In AIA I received the following error message:

ORA-29532: Java-Aufruf durch nicht abgefangene Java-Exception beendet: topobase.sql.TopobaseSqlException: ORA-01950: keine Berechtigungen für Tablespace 'TB_DATA'

(ora-01950 no privileges on tablespace "string")

When I tried to re-create the spatial index in SQL developer a smilar error message appeared. I compared the settings (roles, system privileges) of the user with other industry model users and for an unknown reason the "unlimited tablespace" privilege was missing.

Friday, 12 June 2015

error message "item has already been added" when opening form

I just received an error message as I opened a form for a newly created view:

Das Element wurde bereits hinzugefügt. Schlüssel im Wörterbuch: "191168". Hinzuzufügender Schlüssel: "191168"

and Bing translation:

The item has already been added. Key in dictionary: "191168". Key being added: "191168"

and Google translation:

The item has been added . Key in dictionary: " 191168 " . Be added is key : " 191168 "

Bit of fun on a friday afternoon....


Ok, the number mentioned in the error message text is an FID and unfortuantely the FIDs are not unique in my view. This causes the error message and as a result no useful information is displayed in my form:


FID needs to be unique....


In Map IM FID needs to be unique.


Map 2013, SP2


Tuesday, 2 June 2015

call ERMS d3 from form

To call d.3 - an electronic document management system - one can use the following code to lookup certain linked documents:


 Public Overrides Sub Button_Click()  
 '  
 ' ERMS d.3 parameter needs to be base64 encoded  
 '  
 ' ERMS d.3 - link to program and serach-field name  
  Dim ermsAufrufFix As String = "d3://searchdxplorer&doc_field_1="  
 '  
 ' ERMS d.3 get object id for current feature  
 '  
  Dim _name_number_value As String = Me.Dialog.Controls.Item("NAME_NUMBER").value   
 '  
 ' searching for specific entries only ("Dossier") - parameter and value  
 '  
  Dim tempSuchParameter As String = "3T.06.02.98.06-" + _name_number_value  
 ' base64 encoding  
 Dim ermsSuchobjektID As String  
 Dim data As Byte()  
 data = System.Text.Encoding.UTF8.GetBytes(tempSuchParameter )  
 ermsSuchobjektID = System.Convert.ToBase64String(data)  
 ' combine all parameters  
 Dim ERMSAufruf = ermsAufrufFix + ermsSuchobjektID   
 ' start/call ERMS d.3     
 Dim pro As New System.Diagnostics.Process  
 pro.Start(ERMSAufruf )  
 End Sub  

Friday, 22 May 2015

Form - VB.net get next available value for column

To get the nex available value for a column - example:

 Public Overrides Sub Button_Click()  
   dim nummerfeld as Autodesk.Map.IM.Forms.DialogControls.TextBox  
   nummerfeld = Me.Dialog.Controls.Item("NUMMER")   
   dim maxNummer as Long = Me.Document.ConnectionTools.LngValue("select max(NUMMER)+1 from wse_br_wohnen")  
   nummerfeld.Value = maxNummer   
 End Sub  

Tuesday, 19 May 2015

Execute stored procedure from form

I was asked to figure out how to execute a stored procedure from a form. Here is a working sample (VB.net):


 Public Overrides Sub Button_Click()  
   
      ' prepare SQL execution  
      Dim MyCommand As Autodesk.Map.IM.Data.Provider.Command = New Autodesk.Map.IM.Data.Provider.Command("", Me.Document.Connection)  
   
      ' define input/output parameters for stored procedure  
      Dim ParameterOut as Autodesk.Map.IM.Data.Provider.DataParameter  
      Dim ParameterIn1 as Autodesk.Map.IM.Data.Provider.DataParameter  
      Dim Parameterin2 as Autodesk.Map.IM.Data.Provider.DataParameter  
      Dim returnValue as String  
   
      ' set up SQL command - type StoredProcedure  
      MyCommand.CommandType = System.Data.CommandType.StoredProcedure  
      ' PackageName.ProcedureName  
      MyCommand.CommandText = "emp_eval.eval_department"  
   
      ' assign values to input parameters  
      ParameterIn1 = MyCommand.CreateParameter()    
      ParameterIn1 .DbType = System.Data.DbType.Int32  
      ParameterIn1 .ParameterName = "DEPARTMENT_ID"  
      ParameterIn1 .Value = 100  
      ParameterIn1 .Direction = System.Data.ParameterDirection.Input  
      ParameterIn2= MyCommand.CreateParameter()    
      ParameterIn2.DbType = System.Data.DbType.Int32  
      ParameterIn2.ParameterName = "DUMMY_ID"  
      ParameterIn2.Value = 101  
      ParameterIn2.Direction = System.Data.ParameterDirection.Input  
        
      ' set up output parameter - return value   
      ParameterOut= MyCommand.CreateParameter()    
      ParameterOut.DbType = System.Data.DbType.String  
      ParameterOut.ParameterName = "TEXT"  
      'Direction needs to be Output and not ReturnValue   
      ParameterOut.Direction = System.Data.ParameterDirection.Output   
   
      ' add parameters to sql command, keep order of parameters in mind  
      MyCommand.Parameters.Add(ParameterIn1 )   
      MyCommand.Parameters.Add(ParameterIn2 )  
      MyCommand.Parameters.Add(ParameterOut )  
        
      ' execute SQL   
      MyCommand.ExecuteNonQuery()  
         
      ' get output/return value  
       returnValue = MyCommand.Parameters.Item("TEXT").Value  
       MyCommand.Dispose()  
       MsgBox("ok --> " & returnValue)  
         
      'refresh dialog   
      me.Dialog.Requery()  
  End Sub  

In Oracle the procedure is defined as:

PROCEDURE eval_department(department_id IN NUMBER , dummy_id IN NUMBER, text OUT VARCHAR2) ;

I found a presentation from the 2007 Oracle Spatial user Conference with some sample code but I needed to adapt it a bit:

http://download.oracle.com/otndocs/products/spatial/pdf/osuc2007_presentations/gita07200a_lvvwd.pdf

Map 2013

AutoCAD Map and AIMS - addtional log files

Map and AIMS provide additional log files related to industry models. Log files are created automatically and saved in the "LOG" sub-folder of the installation, e.g.:

C:\Program Files\Autodesk\AutoCAD Map 3D 2013\Log

In the past I used java based Chainsaw to view the logfiles. A few weeks ago I was pointed to another viewer for these log files called YALV!. It is easier to install and provides more comfort viewing/filtering error messages:



Thursday, 30 April 2015

Master detail form - no records shown in detail form

I re-blog an older post today as I just came across the same issue again but I had forgotten about it. I wasted some time testing all sorts of things before I looked it up on the web finding my own posting!

When you create a Master Detail form Map needs to insert some records into certain system tables. Unfortunately with Map 2013 not all of those entries are created properly. You need to add missing ones manually to table TB_GN_DIALOG. Look up the record for your form and check the columns "detail_fieldname" and "master_fieldname". They need to refer to the FID columns of the tables involved.

You can navigate to the record in TB_GN_DIALOG more easily if you:
- open the master-detail form you need to rectify in preview mode in Map-Administrator
- click into the input text box of the detail form (just above the tool-bar)
- press Ctrl+D

The form for TB_GN_DIALOG will open and display the record you need to check/edit.

TB_GN_DIALOG - detail_fieldname is empty

Master-Detail form now functiong properly after fxing entries in TB_GN_DIALOG

Map 2103, SP2





Tuesday, 28 April 2015

AutoCAD Mechanical - Fatal error: unable to load the modeller dlls

I created a network deployment for Autodesk Factory Design Suite 2015. The deployment was installed on the user machine and a virtual machine as well. In both cases Mechanical crashed with error message "Fatal error: unable to load the modeller dlls" when trying to resize a circle. The issue did not occur with AutoCAD or AutoCAD Architecture.

We tried to find the reason and did perform several tests - but to no avail. Finally I re-created the deployment and reinstalled. The issue does not occur anymore. So - we spent quite some time on troubleshooting instead of just recreating the deployment....

Factory Design Suite 2015 

Can't see deleted files in Bin?

I just came across this. I had some files deleted early this morning and then needed to get some of them back - but for a strange reason my Bin was empty. 
As it turns out the issue is due to a bug in Windows 7. I have a codemeter usb stick plugged in and the company behind it provides a download link:

www.wibu.com/nc/faq-codemeter/question/single/why-are-deleted-files-no-longer-display-in-the-recycle-bin-if-a-cmdongle-is-plugged-in-139.html

which points to

http://support.microsoft.com/kb/2677246/en-us

"Assume that you connect a removable hard disk drive to a computer that is running Windows 7 or Windows Server 2008 R2. The removable hard disk drive is read-only and does not contain a Recycle Bin. In this situation, when you open the Recycle Bin on the desktop to restore some files, no deleted files are displayed in the Recycle Bin."

If you cannot install the hotfix - for Codemeter another solution exists by changing the codemeter configuration. 

Wednesday, 22 April 2015

Crystal Reports Designer "Save as" to Enterprise fails

We have already migrated quite a view reports from an older CR release to CR 2011 just by opening the report in CR Designer and saving it to Enterprise server.

Suddenly - with some reports - saving reports failed with error message : "internal error report application server failed".

Solution - activate "no printer" option Page Setup as described here:

http://scn.sap.com/thread/3433032



Tuesday, 31 March 2015

AIMS / MapGuide backup batch script

I used to create backups for the repository files and the library - by running the batch files provided by MapGuide manually and using the Admin web interface for creating a package. To simplify the process I have written one batch file for the whole procedure. As I'm not familiar with batch file scripting there is probably lots of space for improvements left. Here are some details:


1. make package 
I modified the existing "makepackage.php" script (...\Autodesk Infrastructure Web Server Extension 2013\www\mapadmin) in order to run it from command line. It needs some configuration parameters such as path to webconfig.ini and the Administrator's credentials (MapGuide Admin).

2. repository backup batch files
The backup scripts provided by MapGuide need a little modification - I added an "exit" at the end of each of the files I use and renamed them as well (kept the originals).

 ...  
 echo.  
 php -n RepositoryAdmin.php -c Restore -i "%cd%\..\BackupRepositories\Library\LastColdBackup" -o "%cd%\..\Repositories\Library"  
 echo.  
 exit  

  
3. batch script 
One batch script is needed to run all other scripts, for shutting down and restarting MapGuide service and for copying the backed up files to a different drive.

To run other batch files use:

 ...  
 start /wait call %batch_file_backup%  
 if ERRORLEVEL 1 goto error_start  
 ...  


This will run another batch file and wait until the batch file has finished. If the batch file does not finish succesfully you can catch an error code. A modification of the original batch files provided by Mapguide is required to get this to work - see above.

One click and files are backed up:


backup batch file in action

Script files are available here.

Install:

1) Copy files to "..\Autodesk Infrastructure Map Server\RepositoryAdmin" folder.
2) check and modify settings in "makepackagescript.php"
3) check and modify settings in "AIMS_backup.bat"
4) run "AIMS_backup.bat"

This should work for AIMS 2013 and the corresponding MGOS version.