We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.CAD Java Saving DWG

Is it possible to save your edits to a DWG file? I edited the xref attribute of a dwg file but cannot save the edits.

String dataDir = “C:\Users\user\Desktop\”;
String sourceFileName = “Test.dwg”;
String destFileName = “XRef_Test.dwg”;
CadImage image = (CadImage) Image.load(dataDir + sourceFileName);

for (CadBlockEntity blockEntity : image.getBlockEntities().getValues()) {
String currentXRefPath = blockEntity.getXRefPathName();
if (currentXRefPath.contains(File.separator)) {
String currentXRefFileName = currentXRefPath.substring(currentXRefPath.lastIndexOf(File.separator) + 1);
String revisedXRefFileName = “Test_” + currentXRefFileName;
String revisedXRefPath = currentXRefPath.replace(currentXRefFileName, revisedXRefFileName);

image.save(dataDir + destFileName, true);


I have observed your comments. Can you please share source file and sample requirements so that we may further investigate to help you out.