This example shows how to create a linear dynamic study.
//---------------------------------------------------------------
// Preconditions:
// 1. Add the SolidWorks Simulation as an add-in
// (in SolidWorks, click Tools > Add-ins > SolidWorks Simulation).
// 2. Add the SolidWorks Simulation primary interop assembly as
// a reference (in the IDE's Project Explorer, right-click
// the project name, select Add Reference, click the Browse tab,
// navigate to the install_dir\api\redist\CLR2 folder, and
// select SolidWorks.Interop.cosworks.dll).
// 3. Ensure that the specified file to open exists.
// 4. Ensure that the c:\temp folder exists.
//
// Postconditions:
// 1. Opens the specified file.
// 2. Creates a linear dynamic study.
// 3. Runs a harmonic analysis.
// 4. Right-click the Stress1 or Displacement1 plot in the Results folder
// and select Show to plot the results in color in the graphics area.
// 5. Prints the study options and results to the Immediate window.
// 6. Saves the solution step, displacement, velocity,
// and stress result files to c:\temp.
//
// NOTE: Because the model is used elsewhere,
// do not save any changes when closing it.
//--------------------------------------------------------------------
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using SolidWorks.Interop.cosworks;
using System.Runtime.InteropServices;
namespace LinDynStudy_CSharp.csproj
{
partial class SolidWorksMacro
{
public void Main()
{
ModelDoc2 Part = default(ModelDoc2);
CosmosWorks CWorks = default(CosmosWorks);
CwAddincallback COSMOSObject = default(CwAddincallback);
CWModelDoc ActDoc = default(CWModelDoc);
CWStudyManager StudyMngr = default(CWStudyManager);
CWStudy Study = default(CWStudy);
CWShellManager ShellMgr = default(CWShellManager);
CWMaterial ShellMat = default(CWMaterial);
CWLoadsAndRestraintsManager LBCMgr = default(CWLoadsAndRestraintsManager);
CWBaseExcitation CWBaseExcitationU = default(CWBaseExcitation);
CWDistributedMass CWDistribMass = default(CWDistributedMass);
object CWBaseExcitationEntity = null;
object CWDirectionEntity = null;
int errors = 0;
int warnings = 0;
int errCode = 0;
int nStep = 0;
object pDisp5 = null;
object[] DispArray1 = new object[1];
object[] DispArray2 = new object[1];
object[] DispArray3 = new object[1];
object[] DispArray4 = new object[2];
object[] Disp = null;
object[] Stress = null;
object[] Velocity = null;
object[] Acceleration = null;
string sStudyName = null;
CWStudyResultOptions ResultOptions = default(CWStudyResultOptions);
CWDampingOptions DampingOptions = default(CWDampingOptions);
object[] DampingRatios = new object[9];
int i = 0;
//Tolerances and baselines
const double MeshEleSize = 26.5868077635828; //mm
const double MeshTol = 1.32934038817914; //mm
//PID to call
Hashtable PIDCollection = new Hashtable();
PIDCollection = PIDInitializer();
//Open document
Part = swApp.OpenDoc6("c:\\Program Files\\SolidWorks Corp\\SolidWorks\\samples\\tutorial\\api\\lineardynamic.SLDPRT", (int)swDocumentTypes_e.swDocPART, 1, "", ref errors, ref warnings);
if (Part == null)
ErrorMsg(swApp, "Failed to open lineardynamic.SLDPRT.");
//Get the SolidWorks Simulation object
COSMOSObject = (CwAddincallback)swApp.GetAddInObject("SldWorks.Simulation");
if (COSMOSObject == null) ErrorMsg(swApp, "COSMOSObject object not found.");
CWorks = (CosmosWorks)COSMOSObject.CosmosWorks;
if (CWorks == null) ErrorMsg(swApp, "COSMOSWORKS object not found.");
//Get active document
ActDoc = (CWModelDoc)CWorks.ActiveDoc;
if (ActDoc == null) ErrorMsg(swApp, "No active document.");
//Create a dynamic harmonic study
StudyMngr = (CWStudyManager)ActDoc.StudyManager;
if (StudyMngr == null)
ErrorMsg(swApp, "Failed to get StudyManager object.");
sStudyName = "Dynamic_Harmonic";
Study = (CWStudy)StudyMngr.CreateNewStudy3(sStudyName, (int)swsAnalysisStudyType_e.swsAnalysisStudyTypeDynamic, (int)swsDynamicAnalysisSubType_e.swsDynamicAnalysisSubTypeHarmonic, out errCode);
Debug.Print("Linear dynamic study with harmonic analysis");
Debug.Print("");
Debug.Print("Study configuration name is " + Study.ConfigurationName);
Debug.Print("Dynamic analysis subtype as defined in swsAnalysisStudyType_e is " + Study.DynamicAnalysisSubType);
Debug.Print("Dynamic study options...");
CWDynamicStudyOptions DynStudyOptions = default(CWDynamicStudyOptions);
DynStudyOptions = (CWDynamicStudyOptions)Study.DynamicStudyOptions;
int freqOption = 0;
double freqValue = 0;
int bChecked = 0;
DynStudyOptions.GetFrequencyOption(out freqOption, out freqValue);
Debug.Print(" Frequency option (0=number of frequencies, 1=upper bound): " + freqOption);
Debug.Print(" No. of frequencies or upper-bound frequency: " + freqValue);
DynStudyOptions.GetFrequencyShiftOption(out bChecked, out freqValue);
Debug.Print(" Is frequency shift enabled (0=no, 1=yes)? " + bChecked);
Debug.Print(" Frequency shift: " + freqValue);
DynStudyOptions.IncompatibleBondingOption = 0;
DynStudyOptions.UseSoftSpring = 0; //Do not use soft springs to stabilize model
DynStudyOptions.ResultFolderPath = "c:\\temp";
DynStudyOptions.SolverType = 2;
//FFEPlus
Debug.Print(" Harmonic bandwidth: " + DynStudyOptions.HarmonicBandwidth);
Debug.Print(" Harmonic frequency lower limit: " + DynStudyOptions.HarmonicFrequencyLowerLimit);
Debug.Print(" Harmonic frequency upper limit: " + DynStudyOptions.HarmonicFrequencyUpperLimit);
Debug.Print(" Harmonic frequency units (0=rad/sec, 1=Hz): " + DynStudyOptions.HarmonicFrequencyUnits);
Debug.Print(" Harmonic interpolation (0=logarithmic, 1=linear): " + DynStudyOptions.HarmonicInterpolation);
Debug.Print(" Harmonic number of points for each frequency: " + DynStudyOptions.HarmonicNoOfPoints);
Debug.Print("");
//Set study result options
Debug.Print("Study result options...");
ResultOptions = (CWStudyResultOptions)Study.StudyResultOptions;
ResultOptions.SaveResultsForSolutionStepsOption = 1;
//Save solution step results
ResultOptions.SaveDisplacementsAndVelocitiesOption = 1;
//Save displacements and velocities
ResultOptions.SaveStresses = 1;
//Save stresses
//Solution step set #1
errCode = ResultOptions.SetSolutionStepsSetInformation(1, 10, 100, 3);
Debug.Print(" Set solution steps set #1 (10-100, inc=3)? (0=success): " + errCode);
//Solution step set #3
errCode = ResultOptions.SetSolutionStepsSetInformation(3, 100, 1000, 5);
Debug.Print(" Set solution steps set #3 (100-1000, inc=5)? (0=success): " + errCode);
Debug.Print("");
//Set damping options
DampingOptions = (CWDampingOptions)Study.DampingOptions;
DampingOptions.DampingType = 0;
//Modal damping
DampingRatios[0] = 1;
DampingRatios[1] = 5;
DampingRatios[2] = 3.45;
DampingRatios[3] = 6;
DampingRatios[4] = 15;
DampingRatios[5] = 15;
DampingRatios[6] = 16;
DampingRatios[7] = 25;
DampingRatios[8] = 34.5;
errCode = DampingOptions.SetDampingRatios(3, (DampingRatios));
DampingOptions.ComputeFromMaterialDamping = 0; //Do not use the material damping ratio
//Create VARIANT arrays
DispArray1[0] = SelectByPID(Part, "selection1", PIDCollection);
DispArray2[0] = SelectByPID(Part, "selection1", PIDCollection);
DispArray3[0] = SelectByPID(Part, "selection2", PIDCollection);
DispArray4[0] = SelectByPID(Part, "selection3", PIDCollection);
DispArray4[1] = SelectByPID(Part, "selection4", PIDCollection);
//Get Edge-1 by persistent ID
CWBaseExcitationEntity = SelectByPID(Part, "selection3", PIDCollection);
//Get Axis1 by persistent ID
CWDirectionEntity = SelectByPID(Part, "selection5", PIDCollection);
pDisp5 = SelectByPID(Part, "selection5", PIDCollection);
//Add materials
ShellMgr = (CWShellManager)Study.ShellManager;
if (ShellMgr == null)
ErrorMsg(swApp, "Failed to get ShellMgr object.");
CWShell CWFeatObj1 = default(CWShell);
CWFeatObj1 = (CWShell)ShellMgr.GetShellAt(0, out errCode);
if (errCode != 0)
ErrorMsg(swApp, "Failed to get shell component.");
ShellMat = CWFeatObj1.GetDefaultMaterial();
ShellMat.MaterialUnits = 0;
ShellMat.SetPropertyByName("EX", 2000000000000.0, 0);
ShellMat.SetPropertyByName("NUXY", 0.25, 0);
errCode = CWFeatObj1.SetShellMaterial(ShellMat);
if (errCode != 0)
ErrorMsg(swApp, "Failed to apply material.");
CWFeatObj1.ShellBeginEdit();
CWFeatObj1.Formulation = 1; //Thick shell
CWFeatObj1.ShellUnit = 1; //Centimeters
CWFeatObj1.ShellThickness = 5; //cm
CWFeatObj1.ShellOffsetOption = 3; //Specify reference surface
CWFeatObj1.ShellOffsetValue = 0.3;
errCode = CWFeatObj1.ShellEndEdit();
if (errCode != 0)
ErrorMsg(swApp, "Failed to create shell.");
CWFeatObj1 = null;
//Get loads and restraints manager
LBCMgr = (CWLoadsAndRestraintsManager)Study.LoadsAndRestraintsManager;
if (LBCMgr == null)
ErrorMsg(swApp, "Failed to get LoadsAndRestraintsManager.");
//Create normal pressure
CWPressure CWFeatObj2 = default(CWPressure);
CWFeatObj2 = (CWPressure)LBCMgr.AddPressure(0, (DispArray2), null, out errCode);
if (errCode != 0)
ErrorMsg(swApp, "Failed to create normal pressure.");
Debug.Print("Normal pressure values...");
CWFeatObj2.PressureBeginEdit();
Debug.Print(" Pressure unit in swsStrengthUnit_e units: " + CWFeatObj2.Unit);
Debug.Print(" Pressure value: " + CWFeatObj2.Value);
Debug.Print(" Pressure phase angle (-1 if not set): " + CWFeatObj2.PhaseAngle);
Debug.Print(" Pressure phase unit in swsPhaseAngleUnit_e units: " + CWFeatObj2.PhaseAngleUnit);
Debug.Print("");
errCode = CWFeatObj2.PressureEndEdit();
if (errCode != 0)
ErrorMsg(swApp, "Failed to apply normal pressure value.");
CWFeatObj2 = null;
//Add Restraints
CWRestraint CWFeatObj3 = default(CWRestraint);
CWFeatObj3 = (CWRestraint)LBCMgr.AddRestraint(0, (DispArray3), pDisp5, out errCode);
if (errCode != 0)
ErrorMsg(swApp, "Failed to create first restraint.");
CWFeatObj3.RestraintBeginEdit();
CWFeatObj3.SetTranslationComponentsValues(0, 0, 1, 0.0, 0.0, 0.0);
CWFeatObj3.SetRotationComponentsValues(0, 0, 0, 0.0, 0.0, 0.0);
CWFeatObj3.Unit = 2;
errCode = CWFeatObj3.RestraintEndEdit();
if (errCode != 0)
ErrorMsg(swApp, "First RestraintEndEdit failed.");
CWFeatObj3 = (CWRestraint)LBCMgr.AddRestraint(0, (DispArray4), pDisp5, out errCode);
if (errCode != 0)
ErrorMsg(swApp, "Failed to create second restraint.");
CWFeatObj3.RestraintBeginEdit();
CWFeatObj3.SetTranslationComponentsValues(0, 1, 0, 0.0, -0.0, 0.0);
CWFeatObj3.SetRotationComponentsValues(1, 0, 1, -0.0, 0.0, -0.0);
CWFeatObj3.Unit = 2;
errCode = CWFeatObj3.RestraintEndEdit();
if (errCode != 0)
ErrorMsg(swApp, "Second RestraintEndEdit failed.");
CWFeatObj3 = null;
//Add uniform base excitation
CWBaseExcitationU = (CWBaseExcitation)LBCMgr.AddUniformBaseExcitation(2, CWBaseExcitationEntity, 1, 1, 2.3, 1, 3.4, 1, 4.5, out errCode);
if (errCode != 0)
ErrorMsg(swApp, "Adding uniform base excitation failed.");
Debug.Print("Uniform base excitation type (0=Disp, 1=Vel, 2=Acc): " + CWBaseExcitationU.BaseExcitationType);
int bdir1 = 0;
int bdir2 = 0;
int bdir3 = 0;
CWBaseExcitationU.GetExcitationDirections(out bdir1, out bdir2, out bdir3);
Debug.Print(" Excitation in...");
Debug.Print(" Direction 1 (1=true)? " + bdir1);
Debug.Print(" Direction 2 (1=true)? " + bdir2);
Debug.Print(" Direction 3 (1=true)? " + bdir3);
double dval1 = 0;
double dval2 = 0;
double dval3 = 0;
CWBaseExcitationU.GetExcitationDirectionValues(out dval1, out dval2, out dval3);
Debug.Print(" Excitation value in swsUnit_e units...");
Debug.Print(" Direction 1: " + dval1);
Debug.Print(" Direction 2: " + dval2);
Debug.Print(" Direction 3: " + dval3);
object[] curveData = null;
curveData = (object[])CWBaseExcitationU.GetTimeOrFrequencyCurve();
//variation with frequency data
Debug.Print(" Acceleration excitation variation with frequency data");
Debug.Print(" (number of points, x1, y1, x2, y2...xn, yn):");
for (i = 0; i <= curveData.GetUpperBound(0); i++)
{
Debug.Print(" * " + curveData[i].ToString());
}
Debug.Print(" Excitation phase angle (-1 if not set): " + CWBaseExcitationU.PhaseAngle);
Debug.Print(" Excitation phase angle unit in swsPhaseAngleUnit_e units: " + CWBaseExcitationU.PhaseAngleUnit);
Debug.Print(" Excitation unit (dependent on excitation type): " + CWBaseExcitationU.Unit);
Debug.Print("");
//Add distributed mass
CWDistribMass = (CWDistributedMass)LBCMgr.AddDistributedMass((DispArray2), 0, 1, ref errCode);
Debug.Print("Total distributed mass: " + CWDistribMass.TotalMass);
Debug.Print(" Unit in swsUnit_e units: " + CWDistribMass.Units);
Debug.Print("");
//Create mesh
CWMesh CWFeatObj4 = default(CWMesh);
CWFeatObj4 = (CWMesh)Study.Mesh;
if (CWFeatObj4 == null)
ErrorMsg(swApp, "Failed to create Mesh object");
CWFeatObj4.MesherType = 0;
CWFeatObj4.Quality = 1;
errCode = Study.CreateMesh(0, MeshEleSize, MeshTol);
if (errCode != 0)
ErrorMsg(swApp, "Failed to create Mesh.");
Debug.Print("Worst Jacobian ratio for the mesh: " + CWFeatObj4.GetWorstJacobianRatio());
Debug.Print("");
//Run analysis
Debug.Print("NOTE: Running analysis. This can take a few minutes.");
Debug.Print("");
errCode = Study.RunAnalysis();
if (errCode != 0)
ErrorMsg(swApp, "Analysis failed with error code " + errCode + " - " + ProcErrCode(errCode));
//Get results
CWResults CWFeatObj5 = default(CWResults);
CWFeatObj5 = (CWResults)Study.Results;
if (CWFeatObj5 == null)
ErrorMsg(swApp, "Failed to get Results object.");
Debug.Print("Study results...");
nStep = CWFeatObj5.GetMaximumAvailableSteps();
Debug.Print(" Maximum available steps: " + nStep);
//Get algebraic minimum/maximum resultant displacements
Disp = (object[])CWFeatObj5.GetMinMaxDisplacement(3, nStep, null, 0, out errCode);
if (errCode != 0)
ErrorMsg(swApp, "Failed to get displacement results.");
Debug.Print(" Min/Max URES Resultant Displacements (Node, Min, Node, Max):");
for (i = 0; i <= Disp.GetUpperBound(0); i++)
{
Debug.Print(" * " + Disp[i].ToString());
}
Debug.Print("");
//Get algebraic minimum/maximum Von Mises stresses
Stress = (object[])CWFeatObj5.GetMinMaxStress(9, 0, nStep, null, 3, out errCode);
if (errCode != 0)
ErrorMsg(swApp, "Failed to get stress results.");
Debug.Print(" Algebraic Min/Max von Mises Stresses (Node, Min, Node, Max):");
for (i = 0; i <= Stress.GetUpperBound(0); i++)
{
Debug.Print(" * " + Stress[i].ToString());
}
Debug.Print("");
//Get algebraic minimum/maximum velocities
Velocity = (object[])CWFeatObj5.GetMinMaxVelocity(0, nStep, CWDirectionEntity, 0, out errCode);
if (errCode != 0)
ErrorMsg(swApp, "Failed to get velocity results.");
Debug.Print(" Algebraic Min/Max Velocities (Node, Min, Node, Max):");
for (i = 0; i <= Velocity.GetUpperBound(0); i++)
{
Debug.Print(" * " + Velocity[i].ToString());
}
Debug.Print("");
//Get algebraic minimum/maximum accelerations
Acceleration = (object[])CWFeatObj5.GetMinMaxAcceleration(0, nStep, CWDirectionEntity, 0, out errCode);
if (errCode != 0)
ErrorMsg(swApp, "Failed to get acceleration results.");
Debug.Print(" Algebraic Min/Max Accelerations (Node, Min, Node, Max):");
for (i = 0; i <= Acceleration.GetUpperBound(0); i++)
{
Debug.Print(" * " + Acceleration[i].ToString());
}
CWFeatObj5 = null;
}
public void ErrorMsg(SldWorks SwApp, string Message)
{
SwApp.SendMsgToUser2(Message, 0, 0);
SwApp.RecordLine("'*** WARNING - General");
SwApp.RecordLine("'*** " + Message);
SwApp.RecordLine("");
}
public object SelectByPID(ModelDoc2 Part, string PIDName, Hashtable PIDCollection)
{
object functionReturnValue = null;
byte[] PID = null;
string[] PIDVariant = null;
string PIDString = null;
int i = 0;
object SelObj = null;
int errCode = 0;
//Get the string from the collection
PIDString = "";
IDictionaryEnumerator enumerator = (IDictionaryEnumerator)PIDCollection.GetEnumerator();
enumerator.Reset();
while (enumerator.MoveNext())
{
if ((string)enumerator.Key == PIDName)
{
PIDString = (string)enumerator.Value;
break;
}
}
//Parse the string into an array
PIDVariant = PIDString.Split(new char[] { ',' });
int sizeArray = PIDVariant.Length;
PID = new byte[sizeArray];
//Change to a byte array
for (i = 0; i < PIDVariant.Length - 1; i++)
{
PID[i] = Convert.ToByte(PIDVariant[i]);
}
//Select the entity
SelObj = Part.Extension.GetObjectByPersistReference3((PID), errCode);
functionReturnValue = SelObj;
SelObj = null;
return functionReturnValue;
}
public Hashtable PIDInitializer()
{
Hashtable PIDCollection = new Hashtable();
string selection1 = null;
string selection2 = null;
string selection3 = null;
string selection4 = null;
string selection5 = null;
//Constants
selection1 = "35,29,213,113,218,129,72,162,168,88,152,178,27,137,239,153,121,2,0,0,110,1,0,0,120,1,133,81,61,79,2,65,16,125,168,168,9,145,248,81,24,59,26,91,11,59,77,40,16,14,37,49,72,238,72,108,72,46,112,183,224,113,95,228,88,252,40,76,248,5,86,254,13,26,123,43,255,132,63,69,27,206,55,92,164,49,134,77,102,103,231,205,123,51,179,187,159,69,96,29,64,58,79,185,211,167,57,20,16,198,245,174,163,76,213,183,157,220,2,6,242,244,27,194,228,122,254,120,61,158,53,222,218,191,62,147,29,138,44,137,67,203,215,70,164,173,73,210,111,184,166,26,217,78,150,222,148,180,105,59,210,97,135,103,227,81,223,244,134,202,209,25,84,36,196,184,238,5,170,38,125,133,182,71,172,106,233,196,139,6,87,221,200,13,20,225,121,186,223,68,140,8,1,60,238,10,93,36,176,97,65,243,164,137,57,140,78,241,242,85,174,20,166,100,251,85,156,163,131,26,53,14,38,8,169,136,200,27,163,68,126,4,151,222,34,166,23,218,8,3,102,58,184,199,144,217,39,90,143,22,208,124,118,241,152,187,163,70,116,82,81,49,246,169,139,49,98,92,165,31,179,190,236,";
selection1 = selection1 + "37,220,210,39,204,74,181,38,153,15,196,234,196,2,118,84,204,116,208,98,157,100,49,137,48,86,223,232,132,115,94,179,107,11,38,218,168,127,151,43,242,21,107,178,45,23,239,187,37,115,245,89,123,194,94,122,153,145,195,17,109,118,246,126,41,26,121,222,93,62,111,59,30,25,238,64,45,127,42,63,221,254,195,59,32,239,34,214,58,14,87,82,165,164,17,185,255,242,100,140,108,253,0,133,117,156,59,0,0,0,0,0,0,0,0";
selection1 = selection1 + ",Type=1";
selection2 = "35,29,213,113,218,129,72,162,168,88,152,178,27,137,239,153,121,2,0,0,109,1,0,0,120,1,141,81,187,78,2,81,16,61,168,168,9,145,248,40,140,29,141,173,133,157,38,20,200,67,73,12,146,93,18,27,146,13,236,94,112,217,23,89,46,62,10,19,190,192,202,223,160,177,183,242,39,252,20,109,88,207,176,96,108,140,22,247,158,157,51,231,204,204,222,121,207,3,171,0,146,89,194,155,152,100,144,67,16,85,157,190,50,84,207,178,51,115,26,200,18,215,86,210,224,241,237,249,112,90,127,105,45,49,181,237,211,86,139,163,192,244,116,53,212,230,56,238,213,29,67,13,45,59,77,175,75,218,176,108,233,176,37,29,238,245,85,119,160,108,157,82,121,82,140,107,174,175,42,210,87,100,59,228,202,166,142,221,176,127,209,9,29,95,145,158,37,187,13,68,8,225,195,229,173,208,65,12,11,38,52,191,52,57,155,209,49,158,62,138,165,220,132,106,175,140,83,180,81,161,199,198,24,1,29,33,117,35,20,168,15,225,16,77,114,122,238,13,209,103,166,141,91,12,152,125,224,233,242,248,60,30,187,184,204,221,208,35,62,169,168,24,123,244,69,24,50,46,";
selection2 = selection2 + "19,71,172,47,119,1,215,196,152,89,169,214,160,242,142,92,141,156,207,142,138,153,54,154,172,19,207,39,17,197,223,127,116,196,57,47,217,181,9,3,45,212,62,139,37,89,198,98,35,233,94,100,139,27,50,87,143,181,199,236,165,23,124,10,7,132,233,201,235,121,234,145,7,222,227,3,159,69,90,71,129,236,251,123,93,217,201,38,126,138,69,186,77,105,43,26,254,75,87,13,157,95,117,203,137,190,0,97,76,156,64,0,0,0,0,0,0,0,0";
selection2 = selection2 + ",Type=1";
selection3 = "35,29,213,113,218,129,72,162,168,88,152,178,27,137,239,153,121,2,0,0,112,1,0,0,120,1,133,81,187,78,2,81,16,61,168,168,9,145,248,40,140,29,141,173,133,157,38,20,200,67,73,12,146,93,18,27,146,13,236,94,112,217,23,89,46,62,10,19,190,192,202,223,160,177,183,242,39,252,20,109,88,207,176,96,108,136,197,189,103,231,204,57,51,179,119,62,243,192,58,128,100,150,240,38,38,25,228,16,68,85,167,175,12,213,179,236,204,156,6,178,196,141,181,52,120,254,120,61,158,214,223,90,75,76,109,135,180,213,226,40,48,61,93,13,181,57,142,123,117,199,80,67,203,78,211,155,146,54,44,91,58,236,72,135,71,125,211,29,40,91,167,84,158,20,227,154,235,171,138,244,21,217,30,185,178,169,99,55,236,95,117,66,199,87,164,103,201,126,3,17,66,248,112,121,43,116,16,195,130,9,205,47,77,206,102,116,138,151,175,98,41,55,161,218,43,227,28,109,84,232,177,49,70,64,71,72,221,8,5,234,67,56,68,147,156,158,123,67,244,153,105,227,30,3,102,159,120,186,60,62,143,199,46,46,115,119,244,136,79,42,42,198,30,125,17,134,140,203,196,17,";
selection3 = selection3 + "235,203,93,192,45,49,102,86,170,53,168,124,32,87,35,231,179,163,98,166,141,38,235,196,243,73,68,241,255,31,157,112,206,107,118,109,194,64,11,181,239,98,73,150,177,216,72,186,23,217,226,150,204,213,99,237,49,123,233,5,159,194,17,97,122,246,126,153,122,228,129,119,249,192,173,104,40,203,254,221,85,118,178,141,191,202,165,174,26,58,43,117,82,95,116,7,172,119,17,105,29,5,43,165,203,129,127,0,55,20,156,64,0,0,0,0,0,0,0,0";
selection3 = selection3 + ",Type=1";
selection4 = "35,29,213,113,218,129,72,162,168,88,152,178,27,137,239,153,121,2,0,0,110,1,0,0,120,1,133,81,187,78,2,81,20,28,52,162,9,145,248,40,140,29,141,173,133,157,38,20,8,172,146,24,36,187,36,54,36,27,216,189,224,178,47,178,92,124,20,38,124,129,149,191,65,99,111,229,79,248,41,218,176,206,97,193,78,45,238,157,61,115,102,230,92,56,31,69,96,29,64,58,79,121,19,211,28,10,8,227,186,59,80,166,234,219,78,110,65,3,27,196,252,90,86,60,189,191,28,205,26,175,237,21,102,182,3,218,140,36,14,45,95,215,35,109,77,146,126,195,53,213,200,118,178,118,94,218,166,237,200,132,109,153,240,160,175,123,67,229,232,140,42,146,98,109,120,129,170,201,92,145,237,146,171,90,58,241,162,193,101,55,114,3,69,122,158,238,53,17,35,66,0,143,183,66,23,9,108,88,208,252,210,228,28,86,39,120,254,44,87,10,83,170,253,42,206,208,65,141,30,7,19,132,116,68,212,141,81,162,62,130,75,180,200,233,133,55,194,128,157,14,238,48,100,247,145,167,199,19,240,248,156,226,177,119,75,143,248,36,81,177,246,233,139,49,98,93,37,142,153,47,119";
selection4 = selection4 + ",9,55,196,132,93,73,107,82,121,79,206,32,23,112,162,98,167,131,22,115,146,197,75,68,241,255,47,58,230,59,175,56,181,5,19,109,24,95,229,138,44,99,185,145,108,47,178,197,77,121,87,159,217,19,206,210,75,62,131,67,194,236,244,237,34,243,200,31,188,35,123,136,92,89,246,207,174,54,166,91,88,41,197,39,186,125,234,206,99,173,227,240,87,169,132,174,34,219,241,232,79,157,196,126,3,73,147,156,66,0,0,0,0,0,0,0,0";
selection4 = selection4 + ",Type=1";
selection5 = "35,29,213,113,218,129,72,162,168,88,152,178,27,137,239,153,20,0,0,0,25,0,0,0,120,1,187,193,199,192,192,200,192,192,240,255,223,127,32,201,192,32,5,196,0,51,74,3,254,0,0,0,0,0,0,0,0";
selection5 = selection5 + ",Type=1";
//Store constants in a collection
PIDCollection.Add("selection1", selection1);
PIDCollection.Add("selection2", selection2);
PIDCollection.Add("selection3", selection3);
PIDCollection.Add("selection4", selection4);
PIDCollection.Add("selection5", selection5);
return PIDCollection;
}
public string ProcErrCode(long errCode)
{
string functionReturnValue = null;
switch (errCode)
{
case 0:
functionReturnValue = "Successful.";
break;
case 1: // TODO: to 21
functionReturnValue = "Incorrect input conditions.";
break;
case 22:
functionReturnValue = "Authorization failed for this analysis type.";
break;
case 23:
functionReturnValue = "Mesh not found.";
break;
case 24:
functionReturnValue = "Analysis failed.";
break;
default:
functionReturnValue = "Unknown error condition.";
break;
}
return functionReturnValue;
}
public SldWorks swApp;
}
}