Reply
Solved! Go to solution

Export current document as STL and upload with HTTP post

Hey people!

 

I am currently working on an addin for solid edge which should export the current users projects as an STL file, temporarly save it locally to upload it through a http post request to a server.

 

Right now I am stuck in the first part. I set up a GUI button already, but doesnt have any functions. I love the addin.doc and SDK, since it helps me a lot but couldnt really figured out how to reference the current projects (for instance 3D model) the user is editing. Cause when the user presses the button, the current view (document) should be exported as a stl. Some suggestions? Does the framework has a method for exporting the models to stl and save it locally?

 

Thanks in advance, I am new to the API so I am currently working on understanding the infrastructure. If you have any advice or sketches that would be pretty awesome.

 

Greets, Bettina

8 REPLIES

Re: Export current document as STL and upload with HTTP post

I'll try to help but 1st I need to know what programming language you're targeting with your addin.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Export current document as STL and upload with HTTP post

To save as 3D file as .stl :

 

Application -> ActiveDocument -> SaveAs("NewFile.stl")

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Export current document as STL and upload with HTTP post

Thank you very much Jason!

I am working with your projects on codeprojects, they are very good I still have to study the API and SDK since its not that easy to understand the architecture in terms of which classes represent what kind of object (Unfortunatly I am more the visual learner..)

 

Also its kind of hard to figure out what exactly is the toolbar, edgebar, etc.. but I think thr fact that I never used SolidEdge before is the reason for that.

 

I want to do the addin in c++. It would be great if you give me some advice or hints.

 

Greets, bettina

Re: Export current document as STL and upload with HTTP post

Oh sorry, and I am currently using Visual Studio 2015.

Re: Export current document as STL and upload with HTTP post

  1. Read Solid Edge ST7 AddIn Architecture Overview on CodeProject.
  2. Read Solid Edge ST7 AddIn in C++ on CodeProject.
  3. Optionally, read Solid Edge ST7 AddIn EdgeBar in C++ on CodeProject.
  4. Watch How to configure Visual C++ 2013 for Solid Edge. Process should be sample for 2015.
  5. Download the Samples for Solid Edge on GitHub. Hint: Click the Download ZIP button. Extract and have a look at \Samples\AddIn\DemoAddIn\cpp\DemoAddIn.sln.

I already responded on how to save-as STL. Once you get your addin sinked to the ISEAddInEventsEx event set, you can respond to the button click in the OnCommand event. An example can be found in MyAddin.cpp on line 153.

 

Good luck!

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Export current document as STL and upload with HTTP post

Thanks Jason, I studying all your tutorials and they help me a lot!

 

Right now I am stuck with your suggestions two replies before.

You suggested: Application -> ActiveDocument -> SaveAs("NewFile.stl")

 

I tried: (In commands.cpp after pushing the commandbutton)

GetApplicationPtr()->ActiveDocument->

But in Active Document there isnt such a method as "Save as"

 

do you have other suggestions?

 

Thank you!

 

Solution
Solution
Accepted by topic author bschla
‎08-27-2015 07:00 AM

Re: Export current document as STL and upload with HTTP post

The ActiveDocument property returns a generic IDispatch pointer, so you will have to query the SolidEdgeDocument interface on it to access the SaveAs method.

This can be easily done in a single line, if you are using COM smart pointers in C++:

 

SolidEdgeDocumentPtr pSEDoc = pApp->GetActiveDocument();
pSEDoc->SaveAs("Newfile.stl");

Re: Export current document as STL and upload with HTTP post

I already solved it, with exact this solution. Thanks!