public RealStationData(C3dDb.Alignment alignment, C3dDb.Station data) { StationData = data; double station = 0.0, offset = 0.0; alignment.StationOffset (data.Location.X, data.Location.Y, ref station, ref offset); RealStation = station; }
public static Profile ByAlignmentAndSurface(Autodesk.AutoCAD.DynamoNodes.Document document, Alignment parentAlignment, Surface parentSurface, string name, Styles.ProfileStyle profileStyle, ProfileLabelSet profileLabelSet) { Autodesk.Civil.DatabaseServices.Profile newProfile = null; AcadApp.Document curDoc = document.AcDocument; Database db = curDoc.Database; Autodesk.Civil.DatabaseServices.Surface civilSurface = (Autodesk.Civil.DatabaseServices.Surface)parentSurface.InternalDBObject; using (Transaction trans = db.TransactionManager.StartTransaction()) { string oName = name; // need to assign these values based on the string inputs LayerTable lyrTable = (LayerTable)trans.GetObject(db.LayerTableId, OpenMode.ForRead); //ObjectId layerId = Utilities.GetLayerByName(db, layer.Name); // id of layer to add profile to // get the layer name defined in the settings ObjectId layerId = Utilities.GetLayerByName(db, CivilDynamoTools.Settings.Settings.GetLayerName(document, Autodesk.Civil.Settings.SettingsObjectLayerType.Profile, name)); ObjectId styleId = profileStyle.InternalObjectId; // id of style to assign the profile ObjectId labelSetId = profileLabelSet.InternalObjectId; // id of label set to assign CivilDocument civilDocument = Autodesk.Civil.ApplicationServices.CivilDocument.GetCivilDocument(document.AcDocument.Database); ObjectIdCollection alignIds = civilDocument.GetAlignmentIds(); // make sure the name doesn't already exist for any profile int copy = 1; foreach (ObjectId aId in alignIds) { Autodesk.Civil.DatabaseServices.Alignment civilAlignment = (Autodesk.Civil.DatabaseServices.Alignment)trans.GetObject(aId, OpenMode.ForRead); ObjectIdCollection profIds = civilAlignment.GetProfileIds(); foreach (ObjectId pId in profIds) { Autodesk.Civil.DatabaseServices.Profile civilProfile = (Autodesk.Civil.DatabaseServices.Profile)trans.GetObject(pId, OpenMode.ForRead); if (civilProfile.Name == name) { name = oName + " - " + copy; copy += 1; } } } ObjectId newProfileId = Autodesk.Civil.DatabaseServices.Profile.CreateFromSurface(name, parentAlignment.InternalObjectId, parentSurface.InternalObjectId, layerId, styleId, labelSetId); newProfile = (Autodesk.Civil.DatabaseServices.Profile)trans.GetObject(newProfileId, OpenMode.ForRead); trans.Commit(); } if (newProfile == null) { return(null); } else { return(new Profile(newProfile, true)); } }
// alignments public Base AlignmentToSpeckle(CivilDB.Alignment alignment) { var curve = CurveToSpeckle(alignment.BaseCurve, ModelUnits) as Base; if (alignment.DisplayName != null) { curve["name"] = alignment.DisplayName; } if (alignment.Description != null) { curve["description"] = alignment.Description; } if (alignment.StartingStation != null) { curve["startStation"] = alignment.StartingStation; } if (alignment.EndingStation != null) { curve["endStation"] = alignment.EndingStation; } return(curve); }
internal Alignment(C3dDb.Alignment alignment, bool isDynamoOwned = false) : base(alignment, isDynamoOwned) { }