We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get entities and their locations inside specific layout

Hello, want to get the entities and their locations inside a specific layout, I’m able to achieve this when working with “Model”, but the same can not be accomplished when we try with another layout.

Any snippet for this?
[here is how I’m getting the positions from Model]

foreach (var entity in dxfFile.Entities)
       if (entity.TypeName != CadEntityTypeName.DIMENSION) continue;
       var dimension = (CadDimensionBase) entity;   
        var MyPositionClass = new MyPositionClass
           VariableId = variable.Id,
           X = dimension.MiddleTextLocation.X,
           Y = dimension.MiddleTextLocation.Y

Hello, this snippet prints the layout name and entity on it.

Dictionary<string, string> layoutBlockHandles = new Dictionary<string, string>();
foreach (CadLayout layout in cadImage.Layouts.Values)
    if (layout.BlockTableRecordHandle != null)
        layoutBlockHandles.Add(layout.BlockTableRecordHandle, layout.LayoutName);

foreach (CadBaseEntity entity in cadImage.Entities)
    if (layoutBlockHandles.ContainsKey(entity.SoftOwner))
        string layoutName = layoutBlockHandles[entity.SoftOwner];
        System.Console.WriteLine("Layout: " + layoutName + " entity: " + entity.TypeName + " handle:" + entity.ObjectHandle);