请问高手一个问题!急死小弟了!
<FONT color=#f73809>以下是一个调cad画阶梯轴的activeX dll,里面有6个参数d1,d2,d3,l1,l2,l3,分别是阶梯轴的三段直径和长度,我想在asp里调用它,这个dll在vb里通过exe调试是可以用的,而到了asp调用时先是等好长时间,然后就告诉我 <BR>jtz 错误 '800a005b' <BR>未设置对象变量或 With block 变量 <BR>/huatu.asp,行 20 </FONT><FONT color=#f73809>vbdll如下:</FONT>
Option Explicit<BR>Dim AcadApp As AcadApplication<BR>Dim Preference As AcadPreferences<BR>Dim AcadDoc As AcadDocument<BR>Dim MoSpace As AcadModelSpace<BR>Dim PaSpace As AcadPaperSpace<BR>Private d1_1 As Single<BR>Private d2_1 As Single<BR>Private d3_1 As Single<BR>Private l1_1 As Single<BR>Private l2_1 As Single<BR>Private l3_1 As Single<BR>Public Property Get d1() As Single<BR>d1 = d1_1<BR>End Property
Public Property Let d1(ByVal vNewValue As Single)<BR>d1_1 = vNewValue<BR>End Property
Public Property Get d2() As Single<BR>d2 = d2_1<BR>End Property
Public Property Let d2(ByVal vNewValue As Single)<BR>d2_1 = vNewValue<BR>End Property
Public Property Get d3() As Single<BR>d3 = d3_1<BR>End Property
Public Property Let d3(ByVal vNewValue As Single)<BR>d3_1 = vNewValue<BR>End Property
Public Property Get l1() As Single<BR>l1 = l1_1<BR>End Property
Public Property Let l1(ByVal vNewValue As Single)<BR>l1_1 = vNewValue<BR>End Property
Public Property Get l2() As Single<BR>l2 = l2_1<BR>End Property
Public Property Let l2(ByVal vNewValue As Single)<BR>l2_1 = vNewValue<BR>End Property
Public Property Get l3() As Single<BR>l3 = l3_1<BR>End Property
Public Property Let l3(ByVal vNewValue As Single)<BR>l3_1 = vNewValue<BR>End Property
<BR>Public Sub diaoyong()
Dim CLayer As AcadLayer '图层<BR>Dim CTextStyle As AcadTextStyle '文本式样<BR>Dim CDimStyle As AcadDimStyle '标注式样
Dim DimObj As AcadDimAligned '标注
Dim DwgName As String
Dim BP(0 To 2) As Double '基点
Dim CP1(0 To 2) As Double '中心点<BR>Dim CP2(0 To 2) As Double
<BR>Dim P1(0 To 2) As Double '关键点<BR>Dim P2(0 To 2) As Double<BR>Dim P3(0 To 2) As Double<BR>Dim P4(0 To 2) As Double<BR>Dim P5(0 To 2) As Double<BR>Dim P6(0 To 2) As Double<BR>Dim P7(0 To 2) As Double<BR>Dim P8(0 To 2) As Double<BR>Dim P9(0 To 2) As Double<BR>Dim P10(0 To 2) As Double<BR>Dim P11(0 To 2) As Double<BR>Dim P12(0 To 2) As Double
BP(0) = 0: BP(1) = 0: BP(2) = 0
P1(0) = BP(0): P1(1) = BP(1) - d1 / 2#<BR>P2(0) = BP(0): P2(1) = BP(1) + d1 / 2#<BR>P3(0) = BP(0) + l1: P3(1) = BP(1) - d1 / 2#<BR>P4(0) = BP(0) + l1: P4(1) = BP(1) + d1 / 2#<BR>P5(0) = BP(0) + l1: P5(1) = BP(1) - d2 / 2#<BR>P6(0) = BP(0) + l1: P6(1) = BP(1) + d2 / 2#<BR>P7(0) = BP(0) + l1 + l2: P7(1) = BP(1) - d2 / 2#<BR>P8(0) = BP(0) + l1 + l2: P8(1) = BP(1) + d2 / 2#<BR>P9(0) = BP(0) + l1 + l2: P9(1) = BP(1) - d3 / 2#<BR>P10(0) = BP(0) + l1 + l2: P10(1) = BP(1) + d3 / 2#<BR>P11(0) = BP(0) + l1 + l2 + l3: P11(1) = BP(1) - d3 / 2#<BR>P12(0) = BP(0) + l1 + l2 + l3: P12(1) = BP(1) + d3 / 2#
CP1(0) = BP(0) - 5: CP1(1) = BP(1)<BR>CP2(0) = BP(0) + l1 + l2 + l3 + 5: CP2(1) = BP(1)<BR> <BR> '1.连接AutoCAD<BR> Call 连接AutoCAD<BR> <BR> '2.新建AutoCAD文件<BR> DwgName = App.Path & "\ini.dwt"<BR> Call NewDwg(DwgName)<BR> <BR> '4设定当前层,画实线<BR> Set CLayer = AcadDoc.Layers.Item("01")<BR> AcadDoc.ActiveLayer = CLayer<BR> MoSpace.AddLine P1, P2<BR> MoSpace.AddLine P1, P3<BR> MoSpace.AddLine P2, P4<BR> MoSpace.AddLine P5, P6<BR> MoSpace.AddLine P5, P7<BR> MoSpace.AddLine P6, P8<BR> MoSpace.AddLine P9, P10<BR> MoSpace.AddLine P9, P11<BR> MoSpace.AddLine P10, P12<BR> MoSpace.AddLine P11, P12<BR> <BR> Set CLayer = AcadDoc.Layers.Item("04")<BR> AcadDoc.ActiveLayer = CLayer<BR> MoSpace.AddLine CP1, CP2<BR> <BR> '标注尺寸
Dim Textlocation(0 To 2) As Double<BR> Dim ExtLinePoint1(0 To 2) As Double<BR> Dim ExtLinePoint2(0 To 2) As Double<BR> Dim DimText As Double<BR> Set CLayer = AcadDoc.Layers.Item("05") '设定当前层<BR> AcadDoc.ActiveLayer = CLayer<BR> 'Set CDimStyle = AcadDoc.DimStyles.Item("sta") '设定标注式样<BR> ' AcadDoc.ActiveDimStyle = CDimStyle<BR> <BR> Textlocation(0) = P1(0) + 10: Textlocation(1) = 0: Textlocation(2) = 0<BR> Set DimObj = MoSpace.AddDimAligned(P1, P2, Textlocation)<BR> <BR> <BR> Textlocation(0) = P4(0) + 10: Textlocation(1) = 0: Textlocation(2) = 0<BR> Set DimObj = MoSpace.AddDimAligned(P5, P6, Textlocation)<BR> <BR> Textlocation(0) = P8(0) + 10: Textlocation(1) = 0: Textlocation(2) = 0<BR> Set DimObj = MoSpace.AddDimAligned(P9, P10, Textlocation)<BR> <BR> Textlocation(0) = 0: Textlocation(1) = P2(1) + 15: Textlocation(2) = 0<BR> Set DimObj = MoSpace.AddDimAligned(P2, P4, Textlocation)<BR> <BR> Textlocation(0) = 0: Textlocation(1) = P2(1) + 15: Textlocation(2) = 0<BR> Set DimObj = MoSpace.AddDimAligned(P6, P8, Textlocation)<BR> <BR> Textlocation(0) = 0: Textlocation(1) = P2(1) + 15: Textlocation(2) = 0<BR> Set DimObj = MoSpace.AddDimAligned(P10, P12, Textlocation)<BR> <BR>End Sub
Private Sub 连接AutoCAD()<BR> On Error Resume Next<BR> Set AcadApp = GetObject(, "Autocad.Application")<BR> If Err Then<BR> Err.Clear<BR> Set AcadApp = CreateObject("Autocad.Application")<BR> If Err Then<BR> MsgBox ("不能运行AutoCAD,请检查是否安装了AutoCAD!")<BR> Exit Sub<BR> End If<BR> End If<BR> AcadApp.Visible = True '不可见<BR> 'AcadApp.ActiveDocument.Close (True)<BR>End Sub<BR>Private Sub NewDwg(DwgName As String)<BR> On Error Resume Next<BR> AcadApp.Documents.Add DwgName<BR> AppActivate AcadApp.Caption<BR> <BR> Set Preference = AcadApp.Preferences '对象引用<BR> Set AcadDoc = AcadApp.ActiveDocument<BR> Set MoSpace = AcadDoc.ModelSpace<BR> Set PaSpace = AcadDoc.PaperSpace<BR>End Sub
<FONT color=#ee1111>相关asp如下:</FONT>
<% <BR>Dim objSum<BR>Set objSum = Server.CreateObject("jtz.jtzcad")<BR>objSum.d1 = 10<BR>objSum.d2 = 20<BR>objSum.d3 = 30<BR>objSum.l1 = 10<BR>objSum.l2 = 10<BR>objSum.l3 = 10<BR>objSum.diaoyong<BR>Set objSum = Nothing<BR>%> 用VB工程调试过了么?我这里没装VB:),你先调一下
页:
[1]