PROBLEM
The Start Editing tool is greyed out after importing or adding a theme that has z values. This includes CAD files, coverages, and 3D shapefiles.
The theme in question is a ShapeZ, which cannot be edited without the 3D Analyst extension.
Code:
'-- Converts 3D shapefile to 2D shapefile
theView = av.GetActiveDoc
theDocName = theView.GetClass.GetClassName
for each t in theView.GetActiveThemes
if (t.Is(FTheme)) then
theInFTab = t.GetFTab
if (theInFTab.GetShapeClass.GetClassName = "MultiPatch") then
continue
end
theShape = theInFTab.GetShapeClass.MakeNull
fl = {}
for each f in theInFTab.GetFields
if (f.IsVisible and f.IsTypeNumber) then
fl.Add(f)
end
end
outFields = {}
for each f in theInFTab.GetFields
if (f.IsVisible and f.IsTypeShape.Not) then
outFields.Add(f.Clone)
end
end
'-- Get output name
def = av.GetProject.GetWorkDir.MakeTmp("thm","shp")
def = SourceManager.PutDataSet(ftab, "Output Shapefile Name :"
++ t.GetName, def, true)
if (def = NIL) then
continue
end
thePrj = Prj.MakeNull
inClass = theInFTab.GetShapeClass
if (inClass.IsSubclassOf(PointM)) then
outClass = Point
elseif (inClass.IsSubclassOf(LineM)) then
outClass = Line
elseif (inClass.IsSubclassOf(RectM)) then
outClass = Rect
elseif (inClass.IsSubclassOf(PolygonM)) then
outClass = Polygon
elseif (inClass.IsSubclassOf(PolyLineM)) then
outClass = PolyLine
elseif (inClass.IsSubclassOf(MultiPointM)) then
outClass = MultiPoint
else
MsgBox.Info("This is not a 3D shape file.","")
continue
end
theOutFTab = FTab.MakeNew(def, outClass)
theOutFTab.SetEditable(TRUE)
theOutFTab.AddFields(outFields)
theBitMap = theInFTab.GetSelection
if (theBitMap.Count = 0) then
theBitMap.SetAll
unsetBitmap = TRUE 'reset flag for end of loop
else
unsetBitmap = FALSE
end
shapeField = theOutFTab.FindField("Shape")
done = FALSE
offset = -1
while (not done)
recNum = theBitmap.GetNextSet(offset)
offset = recNum
if (recNum <> -1) then
if (theInFTab.QueryShape(recNum, thePrj, theShape)) then
rec = theOutFTab.AddRecord
theOutFTab.SetValue(shapeField, rec, theShape)
for each f in outFields
inField = theInFTab.FindField(f.GetAlias)
attVal = theInFTab.ReturnValue(inField, recNum)
theOutFTab.SetValue(f, rec, attVal)
end
end
else
done = TRUE
end
end
theOutFTab.Flush
theOutFTab.SetEditable(FALSE)
if (unsetBitmap) then
theBitmap.ClearAll
end
if (MsgBox.YesNo("Add 2D shapefile as theme to the"
++ theDocName + "?","Convert to 2D Shapefile :"
++ t.GetName,TRUE).Not) then
continue
end
'-- Create a theme and add it to the view
fthm = FTheme.Make(theOutFTab)
theView.AddTheme(fthm)
end
end
'-- Bring the View to the front
theView.GetWin.Activate
Get help from ArcGIS experts
Download the Esri Support App