How to start 3DExperience API Automation in .NET environment?

Kulanthaivelu Deivaraj

How to start 3DExperience API Automation in .NET environment?

Hello All,

I'm new to this 3DExperience software environment. We are trying to develop an utility for our internal purpose using .NET Framework 4.0 and C# by using Visual Studio 2013 IDE and 3DEXPERIENCE R2018x.

So here, I would like to know the steps to be followed to starts with like, basic reference libraries, any library registration if required, Initialize methods etc.,

I tried following codes and library but I'm getting these errors:

  •  cannot create activex component...
  • An exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll but was not handled in user code
  • Additional information: Operation unavailable

Library Used: DassaultSystemes.INFITF.Interop

using C# :

object _objCatia = Marshal.GetActiveObject("CATIA.Application");

using VB.NET:

object  _objCatia = GetObject(, "CATIA.Application")

or

object  _objCatia = CreateObject("CATIA.Application")

Please let me know where I made a mistake here or to be done or if possible kindly add some sample project.

Note:

I couldn't able to see any registered COM libraries for 3DEXPERIENCE under add reference.

Thanks in advance,

Velu

Kevin Arnold

How to start 3DExperience API Automation in .NET environment?
(in response to Kulanthaivelu Deivaraj)
These are some of the ones I’ve used in VB.NET
Imports PLMModelerBaseIDL



Reference the VPMEditorContextIDLTypeLib.tlb

Imports ProductStructureClientIDL



Reference the VPMEditorContextIDLTypeLib.tlb

Imports VPMEditorContextIDL



Reference the VPMEditorContextIDLTypeLib.tlb

Imports CATPLMEnvBuild



Reference the PLMSessionBuilderTypeLib.tlb

Imports PLMAccessIDLItf



Reference the PLMAccessIDLItfTypeLib.tlb

Imports MachiningUse



Reference the MachiningUseTypeLib.tlb

Imports SimRepresentationTypeLib



Reference the CatSimRepIDLltf.tlb

Imports PLMSimulationTypeLib



Reference the PLMSimulationTypeLib.tlb

Imports CATSmInterfacesTypeLib



Reference the CATSmInterfacesTypeLib.tlb

Imports DRAFTINGITF



Reference the DraftingTypeLib.tlb

Imports CATANNOTITF



Reference the CATAnnotationTypeLib.tlb

Imports KnowledgewareTypeLib



Reference kweTypeLib.tlb

Imports PARTITF



Reference PartTypeLib.tlb

Imports HybridShapeTypeLib



Reference COM CATIA CATGSMIDLltf


Public CATIA As INFITF.Application
Public myPartDoc As MECMOD.PartDocument
Public oEditor As INFITF.Editor
Public myPart As MECMOD.Part
Public oVPMOccurrence As VPMOccurrence
Public oVPMRepOcces As VPMRepOccurrences
Public oVPMRepRef As VPMRepReference
Public myPartParams As KnowledgewareTypeLib.Parameters
Public myDocuments As INFITF.Documents

Dim ans As String
mySelection = CATIA.ActiveEditor.Selection
mySelection.Clear()
Me.Hide()

Dim myPartNam As String = ""
Dim filter(0)
filter(0) = "Part"
'do one selection

ans = mySelection.SelectElement2(filter, "Select the part, or select UNDO to cancel", True)
If ans = "Undo" Or ans = "Cancel" Then
MsgBox("You have chosen to cancel this operation. If this was a mistake please try again.")
Exit Sub
End If

myPart = mySelection.Item(1).Value
myPartNam = myPart.Name


From: Kulanthaivelu Deivaraj [mailto:[login to unmask email]
Sent: Tuesday, May 08, 2018 1:03 AM
To: [login to unmask email]
Subject: [3DEXPERIENCE Forum] - How to start 3DExperience API Automation in .NET environment?


Hello All,

I'm new to this 3DExperience software environment. We are trying to develop an utility for our internal purpose using .NET Framework 4.0 and C# by using Visual Studio 2013 IDE and 3DEXPERIENCE R2018x.

So here, I would like to know the steps to be followed to starts with like, basic reference libraries, any library registration if required, Initialize methods etc.,

I tried following codes and library but I'm getting these errors:

* cannot create activex component...
* An exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll but was not handled in user code
* Additional information: Operation unavailable

Library Used: DassaultSystemes.INFITF.Interop

using C# :

object _objCatia = Marshal.GetActiveObject("CATIA.Application");

using VB.NET:

object _objCatia = GetObject(, "CATIA.Application")

or

object _objCatia = CreateObject("CATIA.Application")

Please let me know where I made a mistake here or to be done or if possible kindly add some sample project.

Note:

I couldn't able to see any registered COM libraries for 3DEXPERIENCE under add reference.

Thanks in advance,

Velu

-----End Original Message-----

Kulanthaivelu Deivaraj

RE: How to start 3DExperience API Automation in .NET environment?
(in response to Kevin Arnold)

Thanks for your reply Mr. Kevin.

It helps me a lot to starts with but I found some error after added few libraries. Should I need to register or any action to be taken for the reference libraries. Please see the attached image.

Regards,

Velu

Attachments

  • Reference.PNG (11.3k)