ObjectClass

ObjectClass

Anonymous
不适用
588 次查看
3 条回复
1 条消息(共 4 条)

ObjectClass

Anonymous
不适用
Help. I need ObjectClass in ObjectId but my Visual Studio 2008 does not recognize ObjectClass as one of the properties of ObjectId what is wrong with my code?

Dim bObject As New EditorInput.PromptNestedEntityOptions("")
Dim opt As EditorInput.PromptPointOptions = New EditorInput.PromptPointOptions("Pick point: ")
bObject.NonInteractivePickPoint = myEd.GetPoint(opt).Value
bObject.UseNonInteractivePickPoint = True

Dim bRes As EditorInput.PromptNestedEntityResult = myEd.GetNestedEntity(bObject)
If bRes.Status = EditorInput.PromptStatus.OK Then
Using ta As Transaction = tm.StartTransaction
myEnt = ta.GetObject(bRes.ObjectId, OpenMode.ForRead)
Dim id As DatabaseServices.ObjectId = myEnt.ObjectId
id.ObjectClass <---- does not exists
end using
end if

Edited by: a7v1n on Apr 9, 2010 3:36 AM
0 个赞
589 次查看
3 条回复
回复 (3)
2 条消息(共 4 条)

_gile
Consultant
Consultant
Hi

The ObjectClass property isn't available prior ObjectARX 2010.

Prior 2010, you can use the Entity.GetType() method

or evaluate the entity type :
{code}if (myEnt is Polyline)
{
// Do something here with the polyline
}{code}

or try an explicit cast to the requiered type (Curve in this example):
{code}Curve curveEnt = ta.GetObject(bRes.ObjectId, OpenMode.ForRead) as Curve
if (curveEnt != null)
{
// Do something here with the curve
}{code}


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 个赞
3 条消息(共 4 条)

Anonymous
不适用
ObjectClass is available in 2009 or later.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

<_gile> wrote in message news:6370128@discussion.autodesk.com...
Hi

The ObjectClass property isn't available prior ObjectARX 2010.

Prior 2010, you can use the Entity.GetType() method

or evaluate the entity type :
{code}if (myEnt is Polyline)
{
// Do something here with the polyline
}{code}

or try an explicit cast to the requiered type (Curve in this example):
{code}Curve curveEnt = ta.GetObject(bRes.ObjectId, OpenMode.ForRead) as Curve
if (curveEnt != null)
{
// Do something here with the curve
}{code}
0 个赞
4 条消息(共 4 条)

_gile
Consultant
Consultant
> ObjectClass is available in 2009 or later.
Oops!...
I upgraded from 2007 to 2010, so I don't know much about 2008 and 2009.


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 个赞