18 Posts
0 Kudos
Registered: ‎04-04-2012
Post 1 of 2

PnId Database Overrule

139 Views, 1 Replies
05-31-2013 01:02 AM



Does anyone know if there is an equivalent ObjectOverrule for the PnId Database?


If an entity is copied I dont want certain field values to be copied.


I've tried an ObjectOverrule but I can't get the RowId at that point.


I also noticed that the field values are set as XData. I edited the XData in my ObjectOverrule but the values still gets copied.


Is there a setting at project level to control which fields not to copy?




ADN Support Specialist
352 Posts
27 Kudos
Registered: ‎07-24-2007
Post 2 of 2

Re: PnId Database Overrule

06-05-2013 03:06 PM in reply to: annse

ObjectOverrule should apply to P&ID entities like all other entities. I am not sure off hand the exact order of events between our cloning code and the overrules. I do know we react to begin/end clone events and in the end clone do a lot of work to create rows in the project database, establish relationships, and copy row data.


I don’t think the Xdata is used in all situations. I know we attach Xdata with the property data so that we can insert DWGs (e.g. wblock followed by insert / explode).


It seems you simply want to prevent some project database row data from being copied?


I believe the best way to do that is to use the DataLinksManager events. 



        static private bool bIsActive = true;

        public static void dlm_DataLinkOperationOccurred(object sender, DataLinkEventArgs e)


            if (e.Action == DataLinkAction.RowModified && bIsActive)




                    DataLinksManager dlm = PlantProject.ActiveProjectPart.DataLinksManager;


                    if (dlm.HasProperty(e.RowId, "SAPCode"))


                        StringCollection props = new StringCollection();




                        StringCollection values = null;

                        values = dlm.GetProperties(e.RowId, props, true);


                        PpObjectIdArray ppoids = dlm.FindAcPpObjectIds(e.RowId);


                        StringCollection newprops = new StringCollection();



                        StringCollection newvals = new StringCollection();

                        newvals.Add(values[0] + values[1]);


                        bIsActive = false;

                        dlm.SetProperties(ppoids.First.Value, newprops, newvals);








                    bIsActive = true;





        [CommandMethod("DEMOSTART", CommandFlags.Modal)]

        public static void DemoStart()


            DataLinksManager dlm = PlantProject.ActiveProjectPart.DataLinksManager;

            dlm.DataLinkOperationOccurred +=new DataLinkEventHandler(dlm_DataLinkOperationOccurred);



        [CommandMethod("DEMOEND", CommandFlags.Modal)]

        public static void DemoEnd()


            DataLinksManager dlm = PlantProject.ActiveProjectPart.DataLinksManager;

            dlm.DataLinkOperationOccurred -= new DataLinkEventHandler(dlm_DataLinkOperationOccurred);




That is sample code that updates a SAPCode property every time a row in the project is modified. It would need to be changed to react to rows being added / modified and blank out necessary properties.

Fenton Webb

Developer Technical Services

Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!