如何得到偏移后的对象?
<p>set sst=sst1.offset 100</p><p>提示出现错误!!!请高手指点</p> <p>LZ,我估计你定义的sst类型不是Variant。</p><p>而RetVal = object.Offset(Distance) </p><p class="element"><strong>RetVal是一个Variant类型</strong></p><p class="element-desc">Variant (array of objects)<br/>An array of the newly created objects resulting from the offset.</p><p class="element-desc"></p><p><strong>’代码如下:</strong></p><p>Sub Example_Offset()<br/> ' This example creates a lightweight polyline<br/> ' and then offsets the polyline.<br/> <br/> ' Create the polyline<br/> Dim plineObj As AcadLWPolyline<br/> Dim points(0 To 11) As Double<br/> points(0) = 1: points(1) = 1<br/> points(2) = 1: points(3) = 2<br/> points(4) = 2: points(5) = 2<br/> points(6) = 3: points(7) = 2<br/> points(8) = 4: points(9) = 4<br/> points(10) = 4: points(11) = 1<br/> Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)<br/> plineObj.Closed = True</p><p> ' Offset the polyline<br/> Dim offsetObj As Variant<br/> offsetObj = plineObj.Offset(0.25) <br/> <br/> Dim pLwpOffset As AcadLWPolyline<br/> Set pLwpOffset = offsetObj(0) '得到偏移后的多段线<br/> <br/> '定义绿色<br/> Dim CorGreen As AcadAcCmColor<br/> Set CorGreen = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16")<br/> Call CorGreen.SetRGB(0, 255, 0) '绿色<br/> pLwpOffset.TrueColor = CorGreen<br/> <br/>End Sub</p> 非常感谢!原来偏移后的对象可能不了1个,所以是Variant<br/> 明白了。 学习了!
页:
[1]