里面有更加详细的说明! 具体没做过,不过感觉不难。
我做过三向光顺(就是一个物体的三视图,改变其中一个视图,另外两个自动变)和cad与excel的交互。开始用的是objectid方法,结果有些问题,后来用扩展数据做的,然后用文档级事件相应。
不难的。 TO:<A name=31451><FONT color=#000066><B>sharksun</B></FONT></A> 我现在正在做毕业设计,需要用到cad与excel交互的问题,时间非常紧急!!我看了你发的贴子,上面说到“
我做过三向光顺(就是一个物体的三视图,改变其中一个视图,另外两个自动变)和cad与excel的交互。开始用的是objectid方法,结果有些问题,后来用扩展数据做的,然后用文档级事件相应。不难的。”请问你能否把代码发给我看看,好好学习。我邮箱是<A href="mailto:aming800407@sohu.com" target="_blank" >aming800407@sohu.com</A> 十分感谢~~ 我最近做了个外板展开的小程序(用到高手们编写的vlax类),做了板缝线的交互修改,原理都差不多的。<BR>以下代码你可以参考一下:
Private Sub AcadDocument_ObjectModified(ByVal Obj As Object)<BR> Dim intI As Integer<BR> Dim intJ As Integer<BR> Dim intK As Integer<BR> Dim var1 As Variant<BR> Dim var2 As Variant<BR> Dim var3 As Variant<BR> Dim intA As Integer<BR> Dim Dis() As Double<BR> Dim pntArray() As Double<BR> Dim SeamNo As Integer<BR> <BR> Dim StartTan(0 To 2) As Double<BR> Dim EndTan(0 To 2) As Double<BR> <BR> If frm1.ChkInterM.value = True Then<BR> <BR> Set ObjCurve = New Curve<BR> <BR> Dim xt As Variant, xd As Variant<BR> Dim StrXd As String<BR> Dim xType As Variant, xData As Variant<BR> Obj.GetXData "", xt, xd<BR> <BR> Dim Fm1 As Integer, Fm2 As Integer<BR> Fm1 = xd(1): Fm2 = xd(2)<BR> <BR> ReDim Dis(Fm1 To Fm2) As Double<BR> ReDim pntArray(0 To (Fm2 - Fm1 + 1) * 3 - 1) As Double<BR> StrXd = Trim(CStr(xd(0)))<BR> SeamNo = CInt(Right(StrXd, Len(StrXd) - 2))
If Left(Trim(xd(0)), 2) = "SS" Then
For intK = Fm1 To Fm2
var1 = Obj.IntersectWith(ObjLine(intK), acExtendNone)<BR> var2 = ObjLine(intK).EndPoint
Dis(intK) = var1(1) - var2(1)<BR> <BR> Set ObjCurve.Entity = ObjFrame(intK)<BR> var3 = ObjCurve.GetPointAtDistance(Dis(intK))<BR> <BR> pntArray(intA) = var3(0)<BR> pntArray(intA + 1) = var3(1)<BR> pntArray(intA + 2) = 0<BR> intA = intA + 3<BR> <BR> Next intK<BR> <BR> SeamFMSpline(SeamNo).Delete 'ɾ³ýÔ­ÏȵÄ<BR> Set SeamFMSpline(SeamNo) = ThisDrawing.ModelSpace.AddSpline(pntArray, StartTan, EndTan)<BR> <BR>
ElseIf Left(Trim(xd(0)), 2) = "SF" Then<BR> For intK = Fm1 To Fm2<BR> <BR> var1 = Obj.IntersectWith(ObjFrame(intK), acExtendNone)<BR> Set ObjCurve.Entity = ObjFrame(intK)<BR> Dis(intK) = ObjCurve.GetDistanceAtPoint(var1)<BR> pntArray(intA) = SelectedFrameDisX(intK)<BR> pntArray(intA + 1) = Dis(intK) + ObjLine(intK).StartPoint<BR> pntArray(intA + 2) = 0<BR> intA = intA + 3<BR> Next intK<BR>
ShellSeam(SeamNo).Delete 'ɾ³ýÔ­ÏȵÄ<BR> Set ShellSeam(SeamNo) = ThisDrawing.ModelSpace.AddSpline(pntArray, StartTan, EndTan)<BR> <BR> End If
<BR> End If
End Sub
页:
1
[2]