CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 06-29-2015, 12:16 AM
rvn rvn is offline
Registered User
 
Join Date: Mar 2011
Posts: 52
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
Reply With Quote
  #2  
Old 07-29-2015, 12:45 PM
clausb's Avatar
clausb clausb is offline
Registered User
 
Join Date: Nov 2002
Posts: 1,168
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
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/
Reply With Quote
  #3  
Old 08-10-2015, 06:22 AM
rvn rvn is offline
Registered User
 
Join Date: Mar 2011
Posts: 52
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.
Reply With Quote
  #4  
Old 08-16-2015, 04:58 AM
clausb's Avatar
clausb clausb is offline
Registered User
 
Join Date: Nov 2002
Posts: 1,168
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... ;-)
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/

Last edited by clausb; 08-16-2015 at 05:21 AM.
Reply With Quote
  #5  
Old 08-16-2015, 10:04 PM
rvn rvn is offline
Registered User
 
Join Date: Mar 2011
Posts: 52
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.
Reply With Quote
  #6  
Old 11-08-2016, 02:54 AM
AtomicBee AtomicBee is offline
Registered User
 
Join Date: Nov 2016
Location: Italy
Posts: 6
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
Reply With Quote
  #7  
Old 11-08-2016, 10:41 AM
rvn rvn is offline
Registered User
 
Join Date: Mar 2011
Posts: 52
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
Reply With Quote
  #8  
Old 11-09-2016, 01:42 AM
AtomicBee AtomicBee is offline
Registered User
 
Join Date: Nov 2016
Location: Italy
Posts: 6
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
Reply With Quote
  #9  
Old 11-09-2016, 11:56 PM
AtomicBee AtomicBee is offline
Registered User
 
Join Date: Nov 2016
Location: Italy
Posts: 6
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
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:57 PM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

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