Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

eNullObjectId

1 REPLY 1
SOLVED
Reply
Message 1 of 2
joantopo
551 Views, 1 Reply

eNullObjectId

Hi.

 

I think I have a trouble with my drawing (drawing template).

 

In this part:

 

   ObjectIdCollection IdsampleLineGroup = alin.GetSampleLineGroupIds();

                foreach (ObjectId id_slg in IdsampleLineGroup)  //obtenemos todos los grupos de líneas de muestreo de dicha alineación
                {

                    Autodesk.Civil.DatabaseServices.SampleLineGroup slg = default(Autodesk.Civil.DatabaseServices.SampleLineGroup);
                    slg = trans.GetObject(id_slg, OpenMode.ForRead) as SampleLineGroup;

 

IdsampleLineGroup collection has 1 item (count=1)

but in this line:

 slg = trans.GetObject(id_slg, OpenMode.ForRead) as SampleLineGroup;

my app throws the exception "eNullObjectid" because:

index 0 is :

 

IdsampleLineGroup[0]={(0)}


Why happen that and how can I avoid it?

Thanks.
Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
1 REPLY 1
Message 2 of 2
Civil3DReminders
in reply to: joantopo

I check for objectId is not null value and then use the ObjectId in the code. 

 

if (testObjId != ObjectId.Null)

{

 

}

 

 

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

Post to forums  

Rail Community


Autodesk Design & Make Report