From Excel to SE_ST2

 

Hi all,

I am looking for a simple macro that will do the following:

- In the excel file I have column with SE file names!

I need two options /perhaps form with two radiobutton/

a) I want double click on the cell with SE file name and select/highlight par/asm/psm in SE asm!

b) Double click on the cell with SE file name and open that asm/par/psm in separate window inside active SE instance!

This should be fairly easy for someone familiar with SE API. Does something like the above already exist?

Excel portion could be double/right/single click mouse click or so... I can tweak that portion

Working app would be great or any quick sample/reference are greatly appreciated;

at the moment I just need something dirty that works/later I may dive into and learn more about SE API

VB6, .NET, CPP, anything?

P.S.

I am new to SE. I wrote that little app for SW, now that I switched to SE and need a little help!

Thank you,

Mike

 

Posted by: Mike Deja
Post date: 9/14/2010 3:04:37 PM

4 REPLIES

RE: From Excel to SE_ST2

 

I didn't quite get it totally right but it should get you going.  Selecting a cell causes the member to be selected in Solid Edge.  Double clicking causes the member to be opened in Solid Edge.

 

Posted by: Jason Newell
Post date: 9/14/2010 6:45:06 PM

RE: From Excel to SE_ST2

Hi Jason

It’s a cool little xls sheet you done there.

Just a small question- why is it highlighting (selecting in SE) just until the 3rd level in big asm and not any further? Is it possible it will highlight to the inner most level or is it problematic due to subocc?

 

good work anyway

Alon

 

Posted by: alon raviv
Post date: 9/15/2010 3:54:11 AM

RE: From Excel to SE_ST2

 

Because I'm not creating the SolidEdgeFramework.Reference correctly in the lower levels.  I ran out of time figuring it out and wanted to give you what I had.  SelectSet.Add() seems to have a rules engine of some sort that is not documented.  What I mean by that I initially assumed that it would have been good enough to put the Occurrence or SubOccurrence object in the SelectSet and it would have figured the rest out.  Well, that didn't work so I used my Solid Edge Spy app to figure out how Solid Edge GUI does it.  That's when I stumbled across the fact that it puts a Reference object into the SelectSet rather than Occurrence or SubOccurrence.  I toyed with the CreateReference API for awhile and got as far as I did.

If you have not done so already, download and install my free Solid Edge Spy.  Once it's installed, open up your assembly in Solid Edge and start Spy.  Once you're connected, you can easily browse the runtime COM object model.  As you select different members in PathFinder, switch over to Solid Edge Spy and look at the Application -> ActiveSelectSet -> Items -> Item(x).  I attached a screenshot.

Like I said, the key to the whole thing is getting the CreateReference() call right.  There is also a CreateReference2() call that can be used.

BTW, right click in Solid Edge Spy and turn on "Show Interface Names".

 

Posted by: Jason Newell
Post date: 9/15/2010 4:35:56 AM

RE: From Excel to SE_ST2

 

This could help:

I made this function for an interpart copy example that creates a reference in the top assembly for the body of a part that can be at any level inside any subassembly.  The purpose was to do a boolean between 2 parts anywhere and any level in an assembly. Just highlighting the reference you get in the function should be enough, although you might highlight not the body but the occurrence itself (i think so). Sorry for the format, i never paste code well...

Use it or modify it at your own risk.

Code is VB2005

Regards,

Julian

 

 'Creates a reference for a body in a suboccurrence that can be at any level. 'It's something like creating a reference of a refrenece of a reference...    Function crearTopASMRef(ByVal pSubOcc As SolidEdgeAssembly.SubOccurrence) As SolidEdgeFramework.ReferenceDim pOcc As SolidEdgeAssembly.OccurrenceDim pRef As SolidEdgeFramework.Reference'I use a loop to create a referennce from down to top 'First i create a reference of the body for the immediate parent. (The subassembly that contains that occurrence)pRef = pSubOcc.TopLevelDocument.CreateReference(pSubOcc.ThisAsOccurrence, pSubOcc.SubOccurrenceDocument.models.item(1).body) WhileTrue'Infinite loop 'I get a reference for the parent subassembly TrypSubOcc = pSubOcc.Parent Catch 'If there are no more subassembly parents, pOcc is an occurrence in the main assembly. We got up so we leave the looppOcc = pSubOcc.ParentpRef = pOcc.TopLevelDocument.CreateReference(pOcc, pRef) ExitWhile EndTry 'While pSubOcc is a SubOccurrence the ciorresponding reference is generatedpRef = pSubOcc.TopLevelDocument.CreateReference(pSubOcc.ThisAsOccurrence, pRef) EndWhile 'Return the referencecrearTopASMRef = pRef 'CleanuppSubOcc = NothingpOcc = NothingpRef = NothingGC.Collect()GC.Collect() EndFunction

 

Posted by: Julian Guillo
Post date: 9/15/2010 5:12:17 AM