I am developing custom electrical content in MEP2008, and my current mission is the automation of wire scheduling. Using a schedule table style driven by extended data stored in wire objects, I am able to have a schedule generate itself without any input from the user (that is except for one hurdle I am faced with). The problem I am struggling to overcome is to have automatic properties attached to wire objects that will grab the ID of the two devices that a wire is attached to, and store those ID's in the extended data of the wire.
To illustrate the problem in a very simple way, I've attached a drawing containing a wire that is connected to a receptacle at each end (via an MEP electrical connector snap). I've also attached a spreadsheet with some data extracted from the drawing using the "dataextraction" command. Of particular concern is the "ConnectedObjects" method contained in the wire, which has a return type of "Autodesk.Aec.Building.Elec.DatabaseServices.ConnectedObjects". The fact that the MEP snap maintains a connection between the wire and devices, and the fact that there is a ConnectedObjects method within the wire would lead me to believe that there is a very straightforward way of accomplishing what I need to. I've already prepared the extended data for wires, and just need to come up with some code to insert in the formula property that will grab the ID's of devices connected to a wire and stick those ID's in the "Device1" and "Device2" text properties.
My issue is that I am not familiar with writing VBScript, but it does appear that a formula property using VBScript just might be able to automatically extract the connection info for each wire and store that info back in the extended data of the wire. I would deeply appreciate any guidance that you guys could offer. I guess the biggest issue is whether VBScript in a formula property could actually call the ConnectedObjects method. I'm hoping some code guru's here could shed some light on the whole situation.


Reply With Quote