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

Can't use function GetBoundingBox from C# application

5 REPLIES 5
Reply
Message 1 of 6
NamelessDN
1732 Views, 5 Replies

Can't use function GetBoundingBox from C# application

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.
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: NamelessDN

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.
Message 3 of 6
NamelessDN
in reply to: NamelessDN

Perfect sample, thanks.
Message 4 of 6
amitnkukanur
in reply to: NamelessDN

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
Message 5 of 6

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
in reply to: NamelessDN

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

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