I am only using a single catalog which is where I could be going wrong. The catalog has a strong folder naming convention that is something like this PartType->Manufacturer->Model-> Part. By having a folder for the part type I am able to logically group the parts and use the folder name as a filtering mechanism. For instance if I wanted to grab a list of manufacturers from the catalog I have the following method.
public static StringCollection GetManufacturersFromCatalogByPath()
{
StringCollection manufacturers
= new StringCollection
(); IEnumerator partEnumerator = null;
CatalogManager manager
= new CatalogManager
(); DataQuery queryForPartsList
= new DataQuery
{ Domain
= Domain
.MultiViewPartComponent, CatalogId
= manager
.CatalogID(Domain
.MultiViewPartComponent) }; DataPartLookupCollection dataParts = manager.GetPartsList(queryForPartsList).DataParts;
try
{
partEnumerator = dataParts.GetEnumerator();
while (partEnumerator.MoveNext())
{
DataPartLookup current = (DataPartLookup)partEnumerator.Current;
try
{
if (manager.GetRawPartTable(current).BasicTable.Count != 0)
{
string[] partPath
= current
.Path.Split(new char[] { '\\' }); int length = partPath.Length;
string manufacturer = partPath[length - 2];
string partName = partPath[length - 1];
if ((length > 1) && partName.ToUpper().Contains(manufacturer.ToUpper()) && (!manufacturers.Contains(manufacturer)))
{
manufacturers.Add(manufacturer);
}
}
}
catch (Autodesk.AutoCAD.Runtime.Exception exception1)
{
}
}
}
finally
{
if (partEnumerator
is IDisposable
) {
(partEnumerator as IDisposable).Dispose();
}
}
return manufacturers;
}
I guess I need to think about it because I am doing the same thing to get the model and part size information. I have created a dialog where you first select the manufacturer and then select a model number that is filtered by the manufacturer and then you would select a part size which is filtered based on the model number selected. So I needed to get a list of manufacturers and then a list of models for each manufacturer and then a list of part sizes for each model and have that be able to be displayed in three dropdown combo boxes. I didn't want to use a tree structure and chose the previous method instead. What you have works great where you don't need a lot of information to find the part.
Now I am just confused. Not on the how to do it but on the why to do it a certain way.