>||- Stuff & Things, its what we do…

Adventures in Plant 3D Land: Automating Iso Messages

If you are an avid keyboard user like me, then you probably share my contempt for the developers choice of mandating a dialog prompt for text entry on Plant 3D IsoMessages. I know it was a constant irritation of mine years ago when I was first using P3D. Especially since there were so many logical applications for standardized notes that could be made if they would just let me. Maybe I’m a pessimist for having so little faith in people (and myself) to be consistent, but I do think my personal experiences easily justify my dismal expectations of typical users.

Anyway, I recently had the misfortune of being subjected to that same anguish, but these days I am a much craftier automater. So, things have generally been going my way this time around and I will be talking about one of those many victories in this post.

During the course of this current project I’ve unfortunately had to dive VERY deep into the Plant SDK. Which is an absolute labyrinth and thankfully I am finally “caching on” to their philosophy. I still don’t like something this soupy and seemingly incoherent, but I will admit the crazy fast query of LineGroup data for the ENTIRE project is a pretty impressive byproduct of the choices they’ve made. Once I figured it out, it was a very small amount of code to export all the line group data to a csv, edit it in excel and put it back into the project database. I’ve done very similar tricks with CADmep, but it is a lot more messy and overhead intensive.

Having failed miserably with lisp years ago, one of my top agenda items this time around was automating the creation of standardize Iso Messages using the .Net API. I found almost no documentation in the SDK download and the only help the internet had to offer was some object Arx pseudo code that ultimately fell short of making a fully functional Iso Message Sphere. After a ton of ineffective web browsing and some deciphering of related code, I did gain fundamental insights on how these existed and related to other Plant objects. However, it was very disappointing to have my .Net attempt fail miserably like my lisp attempt did years before. I actually considered accomplishing my goal purely from post processing the PCF’s, but then I eventually picked up on the fact that numerous Iso Spheres derived from the same base class and set upon convincing a pig to act like a bull; which paid off!

The Iso Message, Floor Symbol, Insulation Symbol and Location Point all derived from the same .Net namespace of:

Autodesk.ProcessPower.PnP3dObjects.IsoSphereSymbol

I also discovered that IsoSphere’s were essentially being claimed by a LineGroup and other than that they literally weren’t associated to anything. So, after some prodding I found that they had an AutoCAD extension dictionary, that contained an X-Record, that contained data, that Plant 3D makes some pretty wild behavioral changes based upon. I am still not sure if the first SafeArray list in my code has rigid values, but I’ve had zero issues with the static values I extracted from an existing Iso Message; the documentation says these are declarations of dxf data types and you can see that if you entget the xRecord. However, the important thing is that the X-Record name determined the actual Sphere type and that the 2nd SafeArray (Data argument) did allow me to set the Message value, the Box type and whether it was dimensioned! What does this all mean? Well, with some some old school command lisp puppeteering of the PLANTISOADDINFO command we can build our IsoMessages from any of the other derived Sphere types that do not involve dialogs. Once it exists, then we just have to superimpose the desired data we want onto it.

Note: The PLANTISOADDINFO does not let you provide a point from code, I assume Plant 3D is using a specialized version of point selection user input due to its need of making a relationship between the sphere and a LineGroup. Based on what I know about the P3D’s API, you should want it doing this heavy lifting of object associations anyway. It is very fickle and these are truly paper thin relationships that are likely impossible to rebuild from lisp after the fact if it doesn’t make the proper decision upon creation. Please correct me if you find a way to associate a sphere after creation using lisp or Plant 3D commands. With this trick and my .Net background, I could pretty much fabricate these things from scratch using a block reference, but it’s quite ugly.

Probably more verbose than needed, but there just isn’t much information out there about these and I thought my process background would be a fine example of how I consistently manage to solve my real world problems. In the world of code, there really is no spoon. Enjoy the new utility…

2 thoughts on “Adventures in Plant 3D Land: Automating Iso Messages”

Nice! This can be done with .net also – the key is to create the required ports and connect them. Lot’s more code but you can add more functionality. Here’s how I do it for a Tie-In Point block that will insert a custom 3d block with an mleader that will also iso with a specific 2d block. This code is set to put the block on an existing piping component port but if you want to place it on pipe you will need to create a ‘TAP’ port to connect to – see example at end.

// Get the sphere block to insert at the iss point
ObjectId issBlockId = CreateTieInPointIssBlock();
if (issBlockId == ObjectId.Null)
{
AcadApp.ShowAlertDialog(“Error: Failed to get Tie-In Point blockId.\nPlease make sure you are in the World Coordinate System (UCS ‘W'”);
return ObjectId.Null;
}

// Find a component with port at selected point location
Dictionary partsPointsCoordsDict = MiscUtilities.GetPartPointsCoordsDict();
if (!partsPointsCoordsDict.ContainsKey(issPoint3d))
{
AcadApp.ShowAlertDialog(“Error: Could not get Tie-In Point location.\n\n Please verify the following:\n” +
” – You are in WCS.\n – You are choosing the node of a piping component.\n” +
” – You are choosing a component in the current drawing (not Xref).”);
return ObjectId.Null;
}

// Error if valid ObjectId not returned
if (issId == ObjectId.Null)
{
AcadApp.ShowAlertDialog(“Error: Could not get Tie-In Point location.\n\n Please verify the following:\n” +
” – You are in WCS.\n – You are choosing the node of a piping component.\n” +
” – You are choosing a component in the current drawing (not Xref).”);
}
return issId;
}

Thanks for pointing me in the right direction Jason. I will certainly dig into this when I have some time and see if I can combine it with some basic clash detection to auto-generate wall penetration tags.