[API]: How to program the API with Visual C++?

Hi,

I am planning to use some of the objects in the Solidworks API in my standalone (.exe), programmed in Visual C++. But I am having trouble finding information on the subject. Can anyone point me in the direction of some information on programming the API from Visual C++ .Net?

The help files from SolidWorks doesn't give me all that information. I am also new to Visual C++ so the threshold for learning is a bit higher then usual.

Best regards Pål Eilertsen

Reply to
P?l
Loading thread data ...

I would suggest that you switch to VB rather than use C++. I say this because the learning curve, if you don't know C++ is pretty steep. With VB you can be up and running a lot faster. A lot of the detail work you have to do is done for your "in the background". Get a good begining book on VB or search for a good VB learning site (lots of them) and write a few programs. Then you can begin to approach writing for SW.

Yes, SW API information is not great. However, if you are an intermediate (or higher) level programmer there's enough there to thread together applications. From the little SW API programming I've done to date, the object model seems really convoluted. Maybe it's because of the way it's documented. I've done extensive applications interfacing to ACAD, Excel, Word, databases and other CAD systems. It might be a good idea for you to use VB and learn how to drive something like Excel first because the documentation is plentiful and the object model seems to be a lot cleaner than SW's. Armed with this experience you'll have a better understanding of what to do and where to go digging for what you'll need in SW.

-Martin

Reply to
Martin

Hi,

Thanks for the answer. I am actually quite fluent in VB.Net and also the API in general. Sorry for not mentioning this to start with.

I am moving another application to C++ and would like to connect to the SW API. Most examples I have come across assumes that I am programming an add-in and I am not.

Anyone that can help me still?

Best regards Pål Eilertsen

Reply to
P?l

Well, in general terms, you'd grab a reference to the application object and then the current document and go from there. I haven't done this sort of programming with SW, but that's how you'd write an external program that would drive something like Excel. I've written completely stand-alone programs this way that can fire-up Excel, open a workbook, iterate through the sheets, gather data, etc. I think this is the sort of thing you are trying to do with SW, right?

-Martin

Reply to
Martin

Hi,

Well yeah, pretty much! I am creating an application that finds edges in medical CT images. Then I would like to insert thes edges/splines into SW and then loft then into a solid.

It is a lot of complicated code and I am just starting. What you are sugesting is what I have been doing for a year now. I quess my problem lies more in the C++ part, How do one connect to SW through C++? COM or OLE and so on.

Best regards Pål Eilertsen

Reply to
P?l

OK, it wasn't very clear from your original post that you had any experience at all either programming or using SW. My apologies for suggesting things that may have been obvious to you.

I guess I'm still not very clear on what your specific question may be. Have you used C++ in the past to externally control any program at all. Forget SW for a moment. In other words, is your question about how to go about implementing the "reach out and control program X" functionality? Or, do you know how to do that and can't figure out what "buttons" to push within SW to make the connection and drive it externally?

I don't quite know the answer to #2, but I'll help you research this as I am sure I'll need to do similar work very soon.

Silly question...have you tried SW support?

-Martin

Reply to
Martin

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.