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

C# and ActiveX

7 REPLIES 7
Reply
Message 1 of 8
dnlo
552 Views, 7 Replies

C# and ActiveX

What is wrong with the code, I have an error at runtime at the last line:

AcadLine lineInSset = (AcadLine)ssetObjectAll.Item((Object)i);
Console.Write("n\{0}", lineInSset.Angle.ToString());

//ssetObjectAll - selection set that contains line entities
// i - index of entity in sel.set

ActiveX help says that Line is accessible through sSet.Item() method..is it something wrong with the cast?

Thank you
7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: dnlo

Break up your code first:

AcadEntity entity = ssetObjectAll.Item(i);
AcadLine line = (AcadLine) entity;

What is the _exact_ text of the error message?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5133905@discussion.autodesk.com...
What is wrong with the code, I have an error at runtime at the last line:

AcadLine lineInSset = (AcadLine)ssetObjectAll.Item((Object)i);
Console.Write("n\{0}", lineInSset.Angle.ToString());

//ssetObjectAll - selection set that contains line entities
// i - index of entity in sel.set

ActiveX help says that Line is accessible through sSet.Item() method..is it something wrong with the cast?

Thank you
Message 3 of 8
Anonymous
in reply to: dnlo

I would say that it make problems that you have written "n\" instead of
"\n".

Roland
Message 4 of 8
dnlo
in reply to: dnlo

The error message is:
the object referenced has not been instantiated.

When creating line object with addLine method it is OK.
Extracting object from selection set as AcadEntity OK as well.
But how to convert AcadEntity/IAcadObject to AcadLine in order to get start- endPoints??
Message 5 of 8
Anonymous
in reply to: dnlo

Maybe this entity is not line?
Message 6 of 8
dnlo
in reply to: dnlo

It is line, entity type AcDbLine. Drawing database contains (testing time) only line entities..
Message 7 of 8
Anonymous
in reply to: dnlo

The typecast to AcadLine should do that:

AcadLine line = (AcadLine) entity;

If not, step through the code with the debugger
and see if the line variable is getting set.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5135379@discussion.autodesk.com...
The error message is:
the object referenced has not been instantiated.

When creating line object with addLine method it is OK.
Extracting object from selection set as AcadEntity OK as well.
But how to convert AcadEntity/IAcadObject to AcadLine in order to get start- endPoints??
Message 8 of 8
kahekman
in reply to: Anonymous

I was programming in LabVIEW, I was able to take the objectID and then from the ACADdocument I was able to use objectID to Object to get the pointer to the line.

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