Resolving Style conflicts in exporting Civil 3D Object styles using .NET API

By Partha Sarkar

StyleConflictResolverType
Enumeration specifies how to resolve conflicts (the same name for an existing
style and a new imported style) when exporting styles to another drawing using
StyleBase::ExportTo()

Members
of  StyleConflictResolverType Enumeration
– 

CancelRemainingRenameIgnoreOverride

Here is a C#
.NET code snippet which demonstrates how to use
Autodesk.Civil.StyleConflictResolverType in resolving conflicts –

 

LabelStyleCollection lStyles = civilDoc.Styles.LabelStyles.PointLabelStyles.LabelStyles;

foreach (ObjectId stId in lStyles)

{

  LabelStyle pSt = trans.GetObject(stId, OpenMode.ForRead) as LabelStyle;

  // Export the style

  pSt.ExportTo(outDb, Autodesk.Civil.StyleConflictResolverType.Override);

  // Now export its children

  for (int i = 0; i < pSt.ChildrenCount; i++)

  {

    LabelStyle chSt = trans.GetObject(pSt[i], OpenMode.ForRead) as LabelStyle;

    chSt.ExportTo(outDb, Autodesk.Civil.StyleConflictResolverType.Override);

  }

}

Hope this is useful to you!


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading