代码拉取完成,页面将自动刷新
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Curve"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
' Curve.cls v1.3 (Last updated 12/18/2001)
' Copyright 2000, 2001 by Frank Oquendo
'
' Permission to use, copy, modify, and distribute this software
' for any purpose and without fee is hereby granted, provided
' that the above copyright notice appears in all copies and
' that both that copyright notice and the limited warranty and
' restricted rights notice below appear in all supporting
' documentation.
'
' FRANK OQUENDO (THE AUTHOR) PROVIDES THIS PROGRAM "AS IS" AND WITH
' ALL FAULTS. THE AUTHOR SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY
' OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. THE AUTHOR
' DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
' UNINTERRUPTED OR ERROR FREE.
'
' Use, duplication, or disclosure by the U.S. Government is subject to
' restrictions set forth in FAR 52.227-19 (Commercial Computer
' Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
' (Rights in Technical Data and Computer Software), as applicable.
'
' Curve.cls allows developers to access the various VLAX-CURVE functions
' from Visual Basic or VBA.
'
' Notes:
' I do not claim copyright or authorship of the code being wrapped by this module,
' only on this compilation of that code.
'
' Dependencies:
' Use of this class module requires the following files:
' 1. VLAX.CLS - This file can be obtained by visiting http://www.acadx.com
Private objVLAX As VLAX
Private mvarEntity As AcadEntity
Private types(8) As String
Private Sub Class_Initialize()
Set objVLAX = New VLAX
types(0) = "AcDbCircle": types(1) = "AcDbLine"
types(2) = "AcDbArc": types(3) = "AcDbSpline"
types(4) = "AcDb3dPolyline": types(5) = "AcDbPolyline"
types(6) = "AcDb2dPolyline": types(7) = "AcDbEllipse"
types(8) = "AcDbLeader"
End Sub
Private Sub Class_Terminate()
Set objVLAX = Nothing
End Sub
Public Property Set Entity(ent As AcadEntity)
Dim tmp As String, i As Long, bFound As Boolean
tmp = ent.ObjectName
For i = 0 To 8
If tmp = types(i) Then
Set mvarEntity = ent
bFound = True
Exit For
End If
Next
If Not bFound Then Err.Raise vbObjectError + 1, , "That entity is not a curve."
End Property
Public Property Get Entity() As AcadEntity
Set entityt = mvarEntity
End Property
Public Property Get CurveType() As String
CurveType = mvarEntity.ObjectName
End Property
Public Property Get Area() As Double
Dim retval As Double
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
retval = .EvalLispExpression("(vlax-curve-getArea (handent handle))")
.NullifySymbol "handle"
End With
Area = retval
End Property
Public Property Get Closed() As Boolean
Dim retval As Boolean
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
retval = .EvalLispExpression("(vlax-curve-isClosed (handent handle))")
.NullifySymbol "handle"
End With
Closed = retval
End Property
Public Property Get EndParameter() As Double
Dim retval As Double
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
retval = .EvalLispExpression("(vlax-curve-getEndParam (handent handle))")
.NullifySymbol "handle"
End With
EndParameter = retval
End Property
Public Property Get EndPoint() As Variant
Dim retval As Variant, pt(0 To 2) As Double
Dim i As Long
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
.EvalLispExpression "(setq lst (vlax-curve-getEndPoint (handent handle)))"
retval = .GetLispList("lst")
.NullifySymbol "handle", "lst"
End With
For i = 0 To 2
pt(i) = retval(i)
Next
EndPoint = pt
End Property
Public Function GetClosestPointTo(point, Optional Extend As Boolean = False) As Variant
Dim retval As Variant, pt(0 To 2) As Double
Dim i As Long
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
.SetLispSymbol "givenPt", point
If Extend Then .EvalLispExpression "(setq ext T)"
.EvalLispExpression "(setq lst (vlax-curve-getClosestPointTo (handent handle) givenPt ext))"
retval = .GetLispList("lst")
.NullifySymbol "handle", "lst", "ext", "givenPt"
End With
For i = 0 To 2
pt(i) = retval(i)
Next
GetClosestPointTo = pt
End Function
Public Function GetDistanceAtParameter(Param As Double) As Double
Dim retval As Double
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
.SetLispSymbol "param", Param
retval = .EvalLispExpression("(vlax-curve-getDistAtParam (handent handle) param)")
.NullifySymbol "handle", "param"
End With
GetDistanceAtParameter = retval
End Function
Public Function GetDistanceAtPoint(point As Variant) As Double
Dim retval As Double
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
.SetLispSymbol "point", point
retval = .EvalLispExpression("(vlax-curve-getDistAtPoint (handent handle) point)")
.NullifySymbol "handle", "point"
End With
GetDistanceAtPoint = retval
End Function
Public Function GetFirstDerivative(Param As Double) As Variant
Dim retval As Variant
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
.SetLispSymbol "param", Param
.EvalLispExpression "(setq lst (vlax-curve-getFirstDeriv (handent handle) param))"
retval = .GetLispList("lst")
.NullifySymbol "handle", "param", "lst"
End With
GetFirstDerivative = retval
End Function
Public Function GetParameterAtDistance(Dist As Double) As Double
Dim retval As Double
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
.SetLispSymbol "dist", Dist
retval = .EvalLispExpression("(vlax-curve-getParamAtDist (handent handle) dist)")
.NullifySymbol "handle", "dist"
End With
GetParameterAtDistance = retval
End Function
Public Function GetParameterAtPoint(point As Variant) As Double
Dim retval As Double
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
.SetLispSymbol "point", point
retval = .EvalLispExpression("(vlax-curve-getparamAtPoint (handent handle) point)")
.NullifySymbol "handle", "point"
End With
GetParameterAtPoint = retval
End Function
Public Function GetPointAtDistance(Dist As Double) As Variant
Dim retval As Variant, pt(0 To 2) As Double
Dim i As Long
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
.SetLispSymbol "dist", Dist
.EvalLispExpression "(setq lst (vlax-curve-getPointAtDist (handent handle) dist))"
retval = .GetLispList("lst")
.NullifySymbol "handle", "dist", "lst"
End With
For i = 0 To 2
pt(i) = retval(i)
Next
GetPointAtDistance = pt
End Function
Public Function GetPointAtParameter(Param As Double) As Variant
Dim retval As Variant, pt(0 To 2) As Double
Dim i As Long
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
.SetLispSymbol "param", Param
.EvalLispExpression "(setq lst (vlax-curve-getPointAtParam (handent handle) param))"
retval = .GetLispList("lst")
.NullifySymbol "handle", "param", "lst"
End With
For i = 0 To 2
pt(i) = retval(i)
Next
GetPointAtParameter = pt
End Function
Public Function GetSecondDerivative(Param As Double) As Variant
Dim retval As Variant
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
.SetLispSymbol "param", Param
.EvalLispExpression "(setq lst (vlax-curve-getSecondDeriv (handent handle) param))"
retval = .GetLispList("lst")
.NullifySymbol "handle", "param", "lst"
End With
GetSecondDerivative = retval
End Function
Public Property Get length() As Double
Dim retval As Double
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
.EvalLispExpression "(setq curve (handent handle))"
retval = .EvalLispExpression("(vlax-curve-getDistAtParam curve (vlax-curve-getEndParam curve))")
.NullifySymbol "handle", "curve"
End With
length = retval
End Property
Public Property Get Periodic() As Boolean
Dim retval As Boolean
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
retval = .EvalLispExpression("(vlax-curve-isPeriodic (handent handle))")
.NullifySymbol "handle"
End With
Periodic = retval
End Property
Public Property Get Planar() As Boolean
Dim retval As Boolean
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
retval = .EvalLispExpression("(vlax-curve-isPlanar (handent handle))")
.NullifySymbol "handle"
End With
Planar = retval
End Property
Public Property Get StartPoint() As Variant
Dim retval As Variant, pt(0 To 2) As Double
'dim As Long
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
.EvalLispExpression "(setq lst (vlax-curve-getStartPoint (handent handle)))"
retval = .GetLispList("lst")
.NullifySymbol "handle", "lst"
End With
For i = 0 To 2
pt(i) = retval(i)
Next
StartPoint = pt
End Property
Public Function GetClosestPointToProjection(point As Variant, Normal As Variant, Optional Extend As Boolean = False) As Variant
Dim retval As Variant, pt(0 To 2) As Double
Dim i As Long
With objVLAX
.SetLispSymbol "handle", mvarEntity.handle
.SetLispSymbol "givenPt", point
.SetLispSymbol "normal", Normal
If Extend Then .EvalLispExpression "(setq ext T)"
.EvalLispExpression "(setq lst (vlax-curve-getClosestPointToProjection (handent handle) givenPt normal ext))"
retval = .GetLispList("lst")
.NullifySymbol "handle", "lst", "normal", "ext", "givenPt"
End With
For i = 0 To 2
pt(i) = retval(i)
Next
GetClosestPointToProjection = pt
End Function
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。