Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
I have been writing a program that imports points from a selected file. I know about importing points from insert tab on the ribbon, but I want this to run after some other code that I have. Every time I run this code, I get the error that no points were transferred from file. I have attached the file I am pulling for reference. I am at a complete loss and have been working on this for a few days now. Any help would be appreciated! Thanks!
Imports Autodesk.Civil.ApplicationServices
Imports Autodesk.Civil.DatabaseServices
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Public Class Class1
Public Shared Sub importPointsFromFile()
Dim acDoc As Document = Core.Application.DocumentManager.MdiActiveDocument
Dim civilDoc As CivilDocument = CivilApplication.ActiveDocument
Dim acCurDb As Database = acDoc.Database
Using trans As Transaction = acCurDb.TransactionManager.StartTransaction()
Dim pointFileName As String = "C:\Users\jdalton\Desktop\091021_PCV3_ASB_SH.csv"
Dim pointFileFormatName As String = "PNEZD (comma delimited)"
Dim pointFileFormat As PointFileFormat = PointFileFormatCollection.GetPointFileFormats(acCurDb).Item(pointFileFormatName)
Dim pointGroupId As ObjectId = civilDoc.PointGroups.Add("-FIELD IMPORT")
Dim result As UInteger = CogoPointCollection.ImportPoints(pointFileName, pointFileFormat, False, False, False, pointGroupId)
trans.Commit()
End Using
End Sub
End Class
Also I am using AutoCAD Civil3D 2022 and 4.7.2 Net Framework
Edit: I have also tried having a Cogo Point in the blank drawing to see if that would do anything. I also attached the error picture.
Edit 2: I get an error also adding the point group on line 15 and another error when adding the points (with and without the inclusion of pointgroupId)
Solved! Go to Solution.
Solved by joshmcdalton. Go to Solution.
No problem
Tomorrow I will try it out
as an idea
Can you read the text file?
and create points Then create a group to enter
As in the link in the first reply to thank
Can't find what you're looking for? Ask the community or share your knowledge.