.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ordinate dimension extents

4 REPLIES 4
Reply
Message 1 of 5
matus.brlit
410 Views, 4 Replies

Ordinate dimension extents

I am drawing ordinate dimensions in blocks and then I am getting the geometric extents of these blocks, if the block contains the dimension, the extents are much larger than expected. What may be the cause?

 

See the attached drawing, the lines are  connecting geometric extents MinPoint and MaxPoint. For the blocks that don't have dimension in them, the extents are correct.

 

4 REPLIES 4
Message 2 of 5
Balaji_Ram
in reply to: matus.brlit

Hi,

 

Sorry for the delay.

 

In your sample drawing, I could not find the block with the ordinate dimension in it.

Can you please share a sample drawing for me to reproduce the behavior. 

 

I tried this with a simple block which included a ordinate dimension that I created, but the extents were right. I have attached the sample drawing that I used.

 

In general, the Geometric extents of a block reference may be larger than the actual extents as explained in the documentation. I have attached a sample code from a Devnote that explains a way to compute the right extents for a block reference. 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 3 of 5
matus.brlit
in reply to: Balaji_Ram

Thanks for the reply,

the blocks are exploded after the calculation of extents. So I changed the code to retain the blocks and here is the drawing with blocks.

Message 4 of 5
Balaji_Ram
in reply to: matus.brlit

Hi,

 

I have attached a screenshot of the extent points that the following code snippet creates for the drawing. The extents seem right.

 

[CommandMethod("TTG")]
public void TTG()
{
    Document doc = Application.DocumentManager.MdiActiveDocument;
    Database db = doc.Database;
    Editor ed = doc.Editor;

    PromptEntityOptions peo = new PromptEntityOptions("\nSelect a block reference: ");
    peo.SetRejectMessage("\nMust be a block reference...");
    peo.AddAllowedClass(typeof(BlockReference), true);

    PromptEntityResult per = ed.GetEntity(peo);

    if (per.Status != PromptStatus.OK)
        return;

    using (Transaction tr = db.TransactionManager.StartTransaction())
    {
        BlockReference bref = tr.GetObject(per.ObjectId, OpenMode.ForWrite) as BlockReference;
        BlockTableRecord btr = tr.GetObject(bref.BlockTableRecord, OpenMode.ForWrite) as BlockTableRecord;

        Extents3d exts = bref.GeometricExtents;

        BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
        BlockTableRecord model = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;

        DBPoint minPt = new DBPoint(exts.MinPoint);
        minPt.ColorIndex = 2;
        model.AppendEntity(minPt);
        tr.AddNewlyCreatedDBObject(minPt, true);

        DBPoint maxPt = new DBPoint(exts.MaxPoint);
        maxPt.ColorIndex = 2;
        model.AppendEntity(maxPt);
        tr.AddNewlyCreatedDBObject(maxPt, true);

        tr.Commit();
    }
}

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 5 of 5
matus.brlit
in reply to: Balaji_Ram

That's interresting, I will try to isolate the code I use for getting the extents and then post it tomorrow.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost