LZ,我估计你定义的sst类型不是Variant。 而RetVal = object.Offset(Distance) RetVal是一个Variant类型 Variant (array of objects) An array of the newly created objects resulting from the offset. ’代码如下: Sub Example_Offset() ' This example creates a lightweight polyline ' and then offsets the polyline. ' Create the polyline Dim plineObj As AcadLWPolyline Dim points(0 To 11) As Double points(0) = 1: points(1) = 1 points(2) = 1: points(3) = 2 points(4) = 2: points(5) = 2 points(6) = 3: points(7) = 2 points(8) = 4: points(9) = 4 points(10) = 4: points(11) = 1 Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points) plineObj.Closed = True ' Offset the polyline Dim offsetObj As Variant offsetObj = plineObj.Offset(0.25) Dim pLwpOffset As AcadLWPolyline Set pLwpOffset = offsetObj(0) '得到偏移后的多段线 '定义绿色 Dim CorGreen As AcadAcCmColor Set CorGreen = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16") Call CorGreen.SetRGB(0, 255, 0) '绿色 pLwpOffset.TrueColor = CorGreen End Sub |