-1

I'm a Catia user very long time. I wrote some scripts. But I'm new to VB.NET.

I have a Powercopy which is you choose a spline, x, y, z and x - y plane. And you can change parameters.

How can I apply all of this to vb.net? In vba or script I make selections and I have forms and modules for adding textbox for entering value to parameters.

Imports System
Imports INFITF
Imports MECMOD
Imports PARTITF

Module Module1

    Sub Main()

        Dim catiaApp As INFITF.Application = GetObject(, "CATIA.Application")    
        Dim partDocumentDest As PartDocument = catiaApp.ActiveDocument    
        Dim partDest As Part = partDocumentDest.Part    
        Dim factory As InstanceFactory = partDest.GetCustomerFactory("InstanceFactory")
        factory.BeginInstanceFactory("SurfacicHoles","e:\tmp\PowerCopyReference.CATPart")
        factory.BeginInstantiate()
    
        Dim firstHole As Object = partDest.FindObjectByName("Point.1")
        Dim support As Object = partDest.FindObjectByName("Surface.1")
        Dim secondHole As Object = partDest.FindObjectByName("Point.2")
        factory.PutInputData("FirstHole", firstHole)
        factory.PutInputData("Support", support)
        factory.PutInputData("SecondHole", secondHole)
    
        Dim param1 As Parameter = factory.GetParameter("Radius1") param1.ValuateFromString("25mm")
        Dim param2 As Parameter = factory.GetParameter("Radius2") param2.ValuateFromString("15mm")
        Dim instance As ShapeInstance = factory.Instantiate() factory.EndInstantiate() factory.EndInstanceFactory()
        partDest.Update()
    
    End Sub
    
End Module

I tried some my code in vb.net but its gives errors and didn't connects to Catia.

djv
  • 15,168
  • 7
  • 48
  • 72
  • 1
    show your cataia script and what you tried in vb net, some sample data are needed also – nbk Aug 31 '23 at 12:59
  • I added a code for vb.net but I don't have any idea. – Yunus Mert AŞKIN Aug 31 '23 at 22:00
  • can you add also the errors you get as text please, when i copy your code it can not import INFITF or MECMOD or PARTITF and i can't find anything about tem on google – nbk Aug 31 '23 at 22:22
  • Your code seems to be OK. Tell us wich lines are in error. Don't forget to import your Catia references in your project. – Disvoys Sep 02 '23 at 09:10

0 Answers0