AnsweredAssumed Answered

How to iterate through component via .NET(such as C#, in DxD or XDx)

Question asked by alcohol on Apr 5, 2016
Latest reply on Apr 5, 2016 by Patrick.Cashman

Hi Guys,

 

     I'm trying to iterate through component via .NET, but it does not work.

     By using "COM Interop" , I got file named "Interop.ViewDraw.dll" .

     But the code segment below could not work at all:

 

 

     ViewDraw.Application DxAppHandle = (ViewDraw.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("ViewDraw.Application");

 

     ViewDraw.IVdSchematicSheetDocuments tempSSDDxAppHandle.SchematicSheetDocuments();   // tempSSD has counter, but CANNOT iterate through

     ViewDraw.IVdObjs DesignObjects = DxAppHandle.Query(ViewDraw.VdObjectTypeMask.VDM_COMP, ViewDraw.VdAllOrSelected.VD_ALL);   // CANNOT again

 

     This problem has troubled me a few weeks, how can I fix it?

 

      Any hints are welcome!

Outcomes