' View should be the Active Document ' theView = av.GetActiveDoc ' Establish output precision... ' Script.The.SetNumberFormat( "d.dddddd" ) for each t in theView.GetActiveThemes defaultName = FN.Make("$HOME").MakeTmp(t.GetName.LCase,"gen") ungenFileName = FileDialog.Put( defaultName,"*.gen","Export"++t.GetName ) if (ungenFileName = nil) then exit else exportFile = LineFile.Make(ungenFileName, #FILE_PERM_WRITE) end ' The ARC/INFO generate format uses the ID number of the feature ' in the export file to provide a means for joining attributes. ' When the generate file is converted to an ARC/INFO coverage the ID ' as found in the generate file will be used as the ID in the coverage ' feature attribute table (the .AAT or .PAT). Allow the user to specify ' the ID field to use or default to the record number.... ' fieldList = t.GetFTab.GetFields.Clone fieldList.Insert( "" ) idField = MsgBox.ChoiceAsString( fieldList, "Select ID field for export file:","Choose ID Field" ) if ( idField = nil ) then exit elseif ( idField = "" ) then useID = false else useID = true end theFTab = t.GetFTab shapeField = theFTab.FindField( "Shape" ) shapeType = shapeField.GetType numRecs = theFTab.GetNumRecords av.ShowStopButton av.ShowMsg( "Exporting"++t.GetName+"..." ) for each recNum in theFTab currentShape = theFTab.ReturnValue( shapeField, recNum ) if ( useID ) then id =theFTab.ReturnValueString( idField, recNum ) else id = (recNum + 1).SetFormat("d").AsString end if (shapeType = #FIELD_SHAPEPOINT) then ' ARC/INFO POINT format export file... ' Xvalue = currentShape.GetX.AsString Yvalue = currentShape.GetY.AsString outputLine = id+", "+Xvalue+", "+Yvalue exportFile.WriteElt( outputLine ) elseif (shapeType = #FIELD_SHAPEMULTIPOINT) then ' ARC/INFO POINT format export file... ' pointList = currentShape.AsList for each pt in pointList Xvalue = pt.GetX.AsString Yvalue = pt.GetY.AsString outputLine = id+", "+Xvalue+", "+Yvalue exportFile.WriteElt( outputLine ) end elseif (shapeType = #FIELD_SHAPELINE) then ' ARC/INFO LINE format export file... ' exportFile.WriteElt( id ) shapeList = currentShape.AsList for each shapePart in shapeList for each xyPoint in shapePart outputLine = xyPoint.GetX.AsString+", " +xyPoint.GetY.AsString exportFile.WriteElt( outputLine ) end exportFile.WriteElt( "END" ) end elseif (shapeType = #FIELD_SHAPEPOLY) then ' ARC/INFO POLYGON format export file... ' exportFile.WriteElt( id++"AUTO" ) 'automatic label generation flag... shapeList = currentShape.AsList for each shapePart in shapeList for each xyPoint in shapePart outputLine = xyPoint.GetX.AsString+", " +xyPoint.GetY.AsString exportFile.WriteElt( outputLine ) end exportFile.WriteElt( "END" ) end end progress = (recNum / numRecs) * 100 proceed = av.SetStatus( progress ) if ( proceed.Not ) then av.ClearStatus av.ShowMsg( "Stopped" ) exit end end exportFile.WriteElt( "END" ) exportFile.Close av.ClearStatus av.ClearMsg end