We have a problem that we have some files which have many "hard-referenced" raster files have been attached. I need to suppress the original location so that MS_RFDIR can supply the location. As an intermediate step, I am trying to change the path as follows:
For Each oRaster In theRasters If oRaster.RasterInformation.Path = "T:\2346 Eldon Square Newcastle Phase 3\Images\Statutory Signage" Then sPath = oRaster.RasterInformation.Name sPath = "H:\2346 Eldon Square Newcastle Phase 3\Images\Statutory Signage\" & sPath oRaster.SetAttachName sPath i = i + 1 End If Next
Which fails to work. SetAttachName requires
oRaster.SetAttachName(sPath) 'according to AutoComplete
But no brackets needed according to VBA help. Presumably the raster ref should then be re-written.
Either way I would really appreciate some help with a method to replace raster reference paths..
Thanks in advance
Mike
In my experience, if the MS_RFDIR variable is properly defined, MicroStation will search and find references even if they were attached with a different path.
When it has failed, there was "operator error" in defining the variable.
Charles (Chuck) Rheault CADD Manager
MDOT State Highway Administration
Yes, that's correct as far as I know. But a temp security glitch meant that a user was able to mess about with our standards.cfg with:
MS_DISALLOWFULLREFPATH = 0 MS_DISALLOWRELATIVEREFPATH = 0
which allowed the full path to be inserted. Horrors.
MS_DISALLOWFULLREFPATH = 1 MS_DISALLOWRELATIVEREFPATH = 1
Have now been restored - to prevent this, of course. But I am stuck with trying to sort the residual mess out, and the "hard-referencing" of raster references is not supplanted by the MS_RFDIR search path, as far as I can see. Hence the need to write this macro.
Thanks
Everybody,
The basic logic for this macro has now worked and the final version is as below... please note that I had to add On Error Resume Next to make it work. Suggest that this might be due to some of the names for the rasters which contained "[xx]". The "hard-wired" raster path has been supplanted by the file name alone and the path for the rasters is now supplied by MS_RFDIR, which is what we want.
Option Explicit Dim theRasters As Rasters Dim oRaster As raster Dim i As Long Dim sPath As String Sub Main() Set theRasters = RasterManager.Rasters For Each oRaster In theRasters If oRaster.RasterInformation.Path = "T:\2346 Eldon Square Newcastle Phase 3\Images\Statutory Signage" Then sPath = oRaster.RasterInformation.Name 'Debug.Print sPath On Error Resume Next oRaster.SetAttachName sPath 'works i = i + 1 End If Next Debug.Print "rasters processed: " & i End Sub
Option Explicit Dim theRasters As Rasters Dim oRaster As raster Dim i As Long Dim sPath As String
Sub Main()
Set theRasters = RasterManager.Rasters
For Each oRaster In theRasters If oRaster.RasterInformation.Path = "T:\2346 Eldon Square Newcastle Phase 3\Images\Statutory Signage" Then sPath = oRaster.RasterInformation.Name 'Debug.Print sPath On Error Resume Next oRaster.SetAttachName sPath 'works i = i + 1 End If Next Debug.Print "rasters processed: " & i
End Sub