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;
//Get the value mapped to
the PIDName key from the hashtable
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.GetObjectByPersistReference((PID));
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;
//Replace the PID strings below with strings
generated by pidcollector.exe
//Pie face
selection1 =
"68,20,0,0,3,0,0,0,255,254,255,0,0,0,0,0,255,255,1,0,11,0,109,111,70,97,99,101,82,101,102,95,99,1,0,0,0,0,0,0,0,5,0,0,0,4,2,0,0,0,0,0,0,125,195,148,37,173,73,178,84,125,195,148,37,173,73,178,84,0,0,255,255,1,0,23,0,109,111,70,114,111,109,83,107,116,69,110,116,83,117,114,102,73,100,82,101,112,95,99,0,0,255,255,1,0,6,0,109,111,70,82,95,99,255,255,1,0,13,0,109,111,69,120,116,79,98,106,101,99,116,95,99,255,255,1,0,17,0,109,111,67,83,116,114,105,110,103,72,97,110,100,108,101,95,99,255,254,255,92,75,0,58,0,92,0,97,0,112,0,105,0,92,0,72,0,69,0,76,0,80,0,92,0,83,0,97,0,109,0,112,0,108,0,101,0,32,0,77,0,97,0,99,0,114,0,111,0,115,0,92,0,83,0,105,0,109,0,117,0,108,0,97,0,116,0,105,0,111,0,110,0,92,0,50,0,48,0,49,0,50,0,92,0,65,0,117,0,116,0,111,0,84,0,101,0,115,0,116,0,70,0,105,0,108,0,101,0,115,0,92,0,68,0,121,0,110,0,97,0,109,0,105,0,99,0,115,0,92,0,77,0,97,0,99,0,114,0,111,0,115,0,92,0,76,0,105,0,110,0,101,0,97,0,114,0,68,0,121,0,110,0,97,0,109,0,105,0,99,0,46,0,83,0,76,0,68,0,80";
selection1 = selection1 +
",0,82,0,84,0,9,128,255,254,255,13,76,0,105,0,110,0,101,0,97,0,114,0,68,0,121,0,110,0,97,0,109,0,105,0,99,0,2,0,0,141,213,96,79,0,0,112,0,97,0,0,0,0,0,0,0,0,0,0,0,0,0,255,254,255,7,68,0,101,0,102,0,97,0,117,0,108,0,116,0,0,0,0,0,0,0,0,0,100,0,100,0,30,0,0,0,252,214,96,79,1,0,0,0,255,255,1,0,16,0,109,111,84,111,112,69,100,103,101,73,100,82,101,112,95,99,0,0,5,128,8,0,30,0,0,0,252,214,96,79,1,0,0,0,255,255,1,0,19,0,109,111,66,111,116,116,111,109,69,100,103,101,73,100,82,101,112,95,99,0,0,5,128,8,0,30,0,0,0,252,214,96,79,1,0,0,0,255,255,1,0,16,0,109,111,69,110,100,69,100,103,101,73,100,82,101,112,95,99,0,0,5,128,8,0,30,0,0,0,252,214,96,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0";
selection1 = selection1 + ",Type=1";
//Pie curve Edge-1
selection2 =
"68,20,0,0,3,0,0,0,255,254,255,0,0,0,0,0,255,255,1,0,11,0,109,111,69,100,103,101,82,101,102,95,99,1,0,0,0,0,0,0,0,5,0,0,0,4,3,0,0,0,0,0,0,125,195,148,37,173,73,178,84,125,195,148,37,173,73,178,84,0,0,255,255,1,0,23,0,109,111,70,114,111,109,83,107,116,69,110,116,83,117,114,102,73,100,82,101,112,95,99,0,0,255,255,1,0,6,0,109,111,70,82,95,99,255,255,1,0,13,0,109,111,69,120,116,79,98,106,101,99,116,95,99,255,255,1,0,17,0,109,111,67,83,116,114,105,110,103,72,97,110,100,108,101,95,99,255,254,255,92,75,0,58,0,92,0,97,0,112,0,105,0,92,0,72,0,69,0,76,0,80,0,92,0,83,0,97,0,109,0,112,0,108,0,101,0,32,0,77,0,97,0,99,0,114,0,111,0,115,0,92,0,83,0,105,0,109,0,117,0,108,0,97,0,116,0,105,0,111,0,110,0,92,0,50,0,48,0,49,0,50,0,92,0,65,0,117,0,116,0,111,0,84,0,101,0,115,0,116,0,70,0,105,0,108,0,101,0,115,0,92,0,68,0,121,0,110,0,97,0,109,0,105,0,99,0,115,0,92,0,77,0,97,0,99,0,114,0,111,0,115,0,92,0,76,0,105,0,110,0,101,0,97,0,114,0,68,0,121,0,110,0,97,0,109,0,105,0,99,0,46,0,83,0,76,0,68,0,";
selection2 = selection2 +
"80,0,82,0,84,0,9,128,255,254,255,13,76,0,105,0,110,0,101,0,97,0,114,0,68,0,121,0,110,0,97,0,109,0,105,0,99,0,2,0,0,141,213,96,79,0,0,112,0,97,0,0,0,0,0,0,0,0,0,0,0,0,0,255,254,255,7,68,0,101,0,102,0,97,0,117,0,108,0,116,0,0,0,0,0,0,0,0,0,100,0,100,0,30,0,0,0,252,214,96,79,1,0,0,0,0,0,255,255,1,0,19,0,109,111,66,111,116,116,111,109,69,100,103,101,73,100,82,101,112,95,99,0,0,5,128,8,0,30,0,0,0,252,214,96,79,1,0,0,0,255,255,1,0,16,0,109,111,84,111,112,69,100,103,101,73,100,82,101,112,95,99,0,0,5,128,8,0,30,0,0,0,252,214,96,79,1,0,0,0,255,255,1,0,16,0,109,111,69,110,100,69,100,103,101,73,100,82,101,112,95,99,0,0,5,128,8,0,30,0,0,0,252,214,96,79,0,0,0,0,0,0,0,0";
selection2 = selection2 + ",Type=1";
//Pie edge
selection3 =
"68,20,0,0,3,0,0,0,255,254,255,0,0,0,0,0,255,255,1,0,11,0,109,111,69,100,103,101,82,101,102,95,99,1,0,0,0,0,0,0,0,5,0,0,0,6,3,0,0,0,0,0,0,125,195,148,37,173,73,178,84,125,195,148,37,173,73,178,84,0,0,255,255,1,0,23,0,109,111,70,114,111,109,83,107,116,69,110,116,83,117,114,102,73,100,82,101,112,95,99,0,0,255,255,1,0,6,0,109,111,70,82,95,99,255,255,1,0,13,0,109,111,69,120,116,79,98,106,101,99,116,95,99,255,255,1,0,17,0,109,111,67,83,116,114,105,110,103,72,97,110,100,108,101,95,99,255,254,255,92,75,0,58,0,92,0,97,0,112,0,105,0,92,0,72,0,69,0,76,0,80,0,92,0,83,0,97,0,109,0,112,0,108,0,101,0,32,0,77,0,97,0,99,0,114,0,111,0,115,0,92,0,83,0,105,0,109,0,117,0,108,0,97,0,116,0,105,0,111,0,110,0,92,0,50,0,48,0,49,0,50,0,92,0,65,0,117,0,116,0,111,0,84,0,101,0,115,0,116,0,70,0,105,0,108,0,101,0,115,0,92,0,68,0,121,0,110,0,97,0,109,0,105,0,99,0,115,0,92,0,77,0,97,0,99,0,114,0,111,0,115,0,92,0,76,0,105,0,110,0,101,0,97,0,114,0,68,0,121,0,110,0,97,0,109,0,105,0,99,0,46,0,83,0,76,0,68,0,";
selection3 = selection3 +
"80,0,82,0,84,0,9,128,255,254,255,13,76,0,105,0,110,0,101,0,97,0,114,0,68,0,121,0,110,0,97,0,109,0,105,0,99,0,2,0,0,141,213,96,79,0,0,112,0,97,0,0,0,0,0,0,0,0,0,0,0,0,0,255,254,255,7,68,0,101,0,102,0,97,0,117,0,108,0,116,0,0,0,0,0,0,0,0,0,100,0,100,0,30,0,0,0,252,214,96,79,1,0,0,0,0,0,255,255,1,0,16,0,109,111,69,110,100,69,100,103,101,73,100,82,101,112,95,99,0,0,5,128,8,0,30,0,0,0,252,214,96,79,0,0,0,0,255,255,1,0,19,0,109,111,66,111,116,116,111,109,69,100,103,101,73,100,82,101,112,95,99,0,0,5,128,8,0,30,0,0,0,252,214,96,79,1,0,0,0,255,255,1,0,16,0,109,111,84,111,112,69,100,103,101,73,100,82,101,112,95,99,0,0,5,128,8,0,30,0,0,0,252,214,96,79,1,0,0,0,0,0,0,0";
selection3 = selection3 + ",Type=1";
//Pie edge
selection4 = "68,20,0,0,3,0,0,0,255,254,255,0,0,0,0,0,255,255,1,0,11,0,109,111,69,100,103,101,82,101,102,95,99,1,0,0,0,0,0,0,0,5,0,0,0,4,3,0,0,0,0,0,0,125,195,148,37,173,73,178,84,125,195,148,37,173,73,178,84,0,0,255,255,1,0,23,0,109,111,70,114,111,109,83,107,116,69,110,116,83,117,114,102,73,100,82,101,112,95,99,0,0,255,255,1,0,6,0,109,111,70,82,95,99,255,255,1,0,13,0,109,111,69,120,116,79,98,106,101,99,116,95,99,255,255,1,0,17,0,109,111,67,83,116,114,105,110,103,72,97,110,100,108,101,95,99,255,254,255,92,75,0,58,0,92,0,97,0,112,0,105,0,92,0,72,0,69,0,76,0,80,0,92,0,83,0,97,0,109,0,112,0,108,0,101,0,32,0,77,0,97,0,99,0,114,0,111,0,115,0,92,0,83,0,105,0,109,0,117,0,108,0,97,0,116,0,105,0,111,0,110,0,92,0,50,0,48,0,49,0,50,0,92,0,65,0,117,0,116,0,111,0,84,0,101,0,115,0,116,0,70,0,105,0,108,0,101,0,115,0,92,0,68,0,121,0,110,0,97,0,109,0,105,0,99,0,115,0,92,0,77,0,97,0,99,0,114,0,111,0,115,0,92,0,76,0,105,0,110,0,101,0,97,0,114,0,68,0,121,0,110,0,97,0,109,0,105,0,99,0,46,0,83,0,76,0,68,0,";
selection4 = selection4 +
"80,0,82,0,84,0,9,128,255,254,255,13,76,0,105,0,110,0,101,0,97,0,114,0,68,0,121,0,110,0,97,0,109,0,105,0,99,0,2,0,0,141,213,96,79,0,0,112,0,97,0,0,0,0,0,0,0,0,0,0,0,0,0,255,254,255,7,68,0,101,0,102,0,97,0,117,0,108,0,116,0,0,0,0,0,0,0,0,0,100,0,100,0,30,0,0,0,252,214,96,79,1,0,0,0,0,0,255,255,1,0,16,0,109,111,84,111,112,69,100,103,101,73,100,82,101,112,95,99,0,0,5,128,8,0,30,0,0,0,252,214,96,79,1,0,0,0,255,255,1,0,16,0,109,111,69,110,100,69,100,103,101,73,100,82,101,112,95,99,0,0,5,128,8,0,30,0,0,0,252,214,96,79,0,0,0,0,255,255,1,0,19,0,109,111,66,111,116,116,111,109,69,100,103,101,73,100,82,101,112,95,99,0,0,5,128,8,0,30,0,0,0,252,214,96,79,1,0,0,0,0,0,0,0";
selection4 = selection4 & ",Type=1";
//Axis1
selection5 =
"68,20,0,0,1,0,0,0,255,254,255,0,0,0,0,0,21,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;
}