0

Does anybody some experiences with inserting part to assembly in Catia 3DEXPERIENCE? No matter what language used. I'm just looking for some lead.

I have no problem to find or open the part from the database but I'd need to know how to insert this object into already opened product.

I'd be glad for any answer or tip.

My point is that I'd like to insert into assembly item found in the database for example from method like this:

    public DatabaseSearch SearchItemInDB(string searchString)
    {
        SearchService oSearchService = (SearchService)CATIA.GetSessionService("Search");

        DatabaseSearch oDatabaseSearch = oSearchService.DatabaseSearch;
        oDatabaseSearch.set_BaseType("VPMReference");
        oDatabaseSearch.AddEasyCriteria("V_Name", searchString);

        oSearchService.Search();

        return oDatabaseSearch;
    }

Thanks in advance.

Jiri

JMan
  • 60
  • 7
  • I'd be also glad even for a contact or recommendation to somebody who has some experience with macro programming in Catia 3DEXPERIENCE. – JMan Oct 20 '20 at 06:27
  • You may find it difficult to get help with this here. Instead, maybe try here while you wait for an answer: https://www.cadtutor.net/forum/search/?q=catia&quick=1 – braX Oct 20 '20 at 07:49
  • @braX thanks a lot for your advice. I'll give it a try – JMan Oct 20 '20 at 09:26
  • @braX I tried it and nothing usefull. This forum is mainly for AutoCad. But thanks – JMan Oct 20 '20 at 10:28
  • 1
    Well here's another possible resource - at least here you can ask about where you can direct your questions: https://www.facebook.com/shaakzscatiav5forum/ – braX Oct 20 '20 at 10:39
  • @braX Unfortunatelly I found a tons of information about macros for Catia V5 but there is no website about Catia 3DEXPERIENCE macros. This FB group is about V5 too. But there is too many differences between V5 and 3DEXP scripting especially in the field of assemblies and document itself. Main difference is that 3DEXPERIENCE is database based platform – JMan Oct 20 '20 at 13:41
  • Well, that's why I recommended you ask people there where to ask your questions that are specific to this. I mean, it's OK to ask here, but unfortunately you will not find that many people here have any experience with something so specific. – braX Oct 20 '20 at 13:48

2 Answers2

0

Try something like this in VB:

Public Function CopyPaste(ByRef MyInObj As AnyObject, ByRef MyOutObj As AnyObject)

    Dim MaSel As INFITF.Selection = CATIA.ActiveEditor.Selection

    '********************
    '* Copy file *
    '********************
     MaSel = CATIA.ActiveEditor.Selection
     MaSel.Clear()
     MaSel.Add(MyInObj)
     MaSel.Copy() 


    '**************
    '* paste file *
    '**************
    MaSel = CATIA.ActiveEditor.Selection
    MaSel.Clear()
    MaSel.Add(MyOutObj)
    MaSel.Paste()


End Sub

Be carefull : there isn't any error gestion

  • Thank you for your advice. This is not exact what I'd like to do. Yes, I can simply copy but I want to inser part into the assembly right after this item is found for example with method like this: – JMan Oct 23 '20 at 11:32
0

I really appreciate effort of people who contributed to this discussion. I came to the conclusion that it is not possible to insert item to the assembly directly from the database search and i did it by simple copying item from another editor.

        private Editor OpenProductAndGetEditor(DatabaseSearch oDBSearch)
    {
        PLMEntities cPLMEntititiesFound = oDBSearch.Results;

        if (cPLMEntititiesFound.Count > 0 && cPLMEntititiesFound.Count < 2)
        {
            oPLMEntityFound = cPLMEntititiesFound.Item(1);
            
            PLMOpenService oPLMOpenService = (PLMOpenService)CATIA.GetSessionService("PLMOpenService");


            oPLMOpenService.PLMOpen(oPLMEntityFound, out oFoundEditor);

            model.InfoAboutSearching = "Object found: " + oPLMEntityFound.get_Name();
            BItemFound = true;

        }
        return oFoundEditor;
    }

    private void CopyOpenedPart(Editor oEditor)
    {
        PLMProductService oProductService = (PLMProductService)oEditor.GetService("PLMProductService");

        VPMRootOccurrence oCompRootOccur = oProductService.RootOccurrence;

        Selection tempSel = oEditor.Selection;

        tempSel.Clear();
        tempSel.Add(oCompRootOccur);
        tempSel.Copy();
        tempSel.Clear();

        Window oCurrentWindow = CATIA.Windows.Item(2);

        oSel.Add(oVPMOccurSwitchboard);
        oSel.Paste();
        oSel.Clear();

        oCurrentWindow.Close();

    }

if anyone knows the solution to this topic, I will be happy to contact me.

Thanks

JMan
  • 60
  • 7