You can read more details at: Search Text in DWG Drawing using Java
Last active
January 31, 2023 15:56
-
-
Save aspose-com-gists/b34ade017597205fbc7634b17c7dc1e9 to your computer and use it in GitHub Desktop.
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