CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.096.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator and the updated Barcode generator. New AutoCAD 2026 commands and variables.
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

?
CAD discussions, advices, exchange of experience

CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.
This is a peer-to-peer forum. The forum doesn't replace the official direct technical support provided by ARKANCE for its customers.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedAdd Region using .NET and late binding...

 Post Reply Post Reply
Author
LittleOleMeDesi View Drop Down
Newbie
Newbie


Joined: 22.Mar.2010
Location: United States
Status: Offline
Points: 1
Direct Link To This Post Topic: Add Region using .NET and late binding...
    Posted: 22.Mar.2010 at 15:02
I am trying to create a Region with .NET.  I am using late binding since I have to program to 3 different version of AutoCAD.

The following code works:

 
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim V_Region As Object

        ' declare variables
        Const PI = 3.14159265358979
        Dim line1 As Object
        Dim line2 As Object
        Dim line3 As Object
        Dim arc1 As Object
        Dim center1(2) As Double
        Dim point1(0 To 2) As Double
        Dim point2(0 To 2) As Double
        Dim point3(0 To 2) As Double
        Dim point4(0 To 2) As Double

        point1(0) = 10 : point1(1) = 10 : point1(2) = 0
        point2(0) = 50 : point2(1) = 10 : point2(2) = 0
        point3(0) = 50 : point3(1) = 20 : point3(2) = 0
        point4(0) = 10 : point4(1) = 20 : point4(2) = 0

        line1 = V_AutoCad.ActiveDocument.ModelSpace.AddLine(point1, point2)
        line2 = V_AutoCad.ActiveDocument.ModelSpace.AddLine(point3, point4)
        line3 = V_AutoCad.ActiveDocument.ModelSpace.AddLine(point4, point1)
        center1(0) = line1.EndPoint(0) : center1(1) = line1.EndPoint(1) + 5
        center1(2) = 0
        arc1 = V_AutoCad.ActiveDocument.ModelSpace.AddArc(center1, 5, 3 / 2 * PI, 1 / 2 * PI)
        ' make array for region
        Dim arrayobj(3) As AcadEntity
        arrayobj(0) = line1
        arrayobj(1) = arc1
        arrayobj(2) = line2
        arrayobj(3) = line3
        ' make the region from the array

        V_Region = V_AutoCad.ActiveDocument.ModelSpace.AddRegion(arrayobj)
       

    End Sub


But when I change this line:
      Dim arrayobj(3) As AcadEntity
To:
      Dim arrayobj(3) As Object

I get "Invalid Object Array" on the AddRegion line.

Does anyone know how to fix this and stay as a late binding program???
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,063 seconds.