하이퍼링크 작업
Contents
[
Hide
]DWG에서 하이퍼링크 업데이트
Aspose.CAD for Java를 사용하면 CadBaseEntity.getHyperlink()를 통해 AutoCAD 드로잉에서 하이퍼링크에 액세스할 수 있습니다. 이 컬렉션에서 각각의 하이퍼링크에 하나씩 접근하여 속성을 편집할 수 있습니다.
샘플 코드
다음 샘플 코드는 이미지의 모든 엔티티에 접근하고 해당 하이퍼링크 속성을 Aspose 웹사이트로 변경합니다.
This file contains hidden or 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
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"); | |
} | |
} | |