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: 

PointUDP collection problem

0 REPLIES 0
Reply
Message 1 of 1
Jeff_M
200 Views, 0 Replies

PointUDP collection problem

Same issue may exist with other UDP's, haven't checked. 

 

I don't know how the PointUDP collection gets empty entries, perhaps by adding then deleting one, but when such empty entries exist, the the following code fails with an exception:

 

UDPCollection udps = CivilApplication.ActiveDocument.PointUDPs;
UDP[] offsets = (UDP[])udps[offsetname];

 As long as there are no empty entries, the same code works fine.

 

This is what one of these 'bad' collections looks like when debugging:

1-21-2015 2-30-21 PM.png

 

It took a bit of searching to figure out the problem with my code. I could see that the UDP with the name I was looking for was clearly there in the collection, yet it kept throwing the "Object not set to a reference" exception...but only in some drawings.

 

I've created a workaround, but it really shouldn't be needed.

 

Jeff_M, also a frequent Swamper
EESignature
0 REPLIES 0

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report