0

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());

           }
       }  
    }

DWF viewer control in a userform

Object ID message box :

enter image description here

Object name and value :

enter image description here

Thanks in advance

Doicare
  • 361
  • 1
  • 3
  • 15
  • The form screenshot shows that there is only 1 property and your last screenshot shows that property in the message box. Are you saying that you want to get properties that do not seen to be available from the `IAdObject` class? – Mikanikal Apr 29 '16 at 03:48
  • According to this post: http://through-the-interface.typepad.com/through_the_interface/2007/10/au-handouts-enr.html?cid=6a00d83452464869e20120a6236150970b#comment-6a00d83452464869e20120a6236150970b. and http://adndevblog.typepad.com/autocad/2013/06/access-object-properties-and-control-visibility-using-design-review-api.html. I gather that you can only get properties that have been added as Metadata. If that is the only Metadata added to the DWF, then that is all you get. Unless the layer, color, etc... are stored elsewhere. – Mikanikal Apr 29 '16 at 03:58
  • You can open a DWF as a zip file. There should be an XML document that shows you everything that was exported from the original file. – Miiir Apr 29 '16 at 12:11
  • What I want to get is already displayed in the model sidebar menu (Solid (3D) [D1]) – Doicare Apr 29 '16 at 12:21
  • @Miiir, how to access this xml file programmatically. – Doicare Apr 29 '16 at 12:23
  • @Doicare, System.IO.Compression.ZipArchive, use ZipFile.OpenRead. – Miiir Apr 29 '16 at 14:24
  • @Miiir, Ok now I can access the XML data, but how can I link the 3d objects in dwf with the data in the xml ?? – Doicare Apr 30 '16 at 15:20
  • @Doicare, I don't have a DWF file on hand but there must be something to link them, handle or objectid are the usual culprits. – Miiir Apr 30 '16 at 22:03

0 Answers0