hanhanb 发表于 2009-1-7 11:58:00

cad clipboard !!help!!

本帖最后由 作者 于 2009-1-7 11:59:31 编辑 <br /><br /> <p>用鼠标在CAD中选择一个文字,然后提取其中的字符串并复制到clipboard中!</p><p>xie le !!!</p>

兰州人 发表于 2009-1-8 08:37:00

以前干过这活,搜下我发的帖子。

hanhanb 发表于 2009-1-8 09:02:00

谢谢楼上!<br/>问题已经解决了,当时是找不到MS forms 2.0 lib库,插入一个form就有了!

ningyong58 发表于 2010-1-16 16:12:00

<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/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; toClipboard<br/>&nbsp;&nbsp;&nbsp; <br/>End Sub</p><p>Sub toClipboard() 'short for SystemVariableToClipboard<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; Dim objectList As New DataObject<br/>&nbsp;&nbsp;&nbsp; Dim param As String<br/>&nbsp;&nbsp;&nbsp; Dim parameterArray() As String<br/>&nbsp;&nbsp;&nbsp; Dim ref As String</p><p>&nbsp;&nbsp;&nbsp; parameterArray() = Split(ThisDrawing.Utility.GetString(False), " ")<br/>&nbsp;&nbsp;&nbsp; For i = 0 To UBound(parameterArray)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ref = ref &amp; getSysVar(parameterArray(i))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If UBound(parameterArray) &gt; 0 Then ref = ref &amp; vbNewLine<br/>&nbsp;&nbsp;&nbsp; Next i<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; objectList.SetText ref<br/>&nbsp;&nbsp;&nbsp; objectList.PutInClipboard<br/>&nbsp;&nbsp;&nbsp; <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 &lt;&gt; 0 Then<br/>&nbsp;&nbsp;&nbsp; Err.Clear<br/>&nbsp;&nbsp;&nbsp; SysVar = varName<br/>ElseIf varName = "DWGNAME" Then 'REMOVE DRAWING FILE EXTENSIOIN IE '.dwg'<br/>&nbsp;&nbsp;&nbsp; Do<br/>&nbsp;&nbsp;&nbsp; If Mid(SysVar, Len(SysVar) - i, 1) = "." Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SysVar = Left(SysVar, Len(SysVar) - i - 1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i = Len(SysVar)<br/>&nbsp;&nbsp;&nbsp; Else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i = i + 1<br/>&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp; Loop While i &lt; 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>

ningyong58 发表于 2010-1-16 16:54:00

<br/>Sub llss1()<br/>ThisDrawing.SendCommand "_ai_selall" &amp; vbCr<br/>ThisDrawing.SendCommand "copyclip" &amp; vbCr<br/>End Sub

ningyong58 发表于 2010-1-16 17:01:00

<br/>Sub llss1()<br/>'ThisDrawing.SendCommand "_ai_selall" &amp; vbCr<br/>Dim ent As AcadEntity<br/>Set ent = ThisDrawing.HandleToObject("91")<br/>ent.Highlight True<br/>ThisDrawing.SendCommand "copyclip" &amp; vbCr &amp; "All" &amp; vbCr<br/>End Sub
页: [1]
查看完整版本: cad clipboard !!help!!