ADN Club > Civil 3D API

Изменение стиля у ProfileViewPart

(1/1)

Nutson:
Доброго дня, подскажите пожалуйста,  хочу программно найти пересечки и отобразить их на виде профиля.
Пересекаемые трубопроводы отобразить на виде профиля получается без проблем, а вот как им изменить стиль отображения, я не могу понять.
Смотрел в Developer's Guide и в примерах кода, там этой темы не касались, подскажите в какую сторону копать?

Как я понял, все переопределённые трубы попадают в ProfileView.PipeOverrides, но я не вижу у этой коллекции метода для добавления туда новых переопределений.


--- Код - C# [Выбрать] ---public static void Work(Document doc)        {            using (DocumentLock loc = doc.LockDocument())            {                ProfileView profileView = Helper.SelectPV(doc);                if (profileView == null) return;                 using (Transaction tr = doc.TransactionManager.StartTransaction())                {                    Alignment alignment = tr.GetObject(profileView.AlignmentId, OpenMode.ForRead) as Alignment;                    if (alignment == null) return;                    Point3dCollection point3DCollection = new Point3dCollection();                    point3DCollection.Add(alignment.StartPoint);                    foreach (AlignmentCurve ent in alignment.Entities)                    {                        point3DCollection.Add(new Point3d(ent.EndPoint.X, ent.EndPoint.Y, 0));                    }                    TypedValue[] filter = { new TypedValue(0, "AECC_PIPE") };                    SelectionFilter selectionFilter = new SelectionFilter(filter);                    PromptSelectionResult res = doc.Editor.SelectFence(point3DCollection, selectionFilter);                     profileView = tr.GetObject(profileView.Id, OpenMode.ForWrite) as ProfileView;                    var styleId = CivilApplication.ActiveDocument.Styles.PipeStyles["Пересекаемая труба"];                     if (res.Status == PromptStatus.OK && res.Value.Count > 0)                    {                        foreach (var selPipeid in res.Value.GetObjectIds())                        {                            Pipe pipe = tr.GetObject(selPipeid, OpenMode.ForWrite) as Pipe;                            if (pipe == null) continue;                            if (!pipe.GetProfileViewsDisplayingMe().Contains(profileView.Id))                            {                                pipe.AddToProfileView(profileView.Id);                                 var pvPartId = pipe.ProfileViewPartId;                                ProfileViewPart profileViewPart = tr.GetObject(pvPartId, OpenMode.ForWrite) as ProfileViewPart;                                profileViewPart.StyleId = styleId; // ??                            }                        }                    }                    tr.Commit();                }            }        } 

Дмитрий Загорулькин:
Вот похожая тема: https://adn-cis.org/forum/index.php?topic=8702.0
Я надеялся, что у этих коллекций будут методы добавления...

Nutson:
Я изучаю методом тыка и вот к чему пришел. При добавлении трубы на вид профиля, она автоматически залетает и в коллекцию PipeOverrides. Там ее можно подхватить и переопределить ей стиль.

Навигация

[0] Главная страница сообщений

Перейти к полной версии