明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1455|回复: 3

[求助]vb与cad的问题

  [复制链接]
发表于 2006-6-15 10:07:00 | 显示全部楼层 |阅读模式

求助:vb与cad的问题

我可以在caD中画直线,但不能用样条曲线,请问,如何解决?
具体如下:
        Set splineobj = AcadDoc.ModelSpace.AddLine(pt1, pt2) 可以画直线,

将其改为
       Set splineobj = AcadDoc.ModelSpace.AddSpLine(pt1, pt2)

      提示“ .AddSpLine ”参数不可选。我真不知道怎么回事?请知道的朋友赐教,谢谢!!!

具体是:   

For  i = 1 To n - 1
        pt1(0) = x(i): pt1(1) = y(i): pt1(2) = 0  '第一点的X、Y、Z
        pt2(0) = x(i + 1): pt2(1) = y(i + 1): pt2(2) = 0 '第二点的X、Y、Z
        Set splineobj = AcadDoc.ModelSpace.AddSpline(pt1, pt2)
   Next

发表于 2006-6-15 14:59:00 | 显示全部楼层

addspline用法:

Signature

RetVal = object.AddSpline(PointsArray, StartTangent, EndTangent)

Object

MSITStore:C:\Program%20Files\MDT6\HELP\ACADAUTO.CHM::/idh_modelspace_collection.htm" target="_blank" >ModelSpace Collection, MSITStore:C:\Program%20Files\MDT6\HELP\ACADAUTO.CHM::/idh_paperspace_collection.htm" target="_blank" >PaperSpace Collection, MSITStore:C:\Program%20Files\MDT6\HELP\ACADAUTO.CHM::/idh_block_object.htm" target="_blank" >Block
The object or objects this method applies to.

PointsArray

Variant (array of doubles); input-only
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.

StartTangent

Variant (three-element array of doubles); input-only
A 3D vector specifying the tangency of the spline curve at the first point.

EndTangent

Variant (three-element array of doubles); input-only
A 3D vector specifying the tangency of the spline curve at the last point.

RetVal

MSITStore:C:\Program%20Files\MDT6\HELP\ACADAUTO.CHM::/idh_spline_object.htm" target="_blank" >Spline object
The newly created Spline object.

 

例子如下:

Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double
   
    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll

 楼主| 发表于 2006-6-15 15:17:00 | 显示全部楼层

谢谢!!!

请问:fitPoints 指什么?

发表于 2006-6-15 16:47:00 | 显示全部楼层
就是PLine上所有的节点(拐点)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-27 02:48 , Processed in 0.163206 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表