PHP COM script Set view, hide planes etc.

Hi all,I am working on a PHP script that is run on a localhost and communicates with the SE installation on the host computer. I do not have alot of visual basic knowledge but I did get the following actions to work: 1: open solid edge, close all open files, open the file to be edited: $se_app = com_get_active_object("SolidEdge.Application") or Die("SE is not running"); $se_app->Application->Documents->Close; $se_app->Application->Visible = 1; $objdoc = $se_app->Application->Documents->Open($loaddir."/".$motherpart);(file loaded is for example: L:/normcatalogusdelen voortgangsmap/000/175/000-175-001.par ) 2: edit the file properties, variables and material $prop = $objdoc->Properties("Custom"); $vars = $objdoc->Variables; foreach($index as $key){ if(in_array($key, $alphabet)){ $vars->Edit($key, $keys[$key][$counting]); }elseif($key == "Material"){ $ObjMattable = $se_app->GetMaterialTable; $ObjMattable->ApplyMaterial($objdoc, $keys[$key][$counting]); }else{ //$part = str_replace(".par", "", $file); $prop->Add($key, $keys[$key][$counting]); } }($index and $keys are arrays, they are specified in another part of the script, and aren't of any importance to my question.) 3: Save the file to another location $objdoc->SaveAs($newfilename); unset($objdoc); $se_app->Application->Documents->Close; unset($se_app);(newfilename is for example: L:/normcatalogusdelen voortgangsmap/000proc/COMDJ5101002/000-175-001.par ) The issues I am encountering right now are: 1: I need to set the view to ISO and fit the model. 2: I need to hide all planes, sketches, everything besides the model I did find two commands but I believe they are only sending a kind of keystroke to Solid edge, there has to be another kind of trigger like saveas right? this is what I found: $se_App->Application->Documents->Document->iglIsometricView;and $se_App->Application->StartCommand(partCommandConstants.partViewISOView);both aren't working no errors when I execute the first one though! so maybe I have to edit something about it? maybe use it on activedocument? If any of you have any idea how to hide all useless elements I'd be very grateful! Thanks!

 

Posted by: Bart Kodden
Post date: 1/5/2011 9:23:36 PM

6 REPLIES

RE: PHP COM script Set view, hide planes etc.

To make my script somewhat more clear.

It is a script to generate alot of parts by only modifying variables in a motherpart.

so: open the motherpart,

change variables and properties

save to another filename.

 

if you are interested in how I did that (It is working!) I might explain

 

Posted by: Bart Kodden
Post date: 1/5/2011 9:26:52 PM

RE: PHP COM script Set view, hide planes etc.

Fixed one thing:the isometric view was really simple, just by using the StartCommand(32810) functionbut now I have encountered another thing.all our files have to be saved shaded without edges and no dropshadow.especially the dropshadow is a problem right now because in the startcommand(45164) it's just a toggle. so If the mother-part has already been saved correctly, It will just kill that niceness...I will now look into the planes and shaded display and then my script will be completed!

 

Posted by: Bart Kodden
Post date: 1/6/2011 3:14:42 AM

RE: PHP COM script Set view, hide planes etc.

 

Can you give me a description on how to setup such an environment. I shortly have to generate several dozens of parts/drawings also and I'm very interested in the approach you have chosen ..

 

Posted by: Carol Veraa
Post date: 2/4/2011 2:27:09 AM

RE: PHP COM script Set view, hide planes etc.

CertainlyDid you want to know about the setup of my localhost or how the scripts internals work?The localhost server is running Apache with PHP as a module, and I start the httpd server with a command window in apache/bin

I've currently generated over 12000 parts from out of about 20 motherparts.works like a charm!Though I did not do anything with drawings I think it can be done in a similar way. Assemblies are a bit harder to edit on a server side script such as PHPbecause it has to poll the assembly each time and does not wait for a response.. (yet)

I do have a part of my Spherical bearing output though:

So what you see here is the part being loaded, the custom attributes being set (these are needed in our teamcenter installation)and then the variables being set, I used A to Z and every motherpart has to have all of these variables available.

If a part is in use or if the modeler encounters an error It will halt with an error message (doesn't look too awesome) But that is ok for something only I will be using...

Tell me if you want to know anything else!

 

Posted by: Bart Kodden
Post date: 2/4/2011 2:47:00 AM

RE: PHP COM script Set view, hide planes etc.

Looks we are neighbours; I'm supporting Remeha (Teamcenter and Solid Edge) only a few kilometers from your site 

 

Posted by: Carol Veraa
Post date: 2/4/2011 3:15:19 AM

RE: PHP COM script Set view, hide planes etc.

Haha that's awesome!I believe Remeha also works with the company called Bosch engineering right?If you need anything you can reply here or call the front desk of IHC Vremac so we can get in touch.Are you also filling you standard database or just adding some parts?Also, do you already know of the Add to Teamcenter tool?

 

Posted by: Bart Kodden
Post date: 2/4/2011 3:23:54 AM