Hallo.
Ich möchte ein Polygon in beliebige Teile zerlegen und dann über eine Messagebox die Attribute zu geteilten Flächen eingeben.Das Script zum teilen der Poylgone habe ich schon.Jetzt müsste es nur noch mit der Messabox verändert werden :
theView = av.GetActiveDoc
thetheme=theView.findtheme("Theme1.shp")
theFTab = theTheme.GetFTab
theView.SetEditableTheme(theTheme)
if (theFTab.IsEditable.Not) then
msgbox.error("Theme " + theTheme.AsString.quote + " cannot be opened for editing","")
return nil
end
theShpFld = theFTab.FindField("shape")
'Add a new field, which we'll use to identity "original" arcs. We don't
'need to undertake this step for polygons, as the arc doesn't need to be
'deleted from the final polygons.
isPolyLine = (theFTab.GetShapeClass.GetClassName = "polyline")
if (isPolyLine) then
tempFld = Field.Make("temp",#FIELD_DECIMAL, 1,1)
theFTab.AddFields({tempFld})
for each rec in theFTab
theFTab.SetValue(tempFld,rec,1)
end
end
'We'll use a graphic to split the lines.
theLine = theView.ReturnUserPolyLine
theTheme.Split(theLine)
'Now select out those arcs introduced by our graphic during splitting.
if (isPolyLine) then
theBitMap = theFTab.GetSelection
expr = "([temp] = 0)"
theFTab.Query(expr,theBitMap,#VTAB_SELTYPE_NEW)
theFTab.UpdateSelection
'Delete them. Remove the temporary field.
theFTab.BeginTransaction
theFTab.RemoveRecords(theFTab.GetSelection.Clone)
theFTab.EndTransaction
theFTab.RemoveFields({tempFld})
end
'Finish editing and refresh the view.
theFTab.SetEditable(false)
theView.Invalidate
Könnte ihr mir weiterhelfen ? Vielen Dank
Ich möchte ein Polygon in beliebige Teile zerlegen und dann über eine Messagebox die Attribute zu geteilten Flächen eingeben.Das Script zum teilen der Poylgone habe ich schon.Jetzt müsste es nur noch mit der Messabox verändert werden :
theView = av.GetActiveDoc
thetheme=theView.findtheme("Theme1.shp")
theFTab = theTheme.GetFTab
theView.SetEditableTheme(theTheme)
if (theFTab.IsEditable.Not) then
msgbox.error("Theme " + theTheme.AsString.quote + " cannot be opened for editing","")
return nil
end
theShpFld = theFTab.FindField("shape")
'Add a new field, which we'll use to identity "original" arcs. We don't
'need to undertake this step for polygons, as the arc doesn't need to be
'deleted from the final polygons.
isPolyLine = (theFTab.GetShapeClass.GetClassName = "polyline")
if (isPolyLine) then
tempFld = Field.Make("temp",#FIELD_DECIMAL, 1,1)
theFTab.AddFields({tempFld})
for each rec in theFTab
theFTab.SetValue(tempFld,rec,1)
end
end
'We'll use a graphic to split the lines.
theLine = theView.ReturnUserPolyLine
theTheme.Split(theLine)
'Now select out those arcs introduced by our graphic during splitting.
if (isPolyLine) then
theBitMap = theFTab.GetSelection
expr = "([temp] = 0)"
theFTab.Query(expr,theBitMap,#VTAB_SELTYPE_NEW)
theFTab.UpdateSelection
'Delete them. Remove the temporary field.
theFTab.BeginTransaction
theFTab.RemoveRecords(theFTab.GetSelection.Clone)
theFTab.EndTransaction
theFTab.RemoveFields({tempFld})
end
'Finish editing and refresh the view.
theFTab.SetEditable(false)
theView.Invalidate
Könnte ihr mir weiterhelfen ? Vielen Dank
- Anmelden oder Registieren, um Kommentare verfassen zu können