how to Add Region in late binding?

how to Add Region in late binding?

Anonymous
Not applicable
1,630 Views
6 Replies
Message 1 of 7

how to Add Region in late binding?

Anonymous
Not applicable

hi, everybody. I want to work in different CAD version, so i use late binding. but there is problem in creating region. Dose anybody knkow how to create rgion in late binding?

0 Likes
1,631 Views
6 Replies
Replies (6)
Message 2 of 7

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> but there is problem in creating region.

Which problem?

Using which code?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 7

Anonymous
Not applicable
hi,
it is show " Invalid Object Array" when i createed.

dynamic[] circleObj = new dynamic[1];
double[] calpt = new double[3];
calpt[0] = 0; calpt[1] = 0; calpt[2] = 0;
circleObj[0] = AcadDoc.ModelSpace.AddCircle(calpt, 5);
// create region
object[] regionObject;
regionObject = (object[])AcadDoc.ModelSpace.AddRegion(circleObj); //this can't work.

How to do it?
0 Likes
Message 4 of 7

nrjdjjs
Explorer
Explorer

Hello,

I am experiencing the same issue. Were you able to find an answer to this solution? If yes, it would help if you can post the solution that worked for you.

Thank you

 

0 Likes
Message 5 of 7

Anonymous
Not applicable

I have the same problem as you. If you already have the answer, please let me know. Thank you.

My email: goodfileshare@gmail.com

0 Likes
Message 6 of 7

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> I have the same problem as you

...using AddRegion with latebinding in VBA?

 

This code works for me:

Sub Example_AddRegion_LB()
    ' This example creates a region from an arc and a line.
    
    Dim curves(0 To 1) As Object

    ' Define the arc
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    centerPoint(0) = 5#: centerPoint(1) = 3#: centerPoint(2) = 0#
    radius = 2#
    startAngle = 0
    endAngle = 3.141592
    Set curves(0) = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngle, endAngle)
    
    ' Define the line
    Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).StartPoint, curves(0).EndPoint)
        
    ' Create the region
    Dim regionObj As Variant
    regionObj = ThisDrawing.ModelSpace.AddRegion(curves)
    ZoomAll
    
End Sub

It's from the sample in the VBA help, just modified type "AcadEntity" to "Object"

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 7 of 7

Anonymous
Not applicable

double[] squarePt = new double[12];

squarePt[0]=100;

....

squarePt[11]=1000;

dynamic pLineObj = AcadDoc.ModelSpace.AddPolyline(squarePt);

IDispatch[] ents =
{
pLineObj
};
dynamic[] r = AcadDoc.ModelSpace.AddRegion(ents);
dynamic profileRegionObject = (dynamic)(r[0]);

0 Likes