Search Text in DWG File using Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the input DWG file with CadImage class | |
CadImage dgnImage = (CadImage) Image.load("search.dwg"); | |
// Search for text in the file | |
for (CadBaseEntity entity : dgnImage.getEntities()) | |
{ | |
// We iterate through CadText entities here, but some other entities | |
// may contain text also, e.g. CadMText and others | |
if (entity.getClass() == com.aspose.cad.fileformats.cad.cadobjects.CadText.class) | |
{ | |
com.aspose.cad.fileformats.cad.cadobjects.CadText text = | |
(com.aspose.cad.fileformats.cad.cadobjects.CadText)entity; | |
System.out.println(text.getDefaultValue()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment