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
Dim myPLine3D As New AcadNetDbServices.Polyline3d(AcadNetDbServices.Pol
Solved! Go to Solution.
You better not use Utilily.Getpoint.
Dim ThisEditor As Autodesk.AutoCAD.EditorInput.Editor = Autodesk.AutoCAD.ApplicationServices.Application.D
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
You can refer to Autodesk .NET documentation.
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))
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?
There are sever resources.
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
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register