ADN Club > Civil 3D API
Как изменить текст в Sample Line?
(1/1)
alsh:
Добрый день.
В справке дан пример как изменить линию Sample line
--- Код - C# [Выбрать] ---ObjectId sampleLineStyleId = _civildoc.Styles.SampleLineStyles.Add("New SampleLine Style");SampleLineStyle sampleLineStyle = ts.GetObject(sampleLineStyleId, OpenMode.ForWrite) as SampleLineStyle;// Display lines in violetsampleLineStyle.GetDisplayStylePlan(SampleLineDisplayStyleType.Lines).Color = Color.FromColorIndex(ColorMethod.ByAci, 200);sampleLineStyle.GetDisplayStyleModel(SampleLineDisplayStyleType.Lines).Color = Color.FromColorIndex(ColorMethod.ByAci, 200);А как изменить текст, скажем по Sample line name вместо Sample line Raw station?
В сивиле это делается через Edit Sample lines labels in Group.
то есть через SampleLineLabelGroup ?
Спасибо заранее.
Александр Ривилис:
Посмотри это описание: http://docs.autodesk.com/CIV3D/2014/ENU/Developers_Guide/index.html?url=files/GUID-C7A2534B-0BE3-4032-BC39-989358A50C6C.htm,topicNumber=d30e17879
Возможно это то, что ты ищешь.
alsh:
Нашел :)
--- Код - C# [Выбрать] ---foreach(ObjectId oid in alignment.GetSampleLineGroupIds())...ObjectIdCollection idColl = Autodesk.Civil.DatabaseServices.SampleLineLabelGroup.GetAvailableLabelGroupIds(oid); foreach (ObjectId sId in idColl){ SampleLineLabelGroup sg = trans.GetObject(sId, OpenMode.ForWrite) as SampleLineLabelGroup; IList<LabelGroupSubEntity> labels = sg.SubEntities; foreach (LabelGroupSubEntity label in labels) { ObjectIdCollection componentIDs = label.GetTextComponentIds(); foreach (ObjectId componentID in componentIDs) { LabelStyleTextComponent component = (LabelStyleTextComponent)trans.GetObject(componentID, OpenMode.ForRead); label.SetTextComponentOverride(componentID, test_str); } }}
Навигация
Перейти к полной версии