AnsweredAssumed Answered

Which JAR contains the ICadDrawingDataset?

Question asked by arcgis67 on Feb 13, 2013
Latest reply on Feb 14, 2013 by arcgis67
Hi,
using Java SDK 10.1 I'm trying to load a DWG file. Code snippet from sample below.
My question: Which jar library do I have to load to resolve the types ICadDrawingDataset, CadLayer, ICadDrawingDatasetProxy?
Thank you!
Peter

    /**
     * Adds data to control by using the file path.
     */

    public void addData()
    {
      // Get the last index of file separator
      try
      {
        int index = filePath.lastIndexOf(File.separator);
        // Get the directory path containing file path
        String strWorkspacePath = filePath.substring(0, index);
        String fileName = filePath.substring(index + 1);
        System.out.println(fileName);
        ICadDrawingDataset cadDrawingDataset = getCadDataSet(strWorkspacePath, fileName);
        if (cadDrawingDataset == null)
        {
          return;
        }
        // Create a cad layer using cad dataset and add it to map control.
        CadLayer cadLayer = new CadLayer();
        cadLayer.setCadDrawingDatasetByRef(cadDrawingDataset);
        cadLayer.setName(fileName);
        mapBean.addLayer(cadLayer, 0);
      }
      catch (IOException ex)
      {
        System.out.println("Exception in addData : " + ex);
        ex.printStackTrace();
      }
    }

    /**
     * Function which creates cad data set using cad workspace path and filname.
     */
    public ICadDrawingDataset getCadDataSet(String cadWorkspacePath, String cadFileName)
    {
      try
      {
        // Create a WorkspaceName object
        WorkspaceName workspaceName = new WorkspaceName();
        workspaceName.setPathName(cadWorkspacePath);
        workspaceName.setWorkspaceFactoryProgID("esriDataSourcesFile.CadWorkspaceFactory");

        // Create a CadDrawingName object
        CadDrawingName cadDrawingName = new CadDrawingName();
        cadDrawingName.setName(cadFileName);
        cadDrawingName.setWorkspaceNameByRef(workspaceName);

        // Open the CAD drawing
        ICadDrawingDataset cadDrawingDataset = new ICadDrawingDatasetProxy(cadDrawingName.open());

        return cadDrawingDataset;
      }
      catch (IOException ex)
      {
        System.out.println("Exception in getDataSet : " + ex);
        ex.printStackTrace();
        return null;
      }

    }

Outcomes