การทำงานกับไฮเปอร์ลิงก์
Contents
[
Hide
]อัปเดตไฮเปอร์ลิงก์ใน DWG
Aspose.CAD สำหรับ .NET ช่วยให้คุณเข้าถึงไฮเปอร์ลิงก์ในแบบร่าง AutoCAD โดยใช้ CadBaseEntity.Hyperlink คุณสามารถเข้าถึงไฮเปอร์ลิงก์แต่ละอันจากคอลเลกชันนี้ทีละรายการและแก้ไขคุณสมบัติของมัน
ตัวอย่างโค้ด
โค้ดตัวอย่างต่อไปนี้เข้าถึง entity ทั้งหมดของภาพและเปลี่ยนคุณสมบัติ Hyperlink เป็นเว็บไซต์ 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"; | |
} | |
} | |
} | |