public static void CheckForReference(AeccEntity entity) { if (entity.IsReferenceObject || entity.IsReferenceSubObject) { throw new InvalidOperationException("Object is referenced and cannot be changed!"); } }
internal Parcel(Autodesk.Civil.DatabaseServices.Entity curCivilEntity, bool isDynamoOwned) : base(curCivilEntity, isDynamoOwned) { _curCivilObject = curCivilEntity; _polyCurves = PolyCurves(); //_outerPolyline = (Autodesk.AutoCAD.DatabaseServices.Polyline)curCivilEntity.BaseCurve; //_outerPolyCurve = PolyCurveByParcel(this); //_outerPolyCurve = _polyCurves[0]; }
public CivilObject SetStyle(CivilStyle civilStyle) { Autodesk.AutoCAD.ApplicationServices.Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Autodesk.AutoCAD.DatabaseServices.Database db = doc.Database; using (Autodesk.AutoCAD.DatabaseServices.Transaction trans = db.TransactionManager.StartTransaction()) { Autodesk.Civil.DatabaseServices.Entity entity = (Autodesk.Civil.DatabaseServices.Entity)trans.GetObject(_curCivilObject.ObjectId, OpenMode.ForWrite); entity.StyleId = civilStyle.InternalObjectId; trans.Commit(); } return(this); }
public Autodesk.Civil.DynamoNodes.CivilObject SetDescription(string description) { Autodesk.AutoCAD.ApplicationServices.Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Autodesk.AutoCAD.DatabaseServices.Database db = doc.Database; using (Autodesk.AutoCAD.DatabaseServices.Transaction trans = db.TransactionManager.StartTransaction()) { Autodesk.Civil.DatabaseServices.Entity entity = (Autodesk.Civil.DatabaseServices.Entity)trans.GetObject(_curCivilObject.ObjectId, OpenMode.ForWrite); entity.Name = description; trans.Commit(); } this._description = description; return(this); }
private Autodesk.Civil.DynamoNodes.CivilObject SetNameWithCounter(string name, int counter = 0) { Autodesk.AutoCAD.ApplicationServices.Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Autodesk.AutoCAD.DatabaseServices.Database db = doc.Database; using (Autodesk.AutoCAD.DatabaseServices.Transaction trans = db.TransactionManager.StartTransaction()) { Autodesk.Civil.DatabaseServices.Entity entity = (Autodesk.Civil.DatabaseServices.Entity)trans.GetObject(_curCivilObject.ObjectId, OpenMode.ForWrite); try { entity.Name = name; } catch (System.Exception ex) { // if // An exception of type 'System.ArgumentException' occurred in AeccDbMgd.dll but was not handled in user code // Additional information: The name may exist. occurred if (ex.Message == "The name may exist.") { // check if the name already has the current counter string suffix = " - " + counter.ToString(); try { entity.Name = name + suffix; } catch (System.Exception ex2) { // if if (ex2.Message == "The name may exist.") { counter += 1; SetNameWithCounter(name, counter); } } // possibly refactor this method to create a private method that accepts an optional counter // if counter is supplied, add as a suffix and try // if caught, call this method again and increment the counter } } finally { } trans.Commit(); } this._name = name; return(this); }
public TypedValue SyncDataReference(ResultBuffer resbuf) { var nil = new TypedValue((int)LispDataType.Nil); var T = new TypedValue((int)LispDataType.T_atom); // check if the arg is a civil 3d object if (BufferContainsObjectId(resbuf) == false) { return(nil); } // get the actual value of the resbuf var args = resbuf.AsArray(); ObjectId oID = (ObjectId)args[0].Value; Document currentDocument = Application.DocumentManager.MdiActiveDocument; Database currentDatabase = currentDocument.Database; using (Transaction trans = currentDatabase.TransactionManager.StartTransaction()) { try { Autodesk.Civil.DatabaseServices.Entity selectedEntity = (Autodesk.Civil.DatabaseServices.Entity)trans.GetObject(oID, OpenMode.ForRead); // check if the civil object is a data reference if (selectedEntity.IsReferenceObject) { // synchronize the entity // no code entry point available to synchronize an individual object } } catch (Autodesk.AutoCAD.Runtime.Exception ex) { Console.WriteLine(ex.Message); return(nil); } } // return nil as the final output option return(nil); }
//[IsVisibleInDynamoLibrary(false)] internal CivilObject(Autodesk.Civil.DatabaseServices.Entity curCivilEntity, bool isDynamoOwned) : base(curCivilEntity, isDynamoOwned) { _curCivilObject = curCivilEntity; _name = curCivilEntity.Name; _description = curCivilEntity.Description; }
protected Alignment(Autodesk.Civil.DatabaseServices.Entity entity, bool isDynamoOwned) : base(entity, isDynamoOwned) { }