تحقق مما إذا كانت الصور المرجعية الخارجية موجودة واستبدال المراجع
Contents
[
Hide
]كيفية تحرير الارتباطات التشعبية على الكائنات
المشكلة: كيفية التحقق مما إذا كانت الصور المرجعية الخارجية موجودة واستبدال المراجع (CADNET-8088).
نصائح: للقيام بذلك، احصل على كيان من النوع CadObjectTypeName.IMAGEDEF من كائنات الرسم واستخدم CadRasterImageDef للتحقق.
مثال:
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
foreach (CadBaseObject baseObject in cadImage.Objects) | |
{ | |
if (baseObject.TypeName == CadObjectTypeName.IMAGEDEF) | |
{ | |
// the relation between CadRasterImageDef (in cadImage.Objects) and CadRasterImage (in cadImage.Entities) is by | |
// cadRasterImageDef.ObjectHandle == cadRasterImage.ImageDefReference | |
CadRasterImageDef rasterImageDef = (CadRasterImageDef)baseObject; | |
// path may be relative or absolute | |
if (!File.Exists(rasterImageDef.FileName)) | |
{ | |
// rasterImageDef.FileName = @"D:\Users\Oleksii\Desktop\c2.jpg"; | |
rasterImageDef.FileName = "13521951017666.jpg"; | |
cadImage.UpdateSize(); | |
} | |
} | |
} |