I want to modify the properties of a raster so that the coordinate system of the model is inherited. The VBA crashes at the statement setvalue.
I get the error message illegal operation for this type (runtime error -2147220778 (800402d6)).Is this not allowed ? and then how should it be done?
Public Sub RasterInheritGCS(oRaster As raster, bInheritGCSFromModel As Boolean) If TypeName(oRaster) <> "Raster" Then Exit Sub Dim sAccessStringNameToGet As String sAccessStringNameToGet = Replace(Trim("Geocoding.GCSInherited"), " ", "") Debug.Print sAccessStringNameToGet Dim oEl As Element Set oEl = RasterManager.Rasters.GetElementFromRaster(oRaster) Dim oPH As PropertyHandler Set oPH = CreatePropertyHandler(oEl) Dim sGCSInheritedbefore As String Dim sGCSInheritedafter As String sGCSInheritedafter = "Inherited" Debug.Print oRaster.RasterInformation.FileNameExploded If oPH.SelectByAccessString(sAccessStringNameToGet) Then Debug.Print "after" & sGCSInheritedafter sGCSInheritedbefore = oPH.GetValue Debug.Print "before" & sGCSInheritedbefore If sGCSInheritedbefore <> sGCSInheritedafter Then oPH.setValue ("Inherited") End If End Sub
regards Corina
Corina van Noordt said:Is this not allowed ? and then how should it be done?
Can you do this operation manually?
Some settings have specific requirements, e.g. GCS cannot be inherited, when there is no GCS set for master model.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi both,
Jan Šlegr said:GCS cannot be inherited, when there is no GCS set for master model
I can confirm this, and if a GCS is set to the model, the following code should work according to the code example above:
' to set value to "Inherited use: oPh.setValue = 1 ' to set value to "Not Inherited" use: oPh.SetValue = 0
I hope this helps?
Best regards,Artur
Answer Verified By: Robert Hook
Hi Arthur
It did, thank you
regards
Corina