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

AddAllowedClass in GetEntity

2 REPLIES 2
Reply
Message 1 of 3
MarkPendergraft
1660 Views, 2 Replies

AddAllowedClass in GetEntity

I'm writing a program to list specific survey related data of Lines, Arcs, and Polylines.

i use the GetEntity function of the Editor.
I want to filter the types of objects that the user is allowed to pick.
I have seen code in C# using the AddAllowedClass of the PromptEntityOptions object. However i cannot seem to get it to work.

Here is my code thus far.....

Public Sub ListSurveyData()

Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = HostApplicationServices.WorkingDatabase

Dim prEntOpt As PromptEntityOptions = New PromptEntityOptions("Select an Arc or Line: ")

'''''''''''''''''''''''''''''''''''''''''''''''''''
''''Cant figure this part out. !!!!
prEntOpt.AddAllowedClass(Type.GetType(Line), True)
prEntOpt.AddAllowedClass(Type.GetType(Polyline), True)
prEntOpt.AddAllowedClass(Type.GetType(Arc), True)
'''''''''''''''''''''''''''''''''''''''''''''''''''

prEntOpt.AllowNone = False

Dim prEntRes As PromptEntityResult = ed.GetEntity(prEntOpt)
If prEntRes.Status PromptStatus.OK Then Exit Sub


End Sub
2 REPLIES 2
Message 2 of 3
jbooth
in reply to: MarkPendergraft

Type.GetType() requires a string. Use the GetType operator instead of calling the GetType method of the System.Type class.

ie: use GetType(Line) instead of Type.GetType(Line)

If it still doesn't work, feel free to post again. 😉
Message 3 of 3

i found a website half in japanese, with the code in english, and figured it out...... i needed to use GetType instead of type.gettype()

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