c1.zip (25.4 KB)
Hello.
How do I get the xclip information set in the block (especially the vertex position is required)?
@qor5457,
Hi.
Please test if this example is useful:
using (CadImage cadImage = (CadImage)Aspose.CAD.Image.Load(fileName))
{
foreach (CadEntityBase ceb in cadImage.Entities)
{
if (ceb.TypeName == CadEntityTypeName.INSERT)
{
CadInsertObject insert = (CadInsertObject)ceb;
System.Console.WriteLine(insert.Name + " " + insert.ObjectHandle);
PrintClipPoints(cadImage, insert);
}
}
}
private static void PrintClipPoints(CadImage cadImage, CadInsertObject cadInsert)
{
CadApplicationCodes appCodes = cadInsert.ApplicationCodesContainer.GetCodes("", "ACAD_XDICTIONARY");
string reference = string.Empty;
foreach (CadCodeValue cadCodeValue in appCodes.CodesList)
{
// this code stores the reference to dictionary with clip points
if (cadCodeValue.Code == 360)
{
reference = cadCodeValue.Value;
break;
}
}
string filterReference = SearchReferenceInObjects(cadImage, reference, CadObjectTypeName.DICTIONARY, "ACAD_FILTER");
string spatialReference = SearchReferenceInObjects(cadImage, filterReference, CadObjectTypeName.DICTIONARY, "SPATIAL");
foreach (CadBaseObject baseObject in cadImage.Objects)
{
if (baseObject.TypeName == CadObjectTypeName.SPATIAL_FILTER && baseObject.ObjectHandle == spatialReference)
{
CadSpatialFilter spatialFilter = (CadSpatialFilter)baseObject;
System.Console.WriteLine("Transformation matrix: ");
for (int i = 0; i < 12; i++)
{
System.Console.WriteLine(spatialFilter.TransformationMatrices[i]);
}
System.Console.WriteLine("Points: ");
foreach (Cad2DPoint clipPoint in spatialFilter.PointDefinitions)
{
System.Console.WriteLine(clipPoint.X + " " + clipPoint.Y);
}
}
}
}
private static string SearchReferenceInObjects(CadImage cadImage, string reference, CadObjectTypeName typeToSearch, string nameToSearch)
{
foreach (CadBaseObject baseObject in cadImage.Objects)
{
if (baseObject.TypeName != typeToSearch)
{
continue;
}
CadDictionary dictionary = (CadDictionary)baseObject;
CadEntityAttribute attr;
string val;
if (dictionary.ObjectHandle == reference && dictionary.TryGetValue(nameToSearch, out attr, out val) && attr == CadEntityAttribute.Cad360)
{
return val;
}
}
return string.Empty;
}
1 Like
fantastic!!!
I really appreciate your help in resolving the problem.
1 Like