cad。vb二次开发 选择多段线并将它改成蓝色,我不知道代码错在哪里,请高人指点
PrivateSubCommand1_Click()Text1.Text=""'*****************************************'不同的...
Private Sub Command1_Click()
Text1.Text = ""
'*****************************************
'不同的版本都能实现
' On Error Resume Next
Set MyCAD = GetObject(, "AutoCAD.Application")
'*****************************************
'----------------------------------------
'*****************************************
' 创建新的选择集
Dim MyDoc As AutoCAD.AcadDocument
Set MyDoc = MyCAD.ActiveDocument
Dim MySset As AcadSelectionSet
Set MySset = MyDoc.SelectionSets.Add("SS156465787820")
MySset.SelectOnScreen
'*****************************************
'----------------------------------------
'*****************************************
' 在选择集中循环并将每一对象的颜色改为蓝色
Dim MyEntry As AcadEntity
For Each MyEntry In MySset
MyEntry.Color = acBlue
MyEntry.Update
Next MyEntry
Text1.Text = MySset.Count
'*****************************************
MySset.Clear
MySset.Delete
End Sub
Private Sub Command2_Click()
End
End Sub 展开
Text1.Text = ""
'*****************************************
'不同的版本都能实现
' On Error Resume Next
Set MyCAD = GetObject(, "AutoCAD.Application")
'*****************************************
'----------------------------------------
'*****************************************
' 创建新的选择集
Dim MyDoc As AutoCAD.AcadDocument
Set MyDoc = MyCAD.ActiveDocument
Dim MySset As AcadSelectionSet
Set MySset = MyDoc.SelectionSets.Add("SS156465787820")
MySset.SelectOnScreen
'*****************************************
'----------------------------------------
'*****************************************
' 在选择集中循环并将每一对象的颜色改为蓝色
Dim MyEntry As AcadEntity
For Each MyEntry In MySset
MyEntry.Color = acBlue
MyEntry.Update
Next MyEntry
Text1.Text = MySset.Count
'*****************************************
MySset.Clear
MySset.Delete
End Sub
Private Sub Command2_Click()
End
End Sub 展开
1个回答
展开全部
'改为如下即可:
Private Sub Command1_Click()
Text1.Text = ""
'*****************************************
'不同的版本都能实现
' On Error Resume Next
Set MyCAD = GetObject(, "AutoCAD.Application")
'*****************************************
'----------------------------------------
'*****************************************
' 创建新的选择集
'Dim MyDoc As AutoCAD.AcadDocument
Dim MyDoc As Object
Set MyDoc = MyCAD.ActiveDocument
'Dim MySset As AcadSelectionSet
Dim MySset As Object
Set MySset = MyDoc.SelectionSets.Add("SS156465787820")
MySset.SelectOnScreen
'*****************************************
'----------------------------------------
'*****************************************
' 在选择集中循环并将每一对象的颜色改为蓝色
'Dim MyEntry As AcadEntity
Dim MyEntry As Object
For Each MyEntry In MySset
'MyEntry.Color = acBlue
MyEntry.Color = 5
MyEntry.Update
Next
Text1.Text = MySset.Count
'*****************************************
MySset.Clear
MySset.Delete
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command1_Click()
Text1.Text = ""
'*****************************************
'不同的版本都能实现
' On Error Resume Next
Set MyCAD = GetObject(, "AutoCAD.Application")
'*****************************************
'----------------------------------------
'*****************************************
' 创建新的选择集
'Dim MyDoc As AutoCAD.AcadDocument
Dim MyDoc As Object
Set MyDoc = MyCAD.ActiveDocument
'Dim MySset As AcadSelectionSet
Dim MySset As Object
Set MySset = MyDoc.SelectionSets.Add("SS156465787820")
MySset.SelectOnScreen
'*****************************************
'----------------------------------------
'*****************************************
' 在选择集中循环并将每一对象的颜色改为蓝色
'Dim MyEntry As AcadEntity
Dim MyEntry As Object
For Each MyEntry In MySset
'MyEntry.Color = acBlue
MyEntry.Color = 5
MyEntry.Update
Next
Text1.Text = MySset.Count
'*****************************************
MySset.Clear
MySset.Delete
End Sub
Private Sub Command2_Click()
End
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询