.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

referenceing problem with vb.net.

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
amyyoyo1
588 Views, 4 Replies

referenceing problem with vb.net.

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....paylay.PNGparylay2.PNG

4 REPLIES 4
Message 2 of 5
amyyoyo1
in reply to: amyyoyo1

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

Message 3 of 5
Jeff_M
in reply to: amyyoyo1

You need to reference the Land libraries. All 4 of these, from this location, need to be referenced:

 

6-14-2014 2-56-18 PM.png

 

Jeff_M, also a frequent Swamper
EESignature
Message 4 of 5
Jeff_M
in reply to: amyyoyo1

Also, once again I will point you back to the C3D customization forum. I would've seen this the day you posted, as I only come into this group when I have extra time. 🙂
Jeff_M, also a frequent Swamper
EESignature
Message 5 of 5
amyyoyo1
in reply to: Jeff_M

Thank you so much Jeff!

 

I almost stop working on it.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost