Initial Commit of the PDM project (ready for DWS migration)
This commit is contained in:
233
documentation/api_extracted/vbserno.htm
Normal file
233
documentation/api_extracted/vbserno.htm
Normal file
@@ -0,0 +1,233 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Creating Serial Numbers (VB.NET)</title>
|
||||
<meta name=MS-HKWD content="Serial numbers">
|
||||
<meta name=MS-HKWD content="Add-ins,VB.NET">
|
||||
<meta name=MS-HKWD content="VB.NET, add-ins">
|
||||
<meta http-equiv="Content-Language" content="en-us">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
||||
<link rel="stylesheet" type="text/css" href="ApiHelp.css">
|
||||
<style>
|
||||
<!--
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
.auto-style3 {
|
||||
color: #2B91AF;
|
||||
font-size: x-small;
|
||||
}
|
||||
.auto-style1 {
|
||||
font-size: x-small;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1><span style="font-weight: normal; font-size: 7.5pt;">SOLIDWORKS PDM Professional API Help</span></h1>
|
||||
<h1>Creating Serial Numbers (VB.NET)</h1>
|
||||
|
||||
<p class=MsoNormal><span lang=EN-US style='font-family:Verdana'>This
|
||||
sample shows how to generate serial numbers for file data cards using
|
||||
an add-in written in VB.NET. </span></p>
|
||||
<p class="MsoNormal"><font face="Verdana"><b>NOTES:</b> </font></p>
|
||||
<ul>
|
||||
<li>
|
||||
<p class=MsoNormal>
|
||||
<span lang=EN-US style='font-family:Verdana;
|
||||
mso-ansi-language:EN-US'>Because SOLIDWORKS PDM Professional cannot force a reload of
|
||||
add-ins if they are written in .NET, all client machines must be restarted to ensure that the latest version of the add-in is used.<o:p></o:p></span></p>
|
||||
</li>
|
||||
<li>
|
||||
<p class=MsoNormal><span lang=EN-US style='font-family:Verdana'>SOLIDWORKS
|
||||
PDM Professional recommends that serial numbers be generated using the built-in format strings or lists.
|
||||
They provide better performance than serial numbers generated by add-ins
|
||||
or serial numbers from files. Only write an add-in to generate the serial
|
||||
number if built-in format strings or lists are insufficient.</span><font face="Verdana"><span lang=EN-US> </span> </font></p>
|
||||
</li>
|
||||
<li>
|
||||
<p class=MsoNormal><span lang=EN-US style='font-family:Verdana'>The
|
||||
differences between serial number generation and <a href="vbreactor.htm">other types of hooks</a>
|
||||
are:</span></p>
|
||||
<ul>
|
||||
<li>
|
||||
<p class=MsoNormal><span style="font-family: Verdana">H</span><span lang=EN-US style='font-family:Verdana'>ook you register in
|
||||
your
|
||||
<a href="EPDM.Interop.epdm~EPDM.Interop.epdm.IEdmAddIn5~GetAddInInfo.html">IEdmAddIn5::GetAddInInfo</a>
|
||||
method. </span></p></li>
|
||||
<li>
|
||||
<p class=MsoNormal><span style="font-family: Verdana">C</span><span lang=EN-US style='font-family:Verdana'>ontents of your
|
||||
<a href="EPDM.Interop.epdm~EPDM.Interop.epdm.IEdmAddIn5~OnCmd.html">IEdmAddIn5::OnCmd</a> method.</span></p>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ol style="font-family: Verdana; font-size: 8pt">
|
||||
<li>
|
||||
<p class=MsoNormal><span style="font-family: Verdana">Follow </span><span lang=EN-US><font face="Verdana">
|
||||
<a href="vbmenuitem.htm">Creating Menu Commands (VB.NET)</a> to
|
||||
create a basic add-in.</font></span></p>
|
||||
</li>
|
||||
<li>
|
||||
<p class=MsoNormal><span style="font-family: Verdana">Register a hook to
|
||||
notify</span><span lang=EN-US style='font-family:Verdana'>
|
||||
your add-in when a serial
|
||||
number needs to be generated. Implement IEdmAddIn5::GetAddInInfo as follows:</span></p>
|
||||
</li>
|
||||
<blockquote>
|
||||
<p class=MsoNormal>
|
||||
<span lang=EN-US style="font-size:10pt;font-family:Courier New">Public Sub GetAddInInfo(ByRef
|
||||
poInfo As EdmAddInInfo, ByVal poVault As IEdmVault5,
|
||||
ByVal poCmdMgr As IEdmCmdMgr5) Implements IEdmAddIn5.GetAddInInfo<br />
|
||||
<br /> <span style="color: #009900">'Specify add-in information</span><br />
|
||||
poInfo.mbsAddInName = "My serial number generator"<br />
|
||||
poInfo.mbsCompany = "The name of my company"<br />
|
||||
poInfo.mbsDescription = "Implements serial numbers"<br />
|
||||
poInfo.mlAddInVersion = 1<br />
|
||||
poInfo.mlRequiredVersionMajor = 5<br />
|
||||
poInfo.mlRequiredVersionMinor = 2<br /><br />
|
||||
<span style="color: #009900">'Register that a serial number needs to be
|
||||
generated<br />
|
||||
</span> poCmdMgr.AddHook(EdmCmdType.EdmCmd_SerialNo)<br /><br />End Sub
|
||||
</span></p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<p class=MsoNormal style='background:white'>
|
||||
<span style="font-family: Verdana">Implement IEdmAddIn5::OnCmd as follows</span><span lang=EN-US style='font-family:Verdana'>:</span></p></li>
|
||||
|
||||
<blockquote>
|
||||
<p class=MsoNormal style='background:white'>
|
||||
<span lang=EN-US style="font-size:10pt;font-family:Courier New">Public Sub OnCmd(ByRef
|
||||
poCmd As EdmCmd,
|
||||
</span>
|
||||
<span lang=EN-US style="font-family:Courier New">
|
||||
<span style="color:blue;" class="auto-style1">ByRef</span></span><span lang=EN-US style="font-size:10pt;font-family:Courier New"><span lang=EN-US style="font-family:Courier New" class="auto-style1"> ppoData <span style="color:blue;">As</span></span><font size="1"> <span class="auto-style3">EdmCmdData</span><span class="auto-style1">[]</span></font>) Implements IEdmAddIn5.OnCmd<br />
|
||||
<br /> <span style="color: #009900">'Check the upper and lower bounds of the array</span>
|
||||
<br /> Dim index As Long
|
||||
index = LBound(ppoData) <br /> Dim last As Long
|
||||
last = UBound(ppoData) <br /><br /> If index <= last Then
|
||||
<br /> Dim cnt As Integer <br /> cnt = last - index + 1
|
||||
<br /><br /> <span style="color: #009900">'Create a temporary array
|
||||
to which you have full
|
||||
access</span><br /> Dim tmpArr(cnt) As EdmCmdData <br /> tmpArr = ppoData
|
||||
<br /><br /> <span style="color: #009900">'Generate serial numbers for all of the affected
|
||||
files</span> <br /> Dim CounterVal As String <br /><br /> While index <= last
|
||||
<br /> CounterVal = tmpArr(index).mlLongData1 <br /> Dim s As String
|
||||
<br /> s = "My serno(" + CounterVal +
|
||||
")" <br /> tmpArr(index).mbsStrData1 = s <br /> index = index + 1
|
||||
<br /> End While
|
||||
<br /><br /> <span style="color: #009900">'Return the updated data</span>
|
||||
<br /> ppoData = tmpArr <br /> End If
|
||||
<br /><br />End Sub<br>
|
||||
<br>
|
||||
</span>
|
||||
<span lang=EN-US style='font-family:Verdana'>The second argument to
|
||||
OnCmd
|
||||
is an array of <a href="EPDM.Interop.epdm~EPDM.Interop.epdm.EdmCmdData.html">EdmCmdData</a> structures. There is
|
||||
one element in the array for each file that is affected by the call. </span><span lang=EN-US style='font-family:Verdana'>
|
||||
See EdmCmdData for a complete list
|
||||
of members and their descriptions.<o:p></o:p></span></p>
|
||||
</blockquote>
|
||||
|
||||
|
||||
<li>
|
||||
<p class=MsoNormal style='background:white'>
|
||||
<span lang=EN-US style='mso-ansi-language:EN-US'>Click <b>Build > Build
|
||||
Solution</b> to build the add-in.</span></p></li>
|
||||
<li>
|
||||
<span lang="en-us">I</span><span lang=EN-US style='mso-ansi-language:EN-US'>nstall
|
||||
the add-in through the SOLIDWORKS PDM Professional
|
||||
Administration tool: <br> </span><ol style="font-family: Verdana; font-size: 8pt">
|
||||
<li><span lang="en-us">Open</span><span lang=EN-US style='mso-ansi-language:EN-US'> the SOLIDWORKS
|
||||
PDM Professional Administration tool.<br> </span></li>
|
||||
<li><span lang=EN-US style='mso-ansi-language:EN-US'>Expand the vault where
|
||||
you want to install this add-in and log in as Admin.<br> </span></li>
|
||||
<li><span lang="en-us">Right-click <b>Add-ins</b> and click <b>New
|
||||
Add-in</b>.<b><br>
|
||||
</b></span></li>
|
||||
<li>B<span lang="en-us">rowse to </span>
|
||||
<span lang=EN-US style='mso-ansi-language:EN-US'>
|
||||
<i style='mso-bidi-font-style:
|
||||
normal'>project_path</i><span style='mso-bidi-font-style:
|
||||
normal; '><i>\</i></span></span><span style='mso-bidi-font-style:
|
||||
normal; mso-ansi-language:EN-US' lang="EN-US"><i>project_name\project_name</i><b>\bin\Debug</b>,
|
||||
click <i>project_name</i><b>.dll</b> and <b>EPDM.Interop.epdm.dll</b>.<br> </span></li>
|
||||
<li><span lang="en-us">Click <b>Open</b>.<br>
|
||||
</span></li>
|
||||
<li>Click <b>OK</b>.<br>
|
||||
</li>
|
||||
<li>Click <b>OK</b>.</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li>
|
||||
<p class=MsoNormal style='background:white'><font face="Verdana">
|
||||
<span lang=EN-US>Right-click the <strong>Serial Numbers</strong> node in the
|
||||
tree and click </span></font><span style='font-family:Verdana' lang="EN-US">
|
||||
<strong>New Serial
|
||||
Number</strong></span><font face="Verdana"><span lang=EN-US>. </span></font>
|
||||
</p></li>
|
||||
<li>
|
||||
<p class=MsoNormal style='background:white'><font face="Verdana">
|
||||
<span lang=EN-US>Create a new serial number
|
||||
in the <b>Name</b> field and select </span></font>
|
||||
<span lang=EN-US style='font-family:Arial'><strong>
|
||||
<span style='font-family:Verdana'>Serial number from add-in</span></strong></span><font face="Verdana"><span lang=EN-US>
|
||||
in the Type dropdown.<br>
|
||||
<br>
|
||||
<img border="0" src="serno.gif" width="497" height="286"></span></font></p>
|
||||
<p class=MsoNormal style='background:white'><font face="Verdana">
|
||||
<span lang=EN-US>The name of your add-in is displayed in<b> Name of add-in</b>.</span></font></p>
|
||||
<li>
|
||||
<p class=MsoNormal style='background:white'><font face="Verdana">
|
||||
<span lang=EN-US>After ensuring that your add-in is selected, click
|
||||
</span></font><span lang=EN-US style='font-family:Arial'><strong>
|
||||
<span style='font-family:Verdana'>OK.</span></strong></span></p>
|
||||
<p class=MsoNormal style='background:white'><font face="Verdana">
|
||||
<span lang=EN-US>Now you can connect the add-in serial number to controls in
|
||||
your file data cards. </span></font></p>
|
||||
|
||||
<li>
|
||||
<p class=MsoNormal style='background:white'>
|
||||
<span style="background-position: 0 0"><font face="Verdana">Click <b>
|
||||
Cards > File Cards</b>, double-click <b>Text Card</b>,</font></span><font face="Verdana"><span lang=EN-US> and click the </span></font>
|
||||
<span lang=EN-US style='font-family:Arial'><strong>
|
||||
<span style='font-family:Verdana'>Title</span></strong></span><span lang=EN-US><font face="Verdana">
|
||||
control.</font><o:p></o:p></span></p></li>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p class=MsoNormal style='background:white'>
|
||||
<span style="background-position: 0 0"><font face="Verdana">I</font></span><span lang=EN-US><font face="Verdana">n
|
||||
the Default value group box on the Edit-box properties<b> </b>panel, </font></span><span style="background-position: 0 0">
|
||||
<font face="Verdana">click</font></span><span lang=EN-US><font face="Verdana"> <b>Serial number</b> and
|
||||
select the serial number that you created in step 7.</font><o:p></o:p></span></p></li>
|
||||
|
||||
<p class=MsoNormal style='background:white'>
|
||||
<span lang=EN-US style='font-size:
|
||||
10.0pt;font-family:Arial'>
|
||||
<o:p><img border="0" src="defvalserno.gif" width="969" height="797"></o:p></span></p>
|
||||
|
||||
<li>
|
||||
<p class=MsoNormal style='background:white'><font face="Verdana">
|
||||
<span lang=EN-US>Save the card and exit the Card Editor.</span></font></p></li>
|
||||
<li>
|
||||
<p class=MsoNormal style='background:white'>
|
||||
<span style="background-position: 0 0"><font face="Verdana">C</font></span><font face="Verdana"><span lang=EN-US>reate a new text file
|
||||
by right-clicking in a File Explorer vault view and
|
||||
clicking </span></font><span lang=EN-US><strong><font face="Verdana">New</font></strong><span lang=EN-US style='font-family:Arial'><font face="Verdana">
|
||||
<b>> Text Document</b>.
|
||||
<br><br></font></span><span lang=EN-US style='font-family:Arial'><font face="Verdana">
|
||||
The file data card displays a serial number in <b>Title</b> of the newly added
|
||||
file.</font><o:p></o:p></span></span></p></li>
|
||||
</ol>
|
||||
<blockquote>
|
||||
<p class=MsoNormal style='background:white'>
|
||||
<img border="0" src="txtpropserno.gif" width="643" height="286"></p>
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user