Làm việc với Siêu liên kết
Contents
[
Hide
]Cập nhật Siêu liên kết trong một DWG
Aspose.CAD cho .NET cho phép bạn truy cập siêu liên kết trong một bản vẽ AutoCAD bằng cách sử dụng CadBaseEntity.Hyperlink. Bạn có thể truy cập từng siêu liên kết từ bộ sưu tập này một cách lần lượt và chỉnh sửa các thuộc tính của nó.
Mẫu mã
Mẫu mã sau truy cập tất cả các thực thể của hình ảnh và thay đổi thuộc tính Hyperlink thành trang web Aspose.
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
// 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"; | |
} | |
} | |
} | |