×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

CATIA V5 and using VB6

CATIA V5 and using VB6

CATIA V5 and using VB6

(OP)
Can anyone tell me if you can use VB6 within CATIA V5?  Natively it uses VBA which does not appear to use PropertyBag's.

If you can use VB6 within CATIA V5 then how do you do this?

Thanks

RE: CATIA V5 and using VB6

I prefer to use late-binding with VB6 and Catia. Although it is supposed to run slower, you'll find that it is Catia that runs slow and you won't notice the difference between early-binding and late-binding. If these terms are new to you they are covered in the VB docs, so you should read up on them.

The other advantage of late-binding is that you do not need to recompile code between Catia releases, unless the functionality that you are using has changed.

So, with late binding...

'In a module declaration section:
Global CATIA As Object

Then something like this:

Public Function GetCatia() As Boolean

    GetCatia = False
    If QUIT = False Then
        If CATIA Is Nothing Then
            On Error Resume Next
            Set CATIA = GetObject(, "CATIA.Application")
            If Err.Number <> 0 Then
                msg = "Cannot find Catia. Please start Catia and then run the application."
                msg = msg & vbCrLf & "Do you want to quit?"
                res = MsgBox(msg, vbCritical + vbSystemModal + vbYesNo, "Cannot find Catia")
                If res = vbYes Then
                    QUIT = True
                End If
            Else
                GetCatia = True
            End If
        Else
            GetCatia = True
        End If
    End If
    
End Function


If you want to use early binding you can find more information in the on-line documentation. See
V5Automation.chm in the bin directory of your Catia path for more information.

Andy

RE: CATIA V5 and using VB6

(OP)
So basically, you are using VB6 to run CATIA if it is not running like any other program (I've used VB6 to run Word and Excel and Access before) and then controlling it with VB instead of CATIA controlling VBA.

Sounds good, thanks for the clear post with code. Code always helps!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources