xtl027 发表于 2006-6-15 10:07:00

[求助]vb与cad的问题

<P><FONT size=2>求助:vb与cad的问题<BR><BR></FONT>我可以在caD中画直线,但不能用样条曲线,请问,如何解决?<BR>具体如下:<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Set splineobj = AcadDoc.ModelSpace.AddLine(pt1, pt2) 可以画直线,</P>
<P>将其改为<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set splineobj = AcadDoc.ModelSpace.AddSpLine(pt1, pt2) </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 提示“ .AddSpLine ”参数不可选。我真不知道怎么回事?请知道的朋友赐教,谢谢!!! </P>
<P>具体是:&nbsp;&nbsp;&nbsp;</P>
<P>For &nbsp;i = 1 To n - 1<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;pt1(0) = x(i): pt1(1) = y(i): pt1(2) = 0&nbsp;&nbsp;'第一点的X、Y、Z<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;pt2(0) = x(i + 1): pt2(1) = y(i + 1): pt2(2) = 0 '第二点的X、Y、Z<BR>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Set splineobj = AcadDoc.ModelSpace.AddSpline(pt1, pt2)<BR>&nbsp; &nbsp;Next <BR></P>

xinghesnak 发表于 2006-6-15 14:59:00

<P>addspline用法:</P>
<P class=Heading-2>Signature
<P class=syntax>RetVal = object.AddSpline(PointsArray, StartTangent, EndTangent)
<P class=element>Object</P>
<P class=element-desc><A href="mk:@MSITStore:C:\Program%20Files\MDT6\HELP\ACADAUTO.CHM::/idh_modelspace_collection.htm" target="_blank" >ModelSpace Collection</A>, <A href="mk:@MSITStore:C:\Program%20Files\MDT6\HELP\ACADAUTO.CHM::/idh_paperspace_collection.htm" target="_blank" >PaperSpace Collection</A>, <A href="mk:@MSITStore:C:\Program%20Files\MDT6\HELP\ACADAUTO.CHM::/idh_block_object.htm" target="_blank" >Block</A><BR>The object or objects this method applies to.
<P class=element>PointsArray</P>
<P class=element-desc>Variant (array of doubles); input-only<BR>An array of 3D WCS coordinates defining the spline curve. At least two points (six elements) are required for constructing a Spline object. The array size must be in multiples of three.
<P class=element>StartTangent</P>
<P class=element-desc>Variant (three-element array of doubles); input-only<BR>A 3D vector specifying the tangency of the spline curve at the first point.
<P class=element>EndTangent</P>
<P class=element-desc>Variant (three-element array of doubles); input-only<BR>A 3D vector specifying the tangency of the spline curve at the last point.
<P class=element>RetVal</P>
<P class=element-desc><A href="mk:@MSITStore:C:\Program%20Files\MDT6\HELP\ACADAUTO.CHM::/idh_spline_object.htm" target="_blank" >Spline</A> object<BR>The newly created Spline object. </P>
<P class=element-desc>&nbsp;</P>
<P class=element-desc>例子如下:</P>
<P class=element-desc>Dim splineObj As AcadSpline<BR>&nbsp;&nbsp;&nbsp; Dim startTan(0 To 2) As Double<BR>&nbsp;&nbsp;&nbsp; Dim endTan(0 To 2) As Double<BR>&nbsp;&nbsp;&nbsp; Dim fitPoints(0 To 8) As Double<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0<BR>&nbsp;&nbsp;&nbsp; endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0<BR>&nbsp;&nbsp;&nbsp; fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0<BR>&nbsp;&nbsp;&nbsp; fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0<BR>&nbsp;&nbsp;&nbsp; fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0<BR>&nbsp;&nbsp;&nbsp; Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)<BR>&nbsp;&nbsp;&nbsp; ZoomAll<BR></P>

xtl027 发表于 2006-6-15 15:17:00

<P>谢谢!!!</P>
<P>请问:fitPoints 指什么?</P>

xinghesnak 发表于 2006-6-15 16:47:00

就是PLine上所有的节点(拐点)
页: [1]
查看完整版本: [求助]vb与cad的问题