하이퍼링크 작업
Contents
[
Hide
]DWG에서 하이퍼링크 업데이트
Aspose.CAD for .NET은 AutoCAD 도면에서 CadBaseEntity.Hyperlink 하이퍼링크에 접근할 수 있습니다. 이 컬렉션에서 각 하이퍼링크에 하나씩 접근하여 그 속성을 편집할 수 있습니다.
샘플 코드
다음 샘플 코드는 이미지의 모든 엔터티에 접근하고 그들의 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"; | |
} | |
} | |
} | |