How do I put VisSim blocks on the clipboard from my application?
Answers
-
Submitted by pete on Tue, 09/22/2009 - 10:32.
I have attached a simple MFC project below that will create VisSim blocks in your application and copy them to the clipboard. It works for label blocks and transfer functions but can be easily extended to all blocks. Here are two of the key functions:
CString makeBlock( LPCSTR blockType, LPCSTR blockName)<br> {<br> CString s;<br> s = '; VisSim Block Diagram Format (VBDF)\r\n';<br> s += 'N.1=\'';<br> s += blockType;<br> s += '\'*1x1\r\n';<br> s += 'n=\'';<br> s += blockName;<br> s += '\'r\n';<br> return s;<br> }<br> void CMainFrame::OnCopyTransferfunction()<br> {<br> CString s = makeBlock('transferFunction', 'myfile.m');<br> s += 'Xi=\'0 \'\n'; // Initial condition<br> s += 'Xg=1.2\n'; // Gain<br> s += 'Xn=\'1 2\'\n'; // Numerator<br> s += 'Xd=\'3 4\'\n'; // Denominator<br> setVsmClipboardData(s);<br> }
0