• VB编程编辑AutoCAD样条曲线


    编辑样条曲线的方法很多,可以通过对其进行拟合进行增加、移动和删除,提高拟合点的权重等操作,可以设置样条曲线的公差,可以提高样条曲线的等级总新定义样条曲线。

    一下代码创建一条样条曲线,并改变公差,测试效果。

    Private Sub Command1_Click()
        acadapp.ActiveDocument.SetVariable "SPLFRAME", 0
        Dim splineobj As AcadSpline
        Dim noofpoints As Integer
        Dim starttan(0 To 2) As Double
        Dim endtan(0 To 2) As Double
        Dim fitpoints(0 To 8) As Double
        noofpoints = 3
        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 = acadapp.ActiveDocument.ModelSpace.AddSpline(fitpoints, starttan, endtan)
        ZoomExtents
        splineobj.Update
        Dim currfittolerance As Double
        currfittolerance = splineobj.FitTolerance
        MsgBox "样条曲线拟合公差为" & currfittolerance
        splineobj.FitTolerance = 3
        splineobj.Update
        MsgBox "样条曲线拟合公差改变为" & splineobj.FitTolerance
    End Sub

    公差越小,各点的拟合情况越好,公差越大,生成的样条曲线月光滑,但各点的拟合情况越差。可以通过设置系统变量SPLFRAME使样条曲线的控制框和控制点显示出来。

  • 相关阅读:
    ZOJ 3818 Pretty Poem
    HDU 4597 Play Game
    HDU 4497 GCD and LCM
    CSU 1335 高桥和低桥
    UVA 10791 Minimum Sum LCM
    CSU 1119 Collecting Coins
    CSU 1120 病毒
    UVA 12169 Disgruntled Judge
    HDU 1301 Jungle Roads
    POJ 1258 Agri-Net
  • 原文地址:https://www.cnblogs.com/bimgoo/p/2503136.html
Copyright © 2020-2023  润新知