Lavorare con i collegamenti ipertestuali
Aggiornare il Collegamento Ipertestuale in un DWG
Aspose.CAD per .NET ti consente di accedere al collegamento ipertestuale in un disegno AutoCAD utilizzando il CadBaseEntity.Hyperlink. Puoi accedere a ciascun collegamento ipertestuale da questa collezione uno alla volta e modificare le sue proprietà.
Codice di Esempio
Il seguente codice di esempio accede a tutte le entità dell’immagine e modifica la loro proprietà Hyperlink al sito web di Aspose.
// The path to the documents directory. | |
string MyDir = RunExamples.GetDataDir_DWGDrawings(); | |
string dwgPathToFile = MyDir + "AutoCad_Sample.dwg"; | |
using (CadImage cadImage = (CadImage)Image.Load(dwgPathToFile)) | |
{ | |
foreach (CadBaseEntity entity in cadImage.Entities) | |
{ | |
if (entity is CadInsertObject) | |
{ | |
CadBlockEntity block = cadImage.BlockEntities[((CadInsertObject)entity).Name]; | |
if (!string.IsNullOrEmpty(block.XRefPathName.Value)) | |
{ | |
block.XRefPathName.Value = "new file reference.dwg"; | |
} | |
} | |
if (entity.Hyperlink == "https://products.aspose.com") | |
{ | |
entity.Hyperlink = "https://www.aspose.com"; | |
} | |
} | |
} | |