CoCreate User Forum

CoCreate User Forum (https://www.cocreateusers.org/forum/index.php)
-   Customization (https://www.cocreateusers.org/forum/forumdisplay.php?f=12)
-   -   visual studio and modeling (https://www.cocreateusers.org/forum/showthread.php?t=8217)

rvn 06-29-2015 12:16 AM

visual studio and modeling
 
Hi,

Does somebody know how to connect visual studio 2013/2015 with Creo elements direct modeling 18.1? DDE doesn't exist anymore in visual studio. Somebody has an idea and/or example to do this?

Thanks in advance

clausb 07-29-2015 12:45 PM

Re: visual studio and modeling
 
Sounds like an interesting project... what kind of integration are you looking for here?

Creo Elements/Direct Modeling provides full interop with COM (from Lisp), which may be exactly what you need in this case.

Claus

rvn 08-10-2015 06:22 AM

Re: visual studio and modeling
 
I want to talk to Modeling from an outside application. So I want to make a visual menu with buttons in visual studio and those buttons "do something" in Modeling.

clausb 08-16-2015 04:58 AM

Re: visual studio and modeling
 
What you are describing can indeed be accomplished using the COM/.NET API for Creo Elements/Direct Modeling. I feel a blog article coming up... ;-)

rvn 08-16-2015 10:04 PM

Re: visual studio and modeling
 
Where can I find some information about the COM/.NET API from modeling? I'm not familiar with all of this.

AtomicBee 11-08-2016 02:54 AM

Re: visual studio and modeling
 
Hi,
I've just joined this forum for the same purpose.
I would like to create a simple C++ external COM client to manage CoCreate assemblies/particular.
What I want to do is something like:
1) open a CoCreate assembly;
2) write inside it some properties (string, int, double, date);
3) save the assembly;
4) close it;
5) open it again;
6) read the properties I've written at step #2;
7) save/export the assembly as PDF
8) close the assembly.

By reading the CoCreate.OsdmObjects.chm document (provided during the software installation) I have issues at step #3.
What object have I to use to save the current opened model/assy/particular?
T&R,
AB

rvn 11-08-2016 10:41 AM

Re: visual studio and modeling
 
Hi AtomicBee,

I never got it to work this COM link. What I do now is the following:
I create a txt file in a temp folder and with cocreate I wait until there is a file in the temp folder. I read the file with lisp and then the cocreate actions can start.

Where do you want to save the assembly in, do you work with windchill, model Manager or something else?

Ruben

AtomicBee 11-09-2016 01:42 AM

Re: visual studio and modeling
 
Hi, tanks for your reply!
I'm not working with any PLM system, just my C++ console application and PTC Creo Elements/Direct Modeling 19.0.

Using both 'OsdmObjects.tlb' and 'OsdmServer.tlb' files and following the C++ example provided in the program SDK folder (obtained during the CAD Editor installation) I've implemented the following program.

Code:

int _tmain(int argc, _TCHAR* argv[])
{
    cout << endl << "- - - Start testing CoCreate - - - - - - -" << endl << endl;

    ::CoInitialize(0);
    {
        CComPtr<CoCreate::Osdm::IApplication> pIAppl;
        CComPtr<CoCreate::Osdm::IDocument3D> pIDoc; // Remarks Currently, the only available document type is Document3D.
        CComPtr<CoCreate::Osdm::IComponent> pIComp; // Base object for all entities that can be nodes of the 3D model structure tree: Assembly, CoordinateSystem, Part, WorkPlane
        CComPtr<CoCreate::Osdm::IComponentArray> pICompArr;

        _bstr_t fileToOpen = "c:\\temp\\aaaaa.pkg";

        // anything up to 13.20
        HRESULT hr = ConnectToOsdm(CoCreate::ServerType_Any, "16.0", 0, 0, &pIAppl);

        if (FAILED(hr))
            cout << "Not connected" << endl;
        else {
            cout << "Connected" << endl;

            pIAppl->LockUserInterface(); // to suspend the user editor interaction

            pICompArr = pIAppl->ILoadFile(fileToOpen);

            cout << "List of Components:" << endl;
            for (long int i = 0; i < pICompArr->Count; i++)
            {
                pIComp = pICompArr->GetItem(i);
                CoCreate::Osdm::LoadStatus s = pIComp->InqLoadStatus();

                cout << "\t" << i << ") " << pIComp->GetName() << "  - status: " << GetComponentStatus(s) << endl;
            }
           
            pIDoc= pIAppl->InqIActive3DDocument();
           
            // here I would like to Save aaaaa.pkg as bbbbb.pkg
            // something like: pIDoc->Save("c:\\temp\\bbbbb.pkg");

            pIAppl->UnlockUserInterface();  // to resume the user editor interaction
        }
    }
    ::CoUninitialize();

    cout << endl << "- - - Test ends - - - - - - -" << endl;
    system("PAUSE");
    return 0;
}

I don't know wich class/interface can be used to save the aaaaa.pkg as bbbbb.pkg ... reading the 'CoCreate.OsdmObjects.chm' document, which describes the CoCreate object model I haven't found useful info.

Any hint?
T&R,
AB

AtomicBee 11-09-2016 11:56 PM

Re: visual studio and modeling
 
By reading some threads on this forum I incurred into this thread...

Here the user calls the
Code:

Application->SendCommand()
method.
I think that this could be the key to solve my saving dilemma.
Now my question is:
where can I find a list of all available commands I can pass to the SendCommand() method? I mean, is there a booklet/web site/blog where all the available string commands are described?

T&R,
AB


All times are GMT -8. The time now is 07:37 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.