cad clipboard !!help!!
本帖最后由 作者 于 2009-1-7 11:59:31 编辑 <br /><br /> <p>用鼠标在CAD中选择一个文字,然后提取其中的字符串并复制到clipboard中!</p><p>xie le !!!</p> 以前干过这活,搜下我发的帖子。 谢谢楼上!<br/>问题已经解决了,当时是找不到MS forms 2.0 lib库,插入一个form就有了! <p><a href="http://www.experts-exchange.com/Applications/CAD/Q_21731171.html">http://www.experts-exchange.com/Applications/CAD/Q_21731171.html</a></p><p>Sub VTC() 'short for SystemVariableToClipboard<br/> <br/> toClipboard<br/> <br/>End Sub</p><p>Sub toClipboard() 'short for SystemVariableToClipboard<br/> <br/> Dim objectList As New DataObject<br/> Dim param As String<br/> Dim parameterArray() As String<br/> Dim ref As String</p><p> parameterArray() = Split(ThisDrawing.Utility.GetString(False), " ")<br/> For i = 0 To UBound(parameterArray)<br/> ref = ref & getSysVar(parameterArray(i))<br/> If UBound(parameterArray) > 0 Then ref = ref & vbNewLine<br/> Next i<br/> <br/> objectList.SetText ref<br/> objectList.PutInClipboard<br/> <br/>End Sub</p><p>Private Function getSysVar(varName As String) As String<br/>Dim SysVar As String<br/>Dim i As Integer</p><p>On Error Resume Next<br/>SysVar = ThisDrawing.GetVariable(varName)<br/>If Err <> 0 Then<br/> Err.Clear<br/> SysVar = varName<br/>ElseIf varName = "DWGNAME" Then 'REMOVE DRAWING FILE EXTENSIOIN IE '.dwg'<br/> Do<br/> If Mid(SysVar, Len(SysVar) - i, 1) = "." Then<br/> SysVar = Left(SysVar, Len(SysVar) - i - 1)<br/> i = Len(SysVar)<br/> Else<br/> i = i + 1<br/> End If<br/> Loop While i < Len(SysVar)<br/>End If</p><p>getSysVar = SysVar</p><p>End Function</p><p></p><p>Sub tt1()<br/>Dim a As New DataObject<br/>a.SetText "ABC"<br/>a.PutInClipboard<br/>End Sub<br/>Sub tt2()<br/>Dim a As New DataObject<br/>a.GetFromClipboard<br/>MsgBox a.GetText<br/>End Sub<br/></p> <br/>Sub llss1()<br/>ThisDrawing.SendCommand "_ai_selall" & vbCr<br/>ThisDrawing.SendCommand "copyclip" & vbCr<br/>End Sub <br/>Sub llss1()<br/>'ThisDrawing.SendCommand "_ai_selall" & vbCr<br/>Dim ent As AcadEntity<br/>Set ent = ThisDrawing.HandleToObject("91")<br/>ent.Highlight True<br/>ThisDrawing.SendCommand "copyclip" & vbCr & "All" & vbCr<br/>End Sub
页:
[1]