Hi all,
I am just start to use VB.NET,and I am trying to create a rountine that will select all the parcels and parcel segments in a drawing and depending on their style change it to different layer. I wasn't able to access the parcel segment information using autolisp,so I am hoping I can do it using vb.net.
I found some code on the internet think that may help me ,but it's seem like I run into to an other problem with the reference I keep getting error like reference class is not defined. I had been working on this for 5 days now and nothing was done. I hope someone can shine some light in my way....
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
Imports
Autodesk.AutoCAD.Runtime
Imports
Autodesk.AutoCAD.EditorInput
Imports
Autodesk.AutoCAD.ApplicationServices
Imports
Autodesk.AutoCAD.DatabaseServices
Imports
System
Imports
Autodesk.Civil.DatabaseServices
Imports
Autodesk.AutoCAD.Geometry
Imports
System.Runtime.InteropServices
Public
ClassClass1
<
CommandMethod("parlay")>
PublicSub parlay()
Dim ed AsEditor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim db AsDatabase = HostApplicationServices.WorkingDatabase
Dim prOpts AsPromptEditorOptions = NewPromptEntityOptions("\nSelect Parcel Segment: ")
prOpts.SetRejectMessage(
"....no parcel segment found!")
prOpts.AddAllowedClass(
GetType(Autodesk.Civil.Land.DatabaseServices.ParcelSegment), True)
Dim prRes AsPromptEntityResult = ed.GetEntity(prOpts)
If prRes.Status = PromptStatus.OK Then
Using tr AsTransaction = db.TransactionManager.StartTransaction
Dim netSegment As Autodesk.Civil.DatabaseServices.ParcelSegment = DirectCast(tr.GetObject(prRes.ObjectId, OpenMode.ForRead), Autodesk.Civil.DatabaseServices.ParcelSegment)
Dim comSegment As Autodesk.AECC.Interop.Land.AeccParcelSegment = DirectCast(netSegment.AcadObject, Autodesk.AECC.Interop.Land.AeccParcelSegment)
ed.WriteMessage(
"You selected a segment with a segment count of: " + comSegment.Count.ToString())
EndUsing
EndIf
EndSub
End
Class
here is the code just in case the image is too small to read