Skip to content

Instantly share code, notes, and snippets.

@Civil3DToolChest
Last active August 29, 2015 13:57
Show Gist options
  • Save Civil3DToolChest/9510019 to your computer and use it in GitHub Desktop.
Save Civil3DToolChest/9510019 to your computer and use it in GitHub Desktop.
setGeneralLabelStyleProperties
public void setGeneralProperties(ObjectId labelStyleId, string textStyle, string layer, bool visiblity,
Autodesk.Civil.OrientationReferenceType orientationReference, bool planReadability, double prBias
)
{
Document acadDoc = Application.DocumentManager.MdiActiveDocument;
CivilDocument civilDoc = CivilApplication.ActiveDocument;
using (Transaction trans = acadDoc.Database.TransactionManager.StartOpenCloseTransaction())
{
LabelStyle lblstyle = trans.GetObject(labelStyleId, OpenMode.ForWrite) as LabelStyle;
lblstyle.Properties.Label.TextStyle.Value = textStyle;
lblstyle.Properties.Label.Layer.Value = layer;
lblstyle.Properties.Label.Visibility.Value = visiblity;
lblstyle.Properties.Behavior.OrientationReference.Value = orientationReference;
lblstyle.Properties.Behavior.InsertOption.Value = Autodesk.Civil.LabelInsertionType.None;
lblstyle.Properties.PlanReadability.PlanReadable.Value = planReadability;
prBias = convertDegreeToRadian(prBias);
lblstyle.Properties.PlanReadability.PlanReadableBias.Value = prBias;
trans.Commit();
}
}
public double convertDegreeToRadian(double degree)
{
// degree * (pi /180) = radian
double radian = degree * (System.Math.PI / 180);
return radian;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment