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