Created
March 17, 2014 19:07
-
-
Save Civil3DToolChest/9606108 to your computer and use it in GitHub Desktop.
set general label style contents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void setTextComponentContents(ObjectIdCollection componentIds, string contentString, string componentName) | |
{ | |
Document acadDoc = Application.DocumentManager.MdiActiveDocument; | |
CivilDocument civilDoc = CivilApplication.ActiveDocument; | |
using (Transaction trans = acadDoc.Database.TransactionManager.StartOpenCloseTransaction()) | |
{ | |
foreach (ObjectId id in componentIds) | |
{ | |
LabelStyleTextComponent textComponent = trans.GetObject(id, OpenMode.ForWrite) as LabelStyleTextComponent; | |
textComponent.Name = componentName; | |
textComponent.Text.Contents.Value = contentString; | |
} | |
trans.Commit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment