<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Where do the PnPTagFormat definitions get stored? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/where-do-the-pnptagformat-definitions-get-stored/m-p/8547891#M23725</link>
    <description>&lt;P&gt;Jason, thanks for the reply.&amp;nbsp; However, that method appears to be only looking at Plant 3D classes; I need the P&amp;amp;ID equivalent.&amp;nbsp; I found Autodesk.ProcessPower.TagFormats, but haven't figured out how it's used yet (or if that's even the correct class).&amp;nbsp; Any additional help would be greatly appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Will&lt;/P&gt;</description>
    <pubDate>Thu, 24 Jan 2019 22:12:07 GMT</pubDate>
    <dc:creator>louwill</dc:creator>
    <dc:date>2019-01-24T22:12:07Z</dc:date>
    <item>
      <title>Where do the PnPTagFormat definitions get stored?</title>
      <link>https://forums.autodesk.com/t5/net-forum/where-do-the-pnptagformat-definitions-get-stored/m-p/8546580#M23723</link>
      <description>&lt;P&gt;Within my project, I have a custom tag format defined for the P&amp;amp;ID HandValve table.&amp;nbsp; Where do these format definitions get stored?&amp;nbsp; Are they in the P&amp;amp;ID database?&amp;nbsp; Project config file?&amp;nbsp; I can't seem to find this information anywhere.&amp;nbsp; Programmatically, how can I retrieve the individual subparts that make up a tag format definition?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-01-24 10_26_25-Tag Format Setup.png" style="width: 351px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/594799iE44E15A862072897/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-01-24 10_26_25-Tag Format Setup.png" alt="2019-01-24 10_26_25-Tag Format Setup.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 15:30:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/where-do-the-pnptagformat-definitions-get-stored/m-p/8546580#M23723</guid>
      <dc:creator>louwill</dc:creator>
      <dc:date>2019-01-24T15:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: Where do the PnPTagFormat definitions get stored?</title>
      <link>https://forums.autodesk.com/t5/net-forum/where-do-the-pnptagformat-definitions-get-stored/m-p/8547834#M23724</link>
      <description>&lt;P&gt;EDIT: Below is how to get the formats for Plant 3D, I'm not sure about P&amp;amp;ID.&lt;/P&gt;
&lt;P&gt;----------------------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;You can retrieve the tag formats with:&lt;/P&gt;
&lt;PRE&gt;Autodesk.ProcessPower.PnP3dTagUtil.PnP3dTagFormat.getTagFormatString(int &amp;lt;rowId&amp;gt;)&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;Autodesk.ProcessPower.PnP3dTagUtil.PnP3dTagFormat.getTagFormatString(string &amp;lt;className&amp;gt;)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 21:58:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/where-do-the-pnptagformat-definitions-get-stored/m-p/8547834#M23724</guid>
      <dc:creator>jabowabo</dc:creator>
      <dc:date>2019-01-24T21:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Where do the PnPTagFormat definitions get stored?</title>
      <link>https://forums.autodesk.com/t5/net-forum/where-do-the-pnptagformat-definitions-get-stored/m-p/8547891#M23725</link>
      <description>&lt;P&gt;Jason, thanks for the reply.&amp;nbsp; However, that method appears to be only looking at Plant 3D classes; I need the P&amp;amp;ID equivalent.&amp;nbsp; I found Autodesk.ProcessPower.TagFormats, but haven't figured out how it's used yet (or if that's even the correct class).&amp;nbsp; Any additional help would be greatly appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Will&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 22:12:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/where-do-the-pnptagformat-definitions-get-stored/m-p/8547891#M23725</guid>
      <dc:creator>louwill</dc:creator>
      <dc:date>2019-01-24T22:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Where do the PnPTagFormat definitions get stored?</title>
      <link>https://forums.autodesk.com/t5/net-forum/where-do-the-pnptagformat-definitions-get-stored/m-p/8548002#M23726</link>
      <description>&lt;P&gt;Our PnID app is home-brewed so I don't delve into that side of it much. This looks promising but I haven't tested:&lt;/P&gt;
&lt;PRE&gt;Autodesk.ProcessPower.ProjectManager.PnIdProject.GetTagFormats(string, bool)&lt;/PRE&gt;
&lt;P&gt;&lt;EM&gt;public override System.Collections.Specialized.StringCollection GetTagFormats(string strClassName, bool bIncludeInherited)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Member of Autodesk.ProcessPower.ProjectManager.PnIdProject&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 22:56:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/where-do-the-pnptagformat-definitions-get-stored/m-p/8548002#M23726</guid>
      <dc:creator>jabowabo</dc:creator>
      <dc:date>2019-01-24T22:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Where do the PnPTagFormat definitions get stored?</title>
      <link>https://forums.autodesk.com/t5/net-forum/where-do-the-pnptagformat-definitions-get-stored/m-p/8549661#M23727</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1636004"&gt;@jabowabo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Our PnID app is home-brewed so I don't delve into that side of it much. This looks promising but I haven't tested:&lt;/P&gt;
&lt;PRE&gt;Autodesk.ProcessPower.ProjectManager.PnIdProject.GetTagFormats(string, bool)&lt;/PRE&gt;
&lt;P&gt;&lt;EM&gt;public override System.Collections.Specialized.StringCollection GetTagFormats(string strClassName, bool bIncludeInherited)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Member of Autodesk.ProcessPower.ProjectManager.PnIdProject&lt;/EM&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Jason,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&amp;nbsp; I was able to get it working.&amp;nbsp; In the end it required disassembling PnPProjectManagerMgd.dll, but you pointed me in the right direction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For future reference, here's how anyone can retrieve the tag format for a given P&amp;amp;ID class and build a new tag based on an updated tag format.&amp;nbsp; Note the loop doesn't limit to a single or set of P&amp;amp;ID drawings, but this could be done easily by looking at the data links for a given drawing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// get pnid project
var pnidProject = PlantApplication.CurrentProject.ProjectParts.FirstOrDefault(p =&amp;gt; p is PnIdProject) as PnIdProject;
if (pnidProject == null)
    return;

// get pnid database
var pnpDatabase = pnidProject.DataLinksManager.GetPnPDatabase();

// get tag format name
var tagFormatName = pnpDatabase.Tables["HandValves"].GetTableAttributeValue("TagFormatName");

// get tag format (value = format definition defined in the class definition via project settings)
var tagFormat = pnidProject.GetTagFormat(tagFormatName, out var value, out var baseClass);

// get formattoolsutil instance (used to rebuild tags if desired)
var formatToolsUtil = new FormatToolsUtil();

// loop through hand valves
var pnpHandValves = pnpDatabase.Tables["HandValves"].Select().ToList();
foreach (var pnpHandValve in pnpHand)
{
    // get old tag
    var oldTag = pnpHandValve["Tag"];

    // get new tag
    var newTag = formatToolsUtil.RebuildTagValue(value, "", pnpHandValve.RowId, pnidProject.DataLinksManager);
}
&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Jan 2019 14:50:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/where-do-the-pnptagformat-definitions-get-stored/m-p/8549661#M23727</guid>
      <dc:creator>louwill</dc:creator>
      <dc:date>2019-01-25T14:50:06Z</dc:date>
    </item>
  </channel>
</rss>

