Anyone tried to connect PHP to PDMWorks?
Any snippets to do the job will be highly appreciated.
Thanks in advance.SolidworksApi macros
Any snippets to do the job will be highly appreciated.
Thanks in advance.SolidworksApi macros

What exactly are you trying to achieve?
See thePHP COMclass.
My guess would be that you would need to instantiate a PDM COMobject, something along the lines of:
$conn = new COM("PDMWorks.PDMWConnection");$conn->Login("pdmwadmin", "pdmwadmin", "localhost");
{do stuff}
$conn = null;
thanks. i'm already running both PHP and PDMWorks on windows. and iwould like to access PDMWorks API with PHP so it can interoperatewith our current web-app. what we are trying to achieve is to getthe BOM of assembly drawings in the vault and use it in ourweb-app.
@Lee
thanks, i'm looking at PHP COM and was able to make the connectionyesterday... though we're still working on how to get the BOM.
Have you tried passing an array to the method?
$objArray = array();$vfileobj = $vobj->GetObjects($objArray);
After the method call you should have an array filled withEdmObjectInfo objects. You can then iterate over the array or justaccess it directly;
$objectInfo = $objArray[0];$objID = $objectInfo->moObjectID;
It's been years since I have used PHP so this will probably needsome tweaking, but hopefully it helps in some way.
thanks.
yes, i've tried passing an array() but i'm getting a "Caughtexception: Parameter 0: Type mismatch. "...
i really need to make this work.. else i won't be able to get thebom interfaces. (sigh)
$objArray = array();$v = new VARIANT( $objArray, VT_ARRAY );
$vfileobj = $vobj->GetObjects($v);
Lee Young wrote:
I'm grasping at straws on this one but try:
$objArray = array();
$v = new VARIANT( $objArray, VT_ARRAY );
$vfileobj = $vobj->GetObjects($v);
(hoping to give us more clue) i've also tried to add this line inmy PHP script...com_print_typeinfo($vobj);linkto PHP doc
and got the following result for the GetObjects() function:
/* DISPID=33 */
functionGetObjects(
/* VT_PTR [26] [in][out] --> VT_SAFEARRAY [27] */&$ppoObjects
)
{
/* method GetObjects */
}
Regarding your question, i'm running PHP as ISAPI. On theotherhand, you said you're getting a type mismatch error callingGetVersion(), I think you need to declare the $major and $minorvariables before you can use them as parameters for theGetVersion() function.
I hope you continue to help me work through this problem.