shyshy0916 发表于 2007-10-27 16:39:00

如何从Coordinates中提取各坐标点数据

get3Dpts = ent.Coordinates<br/>  While get3Dpts(i) &lt;&gt; ""<br/>   x(0) = get3Dpts(i): x(1) = get3Dpts(i + 1): x(2) = get3Dpts(i + 2)<br/>    i = i + 3<br/>  Set point = ThisDrawing.ModelSpace.AddPoint(x)<br/>   Wend<br/>这里面get3Dpts(i) &lt;&gt; ""好像不能检验结束,不知如何是好!<br/>跪求各位老兄赐教!!小弟不胜感激!!!!!<br/>

muzi2005888 发表于 2007-10-27 18:19:00

<p>也许问题在get3Dpts的数据类型</p><p>未赋值的get3Dpsts也许等于0而不是""</p><p>不知道对不对,你测试一下</p>

shyshy0916 发表于 2007-10-28 02:30:00

上面的老兄说得对,我也觉得问题应该就在get3Dpts上<br/>但把它改成 While get3Dpts(i) &lt;&gt; 0 后,依然不对<br/>提示下标越界,即get3Dpts中的数据提完后,get3Dpts(i)就变得下标越界了。<br/>实在不知如何提出上面的 Coordinates 中的坐标。<br/>或是哪位老兄知道更简单的办法自动提取3D线上的坐标来<br/>跪求各位老兄赐教!!小弟不胜感激!!!!!<br/>

烟雨.江南 发表于 2007-11-2 11:14:00

<p>用Ubound(get3Dpts)可以得到get3Dpts数组的个数,然后用For循环就简单多了。</p>

兰州人 发表于 2007-11-6 16:08:00

<p>管板交点</p><p>Sub Example_IntersectWith()<br/>&nbsp;&nbsp;&nbsp; ' This example creates a line and circle and finds the points at<br/>&nbsp;&nbsp;&nbsp; ' which they intersect.<br/>&nbsp;&nbsp;&nbsp; Dim Object As AcadEntity, Object1 As AcadEntity<br/>&nbsp;&nbsp;&nbsp; Dim ii As Integer<br/>&nbsp;&nbsp;&nbsp; Dim ppt As Variant<br/>&nbsp;&nbsp;&nbsp; For ii = 0 To ThisDrawing.ModelSpace.Count - 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On Error Resume Next<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set Object = ThisDrawing.ModelSpace.Item(ii)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If ii = ThisDrawing.ModelSpace.Count - 1 Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set Object1 = ThisDrawing.ModelSpace.Item(0)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set Object1 = ThisDrawing.ModelSpace.Item(ii + 1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Debug.Print Object.Handle, Object1.Handle<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ppt = Object1.IntersectWith(Object, acExtendBoth)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.Print ii, ppt(0), ppt(1), ppt(2)<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; Next ii<br/>End Sub</p>
页: [1]
查看完整版本: 如何从Coordinates中提取各坐标点数据