Jump to content

vb.net how to close a polyline?


Recommended Posts

Posted

Hi,

 

I want calculate the area of a closed polyline. I pick up a polyline and If it is not closed, I want to close it. But the code below doesn't work.

 

                            If lwpoly.Closed = False Then
                               lwpoly.Closed = True
                           End If

 

It returns an internal error saying "eNotOpenForWrite". Just wondering how should I close a polyline with vb.net 2008 express for autocad 2010.

 

Thanks in advance

 

Cean

Posted

Looks like you opened it for read so try

 

           If lwpoly.Closed = False Then
               lwpoly.UpgradeOpen()
               lwpoly.Closed = True
           End If

Posted

Thanks Jeff, It works.

 

I was playing with a code from theswamp - .net polyline routines

It has one line like this:

 

Dim obj As DBObject = tr.GetObject(res.ObjectId, OpenMode.ForRead)

 

I think I should change here.

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...