eInvalidExtents of BlockReference's GeometricExtents

eInvalidExtents of BlockReference's GeometricExtents

sdphg
Enthusiast Enthusiast
4,552 Views
2 Replies
Message 1 of 3

eInvalidExtents of BlockReference's GeometricExtents

sdphg
Enthusiast
Enthusiast

hello everyone.

Today I met a very strange error about GeometricExtents. When execute code like below the exception "eInvalidExtents" will be throw:

//some code to get block reference from drawing

......

Extents3d blockExt = br.GeometricExtents;

 

But if I changed the code to :

Extents3d blockExt = br.GeometryExtentsBestFit();

the exception gone.I am not really know the differents between the GeometricExtents and GeometryExtentsBestFit,so could anybody tell me why I got the exception when use GeometricExtents. and why it gone when I use GeometryExtentsBestFit.

Thanks.

0 Likes
4,553 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Spoiler
 

Has there ever been an answer to the query?

0 Likes
Message 3 of 3

Norman_Yuan
Mentor
Mentor

if you searched Object ARX SDK documents (not the reference document for managed API, you need to look into cooresponding classes/methodes/properties in the unmanaged C++ reference document).

 

Here is the quote ffrom "arxref.chm" on the method geomExtentsBestFit():

 

<QUOTE>

When working in non-WCS coordinate systems, the extents returned from AcDbBlockReference::geomExtents() can be somewhat larger that the actual geometry because AcDbBlockReference::geomExtents() transforms the contained entities' precomputed extents by the block reference's transformation matrix rather than transforming the entities and computing a new box for the transformed entity set. This results in non-world aligned extent boxes for the entities. This is fast, but will provide an "exaggerated" enclosing extents box.

AcDbBlockReference::geomExtentsBestFit() avoids this problem by getting copies of all the entities in the referenced block table record, applying parentXform to them, and then calculating the extents on the resulting entity set. This is slower than the process used by AcDbBlockReference::geomExtents(), but will result in the tightest fitting AcDbExtents for the enclosed geometry.

This method works recursively for nested block references. When this method is called on the outermost block reference (the normal case for ARX applications), parentXform should be the identity matrix. For calls on nested block references, parentXform should be the cumulative transformation from the outermost block reference down to the block reference that is referencing the block table record that owns the block reference on which this method is being called.

This method uses the AcDbBlockReference::explode() method to get copies of the entities. Since the AcDbBlockReference::explode() does not currently support nonuniform transformations, if the block reference on which this method is called, or any nested block references have nonuniform transformations, then this method cannot succeed and will return Acad::eInvalidInput.

Returns Acad::eOk if successful.

</QUOTE>

 

I think the last paragraph may explain why you get eInvalidInput error: your block is not scaled uniformly, or not explodeable.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes