其他分享
首页 > 其他分享> > arcgis 获得工具有多少个

arcgis 获得工具有多少个

作者:互联网

arcgis 获得工具有多少个

arcgis 获得工具有多少个

import  arcgisscripting

import  string;

gp = arcgisscripting.create(9.3);

##多少个工具箱

toolboxes = gp.listToolboxes();

for toolbox in toolboxes:

    #截取工具箱的别名

    first = string.find(toolbox,"("); ##第一个'('的索引值

    end = string.find(toolbox,")")    ##最后一个')'的索引值

    toolboxAlias = toolbox[first+1:end]; ##工具箱的别名

    gp.AddMessage(toolboxAlias);

    i = 0;

    tools = gp.listTools();

    for tool in tools:

        f =  string.find(tool,"_"); ##"_"的索引值

        alias = tool[f+1:];

        if alias == toolboxAlias:

            gp.AddMessage( tool);

            i=i+1;

    gp.AddMessage(  "====="+toolbox+"'s count:"+str(i));

gp.AddMessage( "the tool count:"+str( len(tools)));

gp.AddMessage(  "the toolbox count:"+str(len(toolboxes)));

 

标签:AddMessage,string,gp,##,tool,多少,arcgis,工具,toolbox
来源: https://blog.51cto.com/u_12139363/3018415