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

How to use AddRegion?

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
645 Views, 4 Replies

How to use AddRegion?

Hi,

I'm trying to create a region that is a circle, and then I want to access to that region to get area, perimeter, etc. Of course with a circle is easy to get the area and perimeter, but this is just a test of creating regions to be able to make different shapes in the future and get area/perimeter. This is the code:

using AutoCAD=Autodesk.AutoCAD.Interop;
using AutoDesk=Autodesk.AutoCAD.Interop.Common;
......
AutoDesk.AcadCircle circleObj;
double[] centerPoint = new double[3];

centerPoint[0] = 100.0;
centerPoint[1] = 100.0;
centerPoint[2] = 0.0;
circleObj = gbl_doc.ModelSpace.AddCircle(centerPoint, 50);

Object[] ol = new Object[1];
ol[0] = (AutoDesk.AcadEntity)circleObj;
Object[] regions = (Object[])gbl_doc.ModelSpace.AddRegion(objectlist);

I get an error "Matriz de objeto no valida" (spanish) that means something like "object array invalid".
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

Questions related to using the ActiveX API usually get more attention in the VBA/ActiveX newsgroup, regardless of the langauge used.

My guess is that your array must be typed as AcadEntity[] rather than Object[]

--
http://www.caddzone.com

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

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

wrote in message news:5982610@discussion.autodesk.com...
Hi,

I'm trying to create a region that is a circle, and then I want to access to that region to get area, perimeter, etc. Of course with a circle is easy to get the area and perimeter, but this is just a test of creating regions to be able to make different shapes in the future and get area/perimeter. This is the code:

using AutoCAD=Autodesk.AutoCAD.Interop;
using AutoDesk=Autodesk.AutoCAD.Interop.Common;
......
AutoDesk.AcadCircle circleObj;
double[] centerPoint = new double[3];

centerPoint[0] = 100.0;
centerPoint[1] = 100.0;
centerPoint[2] = 0.0;
circleObj = gbl_doc.ModelSpace.AddCircle(centerPoint, 50);

Object[] ol = new Object[1];
ol[0] = (AutoDesk.AcadEntity)circleObj;
Object[] regions = (Object[])gbl_doc.ModelSpace.AddRegion(objectlist);

I get an error "Matriz de objeto no valida" (spanish) that means something like "object array invalid".
Message 3 of 5
Anonymous
in reply to: Anonymous

Hi, thanks, finally I managed to do it, actually it was relatec with using AutodeskObject instead of Object.

On the other hand, I cannot find VBA/ActiveX newsgroup, only forums I can see are:

.NET
Visual LISP, AutoLISP and General Customization Issues
Visual Basic Customization
Autodesk ObjectARX
Issues

Maybe you mean VB Customization or you are talking about a proper newsgroup (that is, using newsreader, nttp). Please, can you point me to the correct place? 🙂
Message 4 of 5
Anonymous
in reply to: Anonymous

news://discussion.autodesk.com/autodesk.autocad.customization.vba

http://discussion.autodesk.com/adskcsp/forum.jspa?forumID=33

--
http://www.caddzone.com

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

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

wrote in message news:5983772@discussion.autodesk.com...
Hi, thanks, finally I managed to do it, actually it was relatec with using AutodeskObject instead of Object.

On the other hand, I cannot find VBA/ActiveX newsgroup, only forums I can see are:

.NET
Visual LISP, AutoLISP and General Customization Issues
Visual Basic Customization
Autodesk ObjectARX
Issues

Maybe you mean VB Customization or you are talking about a proper newsgroup (that is, using newsreader, nttp). Please, can you point me to the correct place? 🙂
Message 5 of 5
Anonymous
in reply to: Anonymous

Thanks:)

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