Possible Network bug?

Possible Network bug?

norman.yuan
Mentor Mentor
430 Views
3 Replies
Message 1 of 4

Possible Network bug?

norman.yuan
Mentor
Mentor

I am working on C3D development project where I have code to access Network object. Surely it is simple enough to simply call

 

CivilDocument.GetNetworkIds() 

 

Since I have to repeatedly test my code on different drawings, sometimes I just copy drawing content with network included to another blank drawing to run my debugging/testing. I use Clipboard Copy/Paste to do it. Then I found, in the drawing where the drawing content is pasted, the GetNetworkIds() would return 2 network IDs in spite the copied drawing content only has one network in it. If the code opens the 2 DIFFERENT network ObjectIds as Netowrk objects, both has the same Name, and the same other properties. That is, the 2 are identical. Yes, the Prospector in Tool Space paletteSet only show one network exists.

 

If I save the drawing. close and then open it again, there would only be one network, as expected.

 

So, I assume it is somehow a bug with C3D. And with this bug, if running code related to network with a drawing that has network just copied from external drawing, this bug could be hit.

 

Now that I know reopening the drawing would avoid this issue, I am curious to know whether anyone comes across this. Or maybe, with C3D network, one should never copy from one drawing to another?

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
431 Views
3 Replies
Replies (3)
Message 2 of 4

Jeff_M
Consultant
Consultant
I'm on vacation with no way to test/verify @norman.yuan but when you have an Xref or a block of a drawing with Networks, the GetNetworkIds() finds the nested networks. So when you copy/paste there is likely a temporary block created which holds the second phantom network which C3D cleans up when closing the drawing.
Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 3 of 4

norman.yuan
Mentor
Mentor

@Jeff_M 

There is no block/Xref involved. After running this with a quite large drawing during code debugging, I also thought that, maybe, the copying brought into some "garbage". So, I started a blank drawing, drawing a simple polyline, convert it into a pipe (thus a Network is created). Then I copy this simple pipe into another blank drawing (so, no blockreference/Xref involved). Ran code with GetNetworkIds(), it returned 2 network IDs (i.e. 2 identical Network objects with different ObjectId). Closing and reopening the drawing would get rid of the duplicate.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 4 of 4

Kyle-L
Advocate
Advocate

I can confirm I am seeing the same issue. I followed your steps and was able to reproduce the results. If I look at Project Explorer after pasting a pipe I also see a duplicated network that disappears after closing and opening the drawing. I also found the duplicated network in the profile view properties pipe networks tab.

 

This leads me to believe it is a Civil 3D bug and not just an API bug.

 

KyleL_0-1630483930548.png

 

KyleL_1-1630484069779.png