443971181
发表于 2012-5-3 10:43:56
怎么应用呀,
wpf1118
发表于 2013-6-15 10:57:54
为什么用类函数,总是提示,错误 参数太少
zzyong00
发表于 2014-9-16 00:31:14
Private Sub Class_Initialize()
If Left(ThisDrawing.Application.Version, 2) = "15" Then
Set VL = ThisDrawing.Application.GetInterfaceObject("VL.Application.1")
Else
Set VL = ThisDrawing.Application.GetInterfaceObject("VL.Application.16")
End If
Set VLF = VL.ActiveDocument.Functions
End Sub
jzj-fx72
发表于 2015-11-4 12:12:51
通过运行,发现在以下代码运行时不稳定,报错
Private Sub Class_Initialize()
If Left(ThisDrawing.Application.Version, 2) = "15" Then
Set VL = ThisDrawing.Application.GetInterfaceObject("VL.Application.1")
Else
Set VL = ThisDrawing.Application.GetInterfaceObject("VL.Application.16")
End If
Set VLF = VL.ActiveDocument.Functions
End Sub
在参考其他源码,发现做如下变动,运行就比较稳定
Private Sub Class_Initialize()
ThisDrawing.SendCommand "(vl-load-com)" & vbCr '首先要加载VL接口,因为后面的函数是基于它的。本句为新添加语句,其他不变
If Left(ThisDrawing.Application.Version, 2) = "15" Then
Set VL = ThisDrawing.Application.GetInterfaceObject("VL.Application.1")
ElseIf Left(ThisDrawing.Application.Version, 2) = "16" Then
Set VL = ThisDrawing.Application.GetInterfaceObject("VL.Application.16")
End If
Set VLF = VL.ActiveDocument.Functions
End Sub
运行环境:XP3,CAD2006,VB6
zhangjie1108
发表于 2020-11-26 09:44:39
版主,麻烦请教个问题。vb进行cad二次开发的时候,如果想引用vlax和curve这两个类,是不是得在引用中添加类库,请问是哪个类库?
zhangjie1108
发表于 2020-11-26 15:25:26
请问楼主VLAX类 - VLAX.cls和Curve.cls两个类块怎么导入
bluelover
发表于 2021-6-15 22:48:40
有没有大神解释下Curve类模块中 GetClosestPointToProjection 的Normal参数在VBA中如何指定啊?
多谢!
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