How do I put VisSim blocks on the clipboard from my application?

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Submitted by Joe on Tue, 09/22/2009 - 10:19 

I want to create a VisSim block and put it on the windows clipboard so that I can paste it into any VisSim diagram. Is there a way to do that?

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

     

    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> }

     

    Unable to find an attachment - read this blog