Reply

Document Superclass?

[ Edited ]

I'm pretty new to developing with the SE V19 API so I wanted to make sure there wasn't a class I was simply overlooking here. Is there a generic document superclass that can be used for call common to all the document types (e.g. Close, Save, GetProperties, GetFileName, etc.)? I do not know of any other way around duplicating the DocumentTypeConstants switch to make the same call on a varying object type.

 

Posted by: Adam Brenneis
Post date: 1/25/2007 7:39:52 AM

9 REPLIES

RE: Document Superclass?

[ Edited ]

Hi Adam and welcome.

 

See SolidEdgeFramework.SolidEdgeDocument. All Solid Edge COM Document's support this interface. See example code.

 

Dim objApp as SolidEdgeFramework.Application

dim objDocument as SolidEdgeFramework.SolidEdgeDocument

Dim objAssembly as SolidEdgeAssembly.AssemblyDocument

 

 

' Assuming we have an Assembly open in Solid Edge

 

'These all should work.

Set objDocument = objApp.ActiveDocument

Set objAssembly = objApp.ActiveDocument

 

Set objDocument = objAssembly

Set objAssembly = objDocument

 

Let me know if you still need help.

 

Posted by: Jason Newell
Post date: 1/25/2007 7:45:03 AM

RE: Document Superclass?

[ Edited ]

This is definately the right direction. I'm not entirely sure how your VB example would map to C++. I have seen some examples here and there of creating objects using the "SolidEdgeFramework.AssemblyDocument" type syntax. I don't quite understand how to give the compiler a class that can accept Parts, Drafts, and Assemblies and allow the common calls to pass through to the proper type.

 

I'm working with a VS6 project created by the wizard included with V19. The only API classes I'm aware of are those defined in the framewrk.tlh

 

Posted by: Adam Brenneis
Post date: 1/25/2007 8:13:09 AM

RE: Document Superclass?

[ Edited ]

C++ ??? Why didn't you say so .

 

That's my favorite language right now. I can definately help you but it will have to be later tonight. I don't have VC++ 6 but I do have VC++ 2005. It should be close enough that I can give you an example.

 

Posted by: Jason Newell
Post date: 1/25/2007 8:19:42 AM

RE: Document Superclass?

[ Edited ]

Thank you very much for your help so far. Your respones are really much faster than I expected.

 

I did attempt to convert the wizard generated project to VS 2K3, but it proved to be more trouble than I wanted to deal with. Perhaps I should try to import the type libraries manually rather than using the wizard?

 

Posted by: Adam Brenneis
Post date: 1/25/2007 8:26:45 AM

RE: Document Superclass?

[ Edited ]

So you have VC++ 2003? That's a good thing.

 

What type of application are you trying to write? .exe or .dll. ATL or MFC. Are you trying to write an AddIn? I can pretty much help you with whatever you're trying to do.

 

Posted by: Jason Newell
Post date: 1/25/2007 8:39:12 AM

RE: Document Superclass?

[ Edited ]

I'm writing an addin DLL that starts and communicates with a Java application. The DLL asks the java to perform a particular task and the Java application will in turn ask the DLL for information to help it carry out the task.

 

After poking around in the type libraries manually I think I've found the SolidEdgeDocument class you were referring to. So now I'm wondering why the VS6 wizard did not create the class for me?

 

Posted by: Adam Brenneis
Post date: 1/25/2007 8:51:16 AM

RE: Document Superclass?

[ Edited ]

Apparently SolidEdgeDocument was imported into my project, I've just been overlooking it (Doesn't show up anywhere in my API chm either, so that didn't help). This class should work perfectly. Thanks for your help Jason.

 

Posted by: Adam Brenneis
Post date: 1/25/2007 9:03:38 AM

RE: Document Superclass?

[ Edited ]

Adam,

 

I replied to your "Custom menu" post with a lot of details and examples. Hopefully that will help.

 

Regarding the API documentation, . Don't get me started.

 

I also wanted to mention Smart Pointers (they are a good thing). Not sure if you're familiar with that term or not. Google on it for more details. You can immediately recogize a Smart Pointer because it will have "Ptr" appended to the class name. i.e.

 

ApplicationPtr pApplication;

SolidEdgeDocumentPtr pDocument;

 

You can see my example code in the other post for details.

 

One other thing. VS intellisense is known for not updating very well. What I usually do is a "Clean Solution", close the solution and then delete the .ncb. When you open the solution again, VS will recreate the intellisense database. I invoke intellisense by typing CTRL + Spacebar. Then type SolidEdgeFramework:: and you should start seeing the type library definitions.

 

Posted by: Jason Newell
Post date: 1/25/2007 10:43:35 AM

RE: Document Superclass?

[ Edited ]

Yes the smart pointers are awesome, especially for someone as unfamiliar with COM as myself. I surely would have been lost in all the addrefs and releases. They're the main reason I've stuck with project the wizard generated for me rather than try to make one manually.

 

Thanks again for all your help.

 

Posted by: Adam Brenneis
Post date: 1/26/2007 1:14:17 AM