Sub tt() On Error Resume Next Dim lay As AcadLayer Err.Clear Set lay = ThisDrawing.Layers("123") If Err Then MsgBox "没有123层" End If End Sub 线形、块定义等都差不多,就不重复了
On Error Resume Next Dim linetype As AcadLineType Err.Clear Set linetype = ThisDrawing.Layers("CENTER") If Err Then ' 没有这种线形 ThisDrawing.Linetypes.Load linetype, "acad.lin" End If
系统会报错啊!
写错了,是这样的。
On Error Resume Next Dim linetype As AcadLineType Err.Clear Set linetype = ThisDrawing.LineTypes("CENTER") If Err Then ' 没有这种线形 ThisDrawing.Linetypes.Load linetype, "acad.lin" End If
系统会报错啊!
Sub tt() On Error Resume Next Dim linetype As AcadLineType Err.Clear Set linetype = ThisDrawing.Linetypes("CENTER") If Err Then ' 没有这种线形 ThisDrawing.Linetypes.Load "CENTER", "acad.lin" Set linetype = ThisDrawing.Linetypes("CENTER") End If End Sub