关于遍历的问题
<FONT color=#f70909>今天看书又遇到问题了!!</FONT>'(2)向选择集中添加对象<BR> '设置选择过滤器<BR> Dim FilterType(0 To 5) As Integer<BR> Dim FilterData(0 To 5) As Variant<BR> FilterType(0) = -4<BR> FilterData(0) = "<or" '逻辑运算符的开始,表示一个或多个运算对象<BR> FilterType(1) = 0 <FONT color=#ff0000> ----‘0’是什么意思,还有别的取值吗<BR></FONT> FilterData(1) = "Arc"<BR> FilterType(2) = 0<BR> FilterData(2) = "Circle"<BR> FilterType(3) = 0<BR> FilterData(3) = "Spline"<BR> FilterType(4) = 0<BR> FilterData(4) = "Line"<BR> FilterType(5) = -4<BR> FilterData(5) = "or>" '逻辑运算符的结束<BR> <FONT color=#ff3300>版主能给解释一下上面的语句吗<BR></FONT> '使用All的选择模式<BR> SSet.Select acSelectionSetAll, , , FilterType, FilterData<BR> <BR> '(3)遍历其中的对象<BR> Dim element As AcadEntity<BR> For Each element In SSet<BR> If element.ObjectName = "AcDbCircle" Or element.EntityType = acArc Then<BR> element.color = acRed<BR> End If<BR> <BR> Next
<FONT color=#ff0000>我在cad中画了直线、圆、弧可是运行代码后什么都没了???</FONT>
<FONT color=#ff0000>我想获得下图曲线于直线的交点该怎么做了?</FONT>
Sub ttt()<BR>On Error Resume Next<BR> Dim ss As AcadSelectionSet<BR> Dim ft(0) As Integer, fd(0)<BR> ft(0) = 0: fd(0) = "Arc,Circle,Spline,Line"<BR> ThisDrawing.SelectionSets("TTT").Delete<BR> Set ss = ThisDrawing.SelectionSets.Add("TTT")<BR> ss.Select acSelectionSetAll, , , ft, fd<BR> Dim element As AcadEntity<BR> For Each element In ss<BR> If element.ObjectName = "AcDbCircle" Or element.ObjectName = "AcDbArc" Then<BR> element.Color = acRed<BR> End If<BR> Next<BR>End Sub<BR>
回复
'0'代表DXF组码, 对就实体类型,如果你用 (entget (car (entsel))) 这一lisp请句选择一个"LINE"对象, 命令窗口会有如下信息:
Command: (entget (car (entsel)))
Select object: ((-1 . <Entity name: 7ef51f68>) (0 . "LINE") (330 . <Entity <BR>name: 7ef51cf8>) (5 . "E5") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . <BR>"0") (100 . "AcDbLine") (10 422.463 449.338 0.0) (11 974.845 698.167 0.0) (210 <BR>0.0 0.0 1.0))
如果选择一个"TEXT"对象呢?
Command: (entget (car (entsel)))
Select object: ((-1 . <Entity name: 7ef51f70>) (0 . "TEXT") (330 . <Entity <BR>name: 7ef51cf8>) (5 . "E6") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . <BR>"0") (100 . "AcDbText") (10 660.496 349.444 0.0) (40 . 2.5) (1 . "HELLO") (50 . <BR>0.0) (41 . 1.0) (51 . 0.0) (7 . "Standard") (71 . 0) (72 . 0) (11 0.0 0.0 0.0) <BR>(210 0.0 0.0 1.0) (100 . "AcDbText") (73 . 0))
不同的对象数据信息不同, 但会有通用的组码: 比如
0 - 类型
8 - 图层
... 关于取得直线河等高线的交点问题:看过以前各斑主的解答,先取得一条等高线的高程,然后改变直线的高程与等高线高程相同,主要是让直线和等高线共面,最后用InterSectWith函数求出交点
页:
[1]