当前位置:网站首页>ArcGIS Pro scripting tool (6) -- repairing CAD layer data sources
ArcGIS Pro scripting tool (6) -- repairing CAD layer data sources
2022-06-30 10:31:00 【Learning point GIS】
Pro Yes CAD File support is obviously better than ArcMap. Although they will CAD Identify points 、 Line 、 Noodles 、 Polyhedron and notes 5 Categories: , But when we drag one of the classes to Pro In the middle of the day ,Pro Automatically display it in layers , And the color of the layer is the same as CAD Agreement .nice!

But the embarrassment is , once CAD File moved location or changed name , It's a long list of red exclamation point warnings . Experienced users may expect to repair a layer after , Other layers are automatically repaired , But it's a pity that this is not for these CAD Invalid layer .
I'll put it off again CAD Just come in ? Maybe not , Because it's already in Pro The symbol system of some layers has been changed in , Drag again CAD You have to redo the symbol system of many layers , It's too troublesome .
For different situations , There are different solutions .
1、CAD File location changes , The file name does not change
In this case , The more convenient way is to open Catalog view - Contents tab - data source - working space , choice CAD Layer groups , Fill the new path with CAD The current location of the file , Click application , complete .

2、CAD The file location and file name have changed
The solution is one more step than the above , It needs to be updated first CAD file name . Or consider using scripting tools to implement .
Python Script
import os
import arcpy
aprx = arcpy.mp.ArcGISProject(r"CURRENT")
m = aprx.activeMap
groupLayer = arcpy.GetParameterAsText(0)
lyrs = m.listLayers()
cad = arcpy.GetParameterAsText(1)
cad_name = os.path.basename(cad)
cad_path = os.path.dirname(cad)
cp = {'workspace_factory': 'Cad', 'connection_info': {'database': cad_path}}
for lyr in lyrs:
longName = lyr.longName
if longName.startswith(groupLayer) and lyr.isGroupLayer==False:
lyrCIM = lyr.getDefinition("V2")
dc = lyrCIM.featureTable.dataConnection
# Update the feature dataset with the new CAD file name
dc.featureDataset = cad_name
# Update layer CIM
lyr.setDefinition(lyrCIM)
lyr.updateConnectionProperties(lyr.connectionProperties, cp)
sym=lyr.symbology
color=sym.renderer.symbol.color
color['RGB'][3]=100
sym.renderer.symbol.color=color
lyr.symbology=sym
arcpy.AddMessage(' Repaired '+lyr.name)
Parameter setting

Run Demo

Model description
In addition to repair CAD Outside the data source of the layer , The scripting tool also cancels all CAD Transparency of the face symbol of the layer , It is convenient to uniformly adjust on the Appearance tab .
边栏推荐
- “昆明城市咖啡地图”活动再度开启
- Harvester ch1 of CKB and HNS, connection tutorial analysis
- L'activité "Kunming City coffee map" a rouvert
- 100个句子记完7000个雅思词汇,实际只有1043个词汇(包括 I and you 等简单词汇)
- Notes on numerical calculation - iterative solution of linear equations
- 技能梳理[email protected]+adxl345+电机震动+串口输出
- GD32 RT-Thread OTA/Bootloader驱动函数
- Curl --- the request fails when the post request parameter is too long (more than 1024b)
- 2022 Season 6 perfect children's model toxon division finals came to a successful conclusion
- Koreano essential creates a professional style
猜你喜欢

SolidWorks质量特性详解(惯性张量、转动惯量、惯性主轴)

IPhone address book import into Excel

那个程序员,被打了。

Deployment of efficient and versatile clusters lvs+kept highly available clusters

孙安民作品《莲花净心》数字藏品上线长城数艺

逸仙電商發布一季報:堅持研發及品牌投入,實現可持續高質量發展

Apple's 5g chip was revealed to have failed in research and development, and the QQ password bug caused heated discussion. Wei Lai responded to the short selling rumors. Today, more big news is here

MySQL log management, backup and recovery of databases (1)

MIT-6874-Deep Learning in the Life Sciences Week5

陈颢天 荣获第七届少儿模特明星盛典全国总决赛 全国总冠军
随机推荐
【Rust日报】2021-01-22 首份Rust月刊杂志邀请大家一起参与
潘多拉 IOT 开发板学习(HAL 库)—— 实验1 跑马灯(RGB)实验(学习笔记)
Leetcode question brushing (IV) -- greedy thought (go Implementation)
Getting started with X86 - take over bare metal control
2022第六季完美童模 托克逊赛区 决赛圆满落幕
MySQL advanced SQL statement of database (2)
Jinbei LT6 is powerful in the year of the tiger, making waves
机器学习面试准备(一)KNN
[C language quick start] let you know C language and get started with zero basics ③
Deploy lvs-dr cluster
Harvester ch1 of CKB and HNS, connection tutorial analysis
The AOV function of R language was used for repeated measures ANOVA (one intra group factor and one inter group factor) and interaction Plot function and boxplot to visualize the interaction
苹果5G芯片被曝研发失败,QQ密码bug引热议,蔚来回应做空传闻,今日更多大新闻在此...
100个句子记完7000个雅思词汇,实际只有1043个词汇(包括 I and you 等简单词汇)
Ant s19xp appeared in 140t, why is it called the computing power ceiling by the world
基于强化学习的股票量化交易Automated-Stock-Trading-Ensemble-Strategy
[AGC] build service 3- authentication service example
技能梳理[email protected]體感機械臂
ArcGIS Pro + PS 矢量化用地规划图
六月集训(第30天) —— 拓扑排序