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: 

Change profile view band item c#

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
tothapal
907 Views, 2 Replies

Change profile view band item c#

Profile view has two porfiles and I try to change the Profile1Id in the bottom band from the first profile to the second.  I get an error message that "It is not open for write". 

 

The code:

using (Transaction tr = db.TransactionManager.StartOpenCloseTransaction())
{
    profView = tr.GetObject(profViewId, OpenMode.ForWrite) as ProfileView;
    ProfileViewBandItemCollection bottomBands = profview.Bands.GetBottomBandItems();
    bottomBands[0].Profile1Id = testProfileId2;
    profview.Bands.SetBottomBandItems(bottomBands);
    tr.Commit();
}   
2 REPLIES 2
Message 2 of 3
Jeff_M
in reply to: tothapal

It works fine with a regular Transaction.

using (Transaction tr = db.TransactionManager.StartTransaction())
Jeff_M, also a frequent Swamper
EESignature
Message 3 of 3
tothapal
in reply to: Jeff_M

Thank you!

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report