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: 

Transaction.Commit in subassembly.draw method crashes Civil 3D

3 REPLIES 3
Reply
Message 1 of 4
denler
5115 Views, 3 Replies

Transaction.Commit in subassembly.draw method crashes Civil 3D

Hi everyone, I have to create a custom C3D subassembly in C#. While computing the corridor in design mode, I have to save some data in the corridor Xrecord. I'm not sure this is possible at the time of computing the corridor... In my Draw method of my subassembly, I have to execute the transaction.Commit() method to save my custom data. The corridor computes correctly, but C3D crashes at the end of corridor recalc. Is it normal? If I don’t execute the transaction.Commit() method, the program don’t crashes, but my data is not saved. How can I save data into the corridor while my subassembly is calculating? Thanks a lot, Denis
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: denler

Hi denler,

 

Could you check your code to see if you have used trans.GetObject(objId, OpenMode.ForRead).... ?

 

That could be causing the crash as you are trying to add data without opening the Object in OpenMode.ForWrite.

 

If this is not the case, its hard to guess, unless we get to see a code snippet which is crashing Civil 3D.

 

Thanks,

Partha Sarkar

Autodesk

Message 3 of 4
denler
in reply to: Anonymous

Hi Partha, Thank you for your replay. The access to the corridor used OpenMode.ForRead. A quick test with the code below gives me the same result : C3D computes correctly the corridor and crashes after last station is computed. code : protected override void DrawImplement(Autodesk.Civil.Runtime.CorridorState corridorState) { using (Transaction trans = Application.DocumentManager.MdiActiveDocument.TransactionManager.StartTransaction()) { trans.Commit(); //I know this is stupid, but this is just for a test } } I don't have any error info in MS Visual studio output messages nor error no from Civil 3D. I think I'm going to use a temp file to store data... Regards, Denis
Message 4 of 4
Anonymous
in reply to: denler

So you have found a workaround to address this issue.

 

If you need any further help, I would request you to share a reproduceable code snippet so that I can debug into it to figure out the cause of the crash.

 

Cheers,

Partha

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report