Skip to content

Block.Boundingbox for text shows incorrect values #849

@SRajapandi7

Description

@SRajapandi7

Hi Dom,

I have inserted a block and tried to find its boundingbox of height and width. it is working fine when it has lines but if it has only text then it shows incorrect values. Can you check this issue.

string TEMPpath = @"D:\Tools Development\ACAD\Text Bounding Box\empty.dwg";
String Docpath = @"D:\Tools Development\ACAD\Text Bounding Box\DIP-SWITCH-SETTING-NOTE.dwg";
string outpath1 = @"D:\Tools Development\ACAD\Text Bounding Box\textboundingbox.dwg";

CadDocument template = DwgReader.Read(TEMPpath, onNotification);
       

var insertpoint = new XYZ(25, 250, 0.0);
var blockInsert = InsertBlock(Docpath, insertpoint);
Insert InsertBlock(string path, XYZ insertpoint)
{
    CadDocument doc = DwgReader.Read(Docpath, onNotification);
    BlockRecord newBlock = new BlockRecord("New block");
    foreach (var ent in doc.Entities)
    {
        var entclone = ent.Clone() as Entity;

        newBlock.Entities.Add(entclone);
    }
    template.BlockRecords.Add(newBlock);
    var base1 = newBlock.BlockEntity.BasePoint;
    var base2 = doc.Header.ModelSpaceInsertionBase;
    newBlock.BlockEntity.BasePoint = base2;
    
    var blockInsert = new ACadSharp.Entities.Insert(newBlock)
    {
        InsertPoint = insertpoint // Set the insertion point
    };
   
    return blockInsert;
}
blockInsert.Block.IsExplodable = true;
template.Entities.Add(blockInsert);

var bbox = blockInsert.GetBoundingBox();
var Height = bbox.Height;
var Width= bbox.Width;
DwgWriter.Write(outpath1, template);

Text Bounding Box.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions