Hi all,
I can extract Corridor Featurelines. But I need to find out which region a fealtureline belongs. But can’t find the solution. I think is is not possible if i look at the object hierarchy.
[Code}
def corridor_FeatureLines(flStartId,corNames,PointCodeLST,isDynamic,FLname,FLStyleNameLST,layerId,existingFLnames):
output =
errorReport = None
i = 0
iFlcounter = flStartId
if corNames is None or PointCodeLST is None:
return
# Check if not list then create list
if not isinstance(corNames, list):
corNames = [corNames]
global adoc
global civdoc
global editor
global newFLnames
smoothOption = GradingSmoothOption(1,0.1,True,0.1)
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
SiteObjId = civdoc.GetSiteIds()[0]
#res.append(SiteObjId)
#res.append(layerId)
for corName in corNames:
for j in range(len(PointCodeLST)):
PointCode = PointCodeLST[j]
FLStyleName = FLStyleNameLST[j]
styleId = civdoc.Styles.FeatureLineStyles[FLStyleName]
#res.append(styleId)
# Get corridor from corridor collection
corId = civdoc.CorridorCollection[corName]
cor = t.GetObject(corId, OpenMode.ForRead)
try:
for Baseline in cor.Baselines:
MainBlFl = Baseline.MainBaselineFeatureLines
FlColMap = MainBlFl.FeatureLineCollectionMap
for FlCol in FlColMap:
for CorFl in FlCol:
if CorFl.CodeName == PointCode:
#res.append("CorFl:" + CorFl.CodeName)
temp = get_shortnameId2(PointCode,longNames)
FeatureLineName = FLname + "-" + corName + "_" + temp + "-(" + str(iFlcounter) + ")"
if exist_In_list(existingFLnames,FeatureLineName) == False:
isDynamic = False
CorFl.ExportAsGradingFeatureLine(SiteObjId, isDynamic, FeatureLineName, layerId, styleId, smoothOption)
#CorFl.StyleName = FeatureLineName
extracted = True
iFlcounter +=1
newFLnames.append(FeatureLineName)
except:
import traceback
errorReport = traceback.format_exc()
t.Commit()
if errorReport == None:
return output
else:
return errorReport