AutoCAD P&ID / Plant3D - Accessing Project & Document Custom Properties

AutoCAD P&ID / Plant3D - Accessing Project & Document Custom Properties

jmdamasoQHC5V
Explorer Explorer
459 Views
1 Reply
Message 1 of 2

AutoCAD P&ID / Plant3D - Accessing Project & Document Custom Properties

jmdamasoQHC5V
Explorer
Explorer

In AutoCAD P&ID/Plant3D, the Project Setup, General Settings you can create both Custom Categories & Custom Properties under Project Details (for Project level custom properties) and Drawing Properties (for drawing/sheet level custom properties.)   

 

The problem is, Autodesk has not provided the ability to set a default value for Drawing Properties, so all custom drawing properties are created as Null.  When these properties are inserted into a sheet as a Field (Insert->Field->CurrentDWGCustom) they then display as ####, which is undesirable.   Some of the fields will be normally null (like parts of the revision history.)  What I would like to do is create a LISP command that loops through my custom properties, and if the value is null, then insert a non-printing character (ALT+0160).  Every time I create a new sheet from template, I can execute the command to set default values.

 

I cannot seem to find any reference information / examples of how to access these properties using LISP.   Note that this is AutoCAD P&ID/Plant3D and creating these properties does not make them available in the SummaryInfo object.

0 Likes
Reply (1)
Message 2 of 2

skahle89
Explorer
Explorer

If you have a Multi-User installation using MS SQL Server:

 

0) CAUTION:  You can corrupt your project database if you make mistakes.  I strongly suggest finding someone with SQL Server management experience, and test this procedure on a non-production project. 

1) Close AutoCAD Plant3D/P&ID

2) Open Microsoft SQL Server Management Studio (SSMS)

3) Login / Connect to the SQL Server hosting your Plant3D Project (may need to work with IT to get elevated SQL Server privileges for your user account.)

4) Navigate to the database:  ProjectName_PnID

5) Navigate to the table: dbo.PnPDrawings, Right Click and "Select Top 1000"

This will automatically generate you a SELECT TOP (1000) query

Replace this query with the following code, modifying the fields in brackets to match your document properties. Use the Microsoft Intellisense to make sure you are getting the correct names.

Make as many update queries as necessary to update all of our custom properties.

Save the query somewhere for future use.

Execute the query against the dataset.

Review the results of the SELECT statement and verify the update was successful.

 

--Update Null Fields with Non-Breaking Space Character
UPDATE PnPDrawings SET [Property Category_Property Name1]=CHAR(160) WHERE [Property Category_Property Name1] IS NULL

--Select the custom drawing properties of interest to display
SELECT [PnPDrawingGuid]
      ,[PnPType]
      ,[Dwg Name]
      ,[Property Category_Property Name1]
      ,[Property Category_Property Name2]
      ,[Property Category_Property Name3]
      ,[Property Category_Property Name4]

  FROM [ProjectName_PnId].[dbo].[PnPDrawings]
  WHERE [PnPType] = 'DWG'

 

 

6) You would think that Autodesk would have built in some kind of command to force a sync from SQL Database to AutoCAD Plant3D/P&ID Model, but it's currently not that simple:    

  • Completely close your project and all instances of AutoCAD Plant3D
  • Find the utility: PnPLocalDataCachePurger.exe located at C:\Program Files\Autodesk\AutoCAD 20xx\PLNT3D
  • Execute the utility to purge the local AutoCAD Plant3D Cache
  • Re-Open your Project, Connect to SQL Database, Open one of your drawings and voila!

If you don't do Step #6, you're Custom Drawing Properties will not reflect the change made via MS SQL Management Server update queries and the SQL data will revert if a user saves the drawing.  You must force AutoCAD to purge its cache and force Plant3D to sync to the SQL Server values. 

 

This is probably also possible using the AutoCAD Plant3D SDK, but that will require knowledge of Visual Studio and .NET development in C#.    

 

0 Likes