Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
[CommandMethod("Test")]
public void Profileview()
{
var doc = AcadApp.Application.DocumentManager.MdiActiveDocument;
var ed = doc.Editor;
var DB = doc.Database;
var CivilDoc = CivilApp.CivilApplication.ActiveDocument;
selectionResult = ed.GetSelection(new SelectionFilter(new TypedValue[1] { new TypedValue((int)DxfCode.Start, "AECC_PROFILE_VIEW") }));
if (selectionResult.Status != PromptStatus.OK)
{
ed.WriteMessage("\nNo Profile Views Selected.");
return;
}
SelectionSet selectionSet = selectionResult.Value;
ObjectId[] profileviewIds = selectionSet.GetObjectIds();
using (Transaction trans = DB.TransactionManager.StartTransaction())
{
ObjectId LabelSetID;
foreach (ObjectId labelid in CivilDoc.Styles.LabelSetStyles.ProfileLabelSetStyles)
{
ProfileLabelSetStyle lblset = trans.GetObject(labelid, OpenMode.ForRead) as ProfileLabelSetStyle;
string labelname = lblset.Name;
if (labelname == "Complete Label Set")
{
LabelSetID = labelid;
}
}
foreach (ObjectId profileviewId in profileviewIds)
{
if (profileviewId.ObjectClass.DxfName == "AECC_PROFILE_VIEW")
{
ProfileView profileview = trans.GetObject(profileviewId, OpenMode.ForWrite) as ProfileView;
ObjectId alignmentId = profileview.AlignmentId;
Alignment alignment = trans.GetObject(alignmentId, OpenMode.ForRead) as Alignment;
foreach (ObjectId profileId in alignment.GetProfileIds())
{
Profile profile = trans.GetObject(profileId, OpenMode.ForWrite) as Profile;
if (profile.ProfileType == ProfileType.FG)
{
//Profile Label Set
}
}
}
}
trans.Commit();
trans.Dispose();
}
}
Solved! Go to Solution.