Posts: 25
Registered: ‎12-05-2010
Message 1 of 5 (1,681 Views)
Accepted Solution

create 3d polyline

1681 Views, 4 Replies
01-03-2011 04:41 AM

Hi all,


This should be quite simple for many of you, I believe.

I need to create 3dpolyline interactively by clicking points on the screen. It seems to me that the SendCommand can't be used in my case since I can't make program hold until the user enters the object and also, it doesn't return a reference to the object created. Please correct me if I am wrong.

The problem I have is that GetPoint returns Object (instead of Point3D) which can not be added to pointCollection. Could you give me some suggestions?


The logic should go like this:

        Dim myPoints As New AcadNetGeometry.Point3dCollection

        Dim pt3D As AcadNetGeometry.Point3d
        Do While True
                pt3D = g_oCivil3DDoc.Utility.GetPoint(, "Pick a point:")
            Catch ex As Exception
                Exit Do
            End Try
        Dim myPLine3D As New AcadNetDbServices.Polyline3d(AcadNetDbServices.Poly3dType.SimplePoly, myPoints, True)



Posts: 18
Registered: ‎09-25-2007
Message 2 of 5 (1,666 Views)

Re: create 3d polyline

01-03-2011 06:48 AM in reply to: matejt



You better not use Utilily.Getpoint.


Try This:

Dim ThisEditor As Autodesk.AutoCAD.EditorInput.Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
                        Dim PrpRes As Autodesk.AutoCAD.EditorInput.PromptPointResult = ThisEditor.GetPoint(ControlChars.Lf & "Select a point: ")
                        If PrpRes.Status = Autodesk.AutoCAD.EditorInput.PromptStatus.OK Then
                            Dim MyPoint As Point3d = PrpRes.Value
                        End If




You can refer to Autodesk .NET documentation.


Good Luck!


*Expert Elite*
Posts: 982
Registered: ‎04-27-2009
Message 3 of 5 (1,664 Views)

Re: create 3d polyline

01-03-2011 06:50 AM in reply to: matejt

Obviously, you are using COM API's GetPoint() method, which returns an object - an array of Double type with 3 elements. It is not Autodesk.AutoCAD.Geometry.Point3dCollection. Thus, your code does not work.


First of all, why use COM API's AcadUtility.GetPoint() method at all while you are doing managed API project? You should use:


Editor.GetPoint() in conjunction with PromptPointOptions/PromptPointResult object to get user-picked point as Point3d value.


If you HAVE TO use AcadUtility.GetPoint() for some very odd reason in a managed API project (what it could be, I wonder), then you should create a Point3d struct from the returned 3-element array:


Do While Trye


    Dim pt As object=g_oCivil3DDoc.Utility.GetPoint(,"Pick point:")

    Point3d p=New Point3d(pt(0),pt(1),pt(2))



    Exit Do

  End Try




Posts: 25
Registered: ‎12-05-2010
Message 4 of 5 (1,654 Views)

Re: create 3d polyline

01-03-2011 07:46 AM in reply to: norman.yuan

Thanx for the replies!

Obviously, I need to fully understand basic conceps first.

Could you refer me to some good resources i.e. ebooks, tutorials, etc. as to vb.NET for AutoCAD. In fact, I was able to download pretty useful AutoCAD Civil 3D Developer's Guide, however, I haven't found any good reference of pure AutoCAD .NET (except the on-line AutoCAD .NET Developer's Guide which I don't find very well structured and explanatory).

What would you recommend?


Distinguished Contributor
Posts: 112
Registered: ‎04-22-2009
Message 5 of 5 (1,615 Views)

Re: create 3d polyline

01-04-2011 12:57 AM in reply to: matejt

Hi there,


There are sever resources.


http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html a guide by autodesk.

http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=1911627 look at the autocad 2010 .net training it's in c# en VB.net


and a great book. By Jerry Winters called VB.NET for AutoCAD 2010 it's a level 1 book and heard he is writing a level 2 book right now.


The book can be orderd on his website. www.vbcad.com 


Kind regards

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.