Can't use function GetBoundingBox from C# application

Can't use function GetBoundingBox from C# application

Anonymous
Not applicable
1,953 Views
5 Replies
Message 1 of 6

Can't use function GetBoundingBox from C# application

Anonymous
Not applicable
Hi.
I work with Autocad from C# application using late binding.
After inserting block, i want to get its bounds.

double[] aMinPoint = new double[3], aMaxPoint = new double[3];
Params = new object[] { aMinPoint, aMaxPoint };
oBlock.GetType().InvokeMember("GetBoundingBox", BindingFlags.InvokeMethod, null, oBlock, Params);

But after execution this code aMaxPoint and aMinPoint had their default values - 0.

What do I do wrong?

By the way the same task in VB.NET (with built-in late binding) solves good.

Dim aMinPoint() As Double
Dim aMaxPoint() As Double

oBlock.GetBoundingBox(aMinPoint, aMaxPoint)

Thanks for help.
0 Likes
1,954 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
See the sample code here:

http://www.caddzone.com/LateBoundComSample.cs


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6326932@discussion.autodesk.com...
Hi.
I work with Autocad from C# application using late binding.
After inserting block, i want to get its bounds.

double[] aMinPoint = new double[3], aMaxPoint = new double[3];
Params = new object[] { aMinPoint, aMaxPoint };
oBlock.GetType().InvokeMember("GetBoundingBox", BindingFlags.InvokeMethod, null,
oBlock, Params);

But after execution this code aMaxPoint and aMinPoint had their default values -
0.

What do I do wrong?

By the way the same task in VB.NET (with built-in late binding) solves good.

Dim aMinPoint() As Double
Dim aMaxPoint() As Double

oBlock.GetBoundingBox(aMinPoint, aMaxPoint)

Thanks for help.
0 Likes
Message 3 of 6

Anonymous
Not applicable
Perfect sample, thanks.
0 Likes
Message 4 of 6

amitnkukanur
Collaborator
Collaborator

Can you share a copy of part of code because am unable to find data in the link. Am also using the same concept of GetBoundingBox to Get the location of Texts.

Senior Software Engineer
0 Likes
Message 5 of 6

Virupaksha_aithal
Autodesk Support
Autodesk Support

Hi

 

refer blog post http://adndevblog.typepad.com/autocad/2012/07/using-activex-api-getboundingbox-in-net.html. The post shows the use of GetBoundingBox in c#  application



Virupaksha Aithal KM
Developer Technical Services
Autodesk Developer Network

Message 6 of 6

amitnkukanur
Collaborator
Collaborator

Hello Virupaksha.aithal, i resolved this issue quite some time ago, but stuck up in a new location. Call rejected by callee.

I have already posted a issue in the forum and side by side i am also trying to execute this, but my code gets stuck at Call rejected by callee.

 

Then if i press F5 it works as expected

 

http://forums.autodesk.com/t5/NET/Call-Rejected-by-Callee/td-p/3558826

This is the link for it

 

 

With Warm Regards

Amit

Senior Software Engineer
0 Likes