Lavorare con i Collegamenti Ipertestuali
Aggiornare il Collegamento Ipertestuale in un DWG
Aspose.CAD per Java ti consente di accedere al collegamento ipertestuale in un disegno AutoCAD utilizzando il CadBaseEntity.getHyperlink(). Puoi accedere a ciascun collegamento ipertestuale da questa collezione uno per uno e modificare le sue proprietà.
Codice di Esempio
Il seguente codice di esempio accede a tutte le entità dell’immagine e cambia la loro proprietà Hyperlink al sito web di Aspose.
String dataDir = Utils.getDataDir(EditHyperlink.class) + "DWGDrawings/"; | |
CadImage cadImage = (CadImage)Image.load(dataDir + "AutoCad_Sample.dwg"); | |
for (CadBaseEntity entity : cadImage.getEntities()) | |
{ | |
if (entity instanceof CadInsertObject) | |
{ | |
CadBlockEntity block = cadImage.getBlockEntities().get_Item(((CadInsertObject)entity).getName()); | |
String value = block.getXRefPathName().getValue(); | |
if (value != null && !value.contentEquals("")) | |
{ | |
block.getXRefPathName().setValue("new file reference.dwg"); | |
} | |
} | |
if (entity.getHyperlink() == "https://products.aspose.com") | |
{ | |
entity.setHyperlink("https://www.aspose.com"); | |
} | |
} | |