I am using Autodesk design review control in a userform & I want to get the handle code from a 3D solid object, also I want to get some properties for the object like layer name, color, etc..
I tried two code solutions as listed below but still can't get what I need.
private ECompositeViewer.IAdECompositeViewer CompositeViewer;
private ECompositeViewer.IAdSection Section;
private AdCommon.IAdCollection MyObjects, MyObjectProperties;
private AdCommon.IAdUserCollection MyObjectsNamedCollection;
private ECompositeViewer.IAdContent ObjectContent;
private void axCExpressViewerControl1_OnSelectObjectEx(object sender,AxExpressViewerDll.IAdViewerEvents_OnSelectObjectExEvent e)
{
Get_Handle_Code();
}
void Get_Handle_Code()
{
CompositeViewer = (ECompositeViewer.IAdECompositeViewer)axCExpressViewerControl1.ECompositeViewer; Section = (ECompositeViewer.IAdSection)CompositeViewer.Section;
ObjectContent = (ECompositeViewer.IAdContent)Section.Content;
MyObjectsNamedCollection = (AdCommon.IAdUserCollection)ObjectContent.CreateUserCollection();
MyObjects = (AdCommon.IAdCollection)ObjectContent.get_Objects(1); //0 is to return all objects
foreach (ECompositeViewer.IAdObject MyObject in MyObjects)
{
AdCommon.IAdObject2 obj = (AdCommon.IAdObject2)MyObject;
MessageBox.Show("Object ID is " + obj.Id.ToString());
MyObjectProperties = (AdCommon.IAdCollection) MyObject.Properties;
foreach (AdCommon.IAdProperty MyObjectProperty in MyObjectProperties)
{
MessageBox.Show(MyObjectProperty.Name.ToString() + " / " + MyObjectProperty.Value.ToString());
}
}
}
Object ID message box :
Object name and value :
Thanks in advance