×
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

Visual studio macro for CATIA
3

Visual studio macro for CATIA

Visual studio macro for CATIA

(OP)
Hello,

i'm starting to look to create macros for catia in visual studio. i have found some disadvantages already. Like only one session of catia should be running, the message box can stay behind of catia window.
My question is, there is any advantages of create macros in visual studio instead of creating them inside catia (CATVBA)?

RE: Visual studio macro for CATIA

(OP)
Looks impressive...

But all the functions of your vídeo can be made with vb6 inside CATIA.

From my research I can adress the following:
-Better vb editor
-You can create "special" toolbars. Better creation of forms.
-Easy to interact with other aplications
-higher code protection, you can delliver only *.exe files, instead of your code.
-the worst for me, only works fine with one CATIA session.

How do you manage several CATIA sessions?

Can you add more advantages/disadvantages?



RE: Visual studio macro for CATIA

(OP)
What do you mean with TST ?

RE: Visual studio macro for CATIA

Time Saving Toolbar ?

Eric N.
indocti discant et ament meminisse periti

RE: Visual studio macro for CATIA

Ferdo could you please upload an example of how to always bring input box/message box in front of Catia.Also facing this problem. I have found several examples over the Net but they all used with user form. I don't have any user forms.

RE: Visual studio macro for CATIA

Hi Jenial

If you already grabbed CATIA as COM object, use it for displaying messages

CATIA.MsgBox "Bla bla bla bla", 0, "Title", vbNullString, 0

cilici

RE: Visual studio macro for CATIA

In VS there's an option keep on top. Can't find the same in VB6. To do that thru coding will also be ok.

Ferdo TST link please.

RE: Visual studio macro for CATIA

(OP)
I'm trying to make a search for sketches in visual Studio. But i can't do it.

In vb6 i wrote

selection1.Search "((CATPrtSearch.Sketch + CATGmoSearch.Sketch) + CATSpdSearch.Sketch),all"

in visual studio doesn't work. Is it diferent?

RE: Visual studio macro for CATIA

Try that

Selection1.Search("CatPrtSearch.Sketch,All")

Works in VS2008

RE: Visual studio macro for CATIA

(OP)
Do you had the need to make public CatPrtSearch?

I'm out of the office now, but on monday morning I will try it.

RE: Visual studio macro for CATIA

(OP)
Ferdo,
I have download your app, and it looks amazing. I had'nt much time to test it but, it's impressive.

I'm starting to make an special app to help me in my daily job. I see that vb.net is slightly diferente from catvba. I'm used to catvba. but from my trials vb.net gives more freedom to make app.

Many thanks

RE: Visual studio macro for CATIA

(OP)
By the way. I have instaled the vs2017 rc. And it works with CATIA r26. I hope that i don't find any surprises.

RE: Visual studio macro for CATIA

(OP)
In my research I see that there are a lot of people using c# language to create their apps or macros. My question is why use c# to create them if in CATIA (catscript, or vb6) uses vb?.
What's the advantages?

Ferdo you have made your TST in wich language?

RE: Visual studio macro for CATIA

Hi,

Sorry for late response, I was out...

I used all versions up to VS2010 including, nothing after that. I'm using vb.net not C# just because is better supported in documentation and I can get more help from different communities. I would love to use C# also but I don't have time now to experiment different things.

You can have different surprises, new releases of VS are not yet supported by DS and there are a lot of changes also in newest releases of CATIA.

I already have some problems with VS2010 running different CATIA releases on my laptop (I have r19, r21, r25, v6r2013x and 3DEx 2017x on cloud) so don't be surprised....you can have also surprises coming from the OS...Win 10 is a little bit different from Win 7 bigsmile.

Regards
Fernando

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: Visual studio macro for CATIA

(OP)
I'm using windows 8 at the moment. I hope that doesn't appear any problems...

But what advantages do you see using c#?

I see that you allready tested it with 3d experience. Does it works in the same way?

RE: Visual studio macro for CATIA

TST is working only with v5 not with v6 or 3DEx. Is working on a laptop which has all those mentioned versions on him, latest installed is 3DEx 2017x. Multiple versions installed can create a lot of problems if you don't pay attention to this aspect.

To work with v6 or 3DEx you need to have another approach and again I didn't have so much time to do something with vb.net or VSTA as DS is recomanding (but I done in native CATIA programming tools).

I didn't say there are advantages (peoples have different opinions, pro or against, you can see on Internet this), I said that I would love to do it in C# just because it would be something new for me smile .

Regards
Fernando

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: Visual studio macro for CATIA

(OP)
Ok. Thanks for your tips.
I hope that in the next few days I have time to share what I'm working on. I have a lot of macro inside CATIA. Some of needs some atention in bug solving, anothers need an upgrade. So i'm trying to convert all macros in a APP, and rebuild some of those. Let's see what I cam build. I'm counting with your help😃.

RE: Visual studio macro for CATIA

(OP)
Ferdo, we have same in commom. We are not programmers, i'm also a designer who is bored by repetitive task, and also be fullished by my boss, for every day tell my team that we need draw faster...

RE: Visual studio macro for CATIA

(OP)
JeniaL, thanks.

It worked perfectly

RE: Visual studio macro for CATIA

(OP)
well my start is looking real painfull. I thought that the transition from the visual basic editor of CATIA to vb.net was easier.

So my problem.

I have mada a selection, from the search function, of parts. then i want to go throw them, and make the partbody in work object.

So I made the following.

Dim myBody As Body
For i = 1 To selection1.Count
part1 = selection1.Item(i).Value

myBody = part1.Bodies.Item("PartBody")
part1.InWorkObject = myBody

Next

and there is an error in, when i=1:

part1 = selection1.Item(i).Value

System.InvalidCastException: 'Unable to cast COM object of type 'System.__ComObject' to interface type 'MECMOD.Part'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{D402D912-39A4-11D1-A26C-0000F87546FD}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).'

any idea to solve this?




Tiago Figueiredo
Tooling Engineer

RE: Visual studio macro for CATIA

Selection.item().value doesn't match part1 object type. That's the error.

RE: Visual studio macro for CATIA

(OP)
Thanks cilici I have realized what you mean.

and finally it works :)

Many thanks
Tiago Figueiredo
Tooling Engineer

RE: Visual studio macro for CATIA

(OP)
Hello,

I've noticed that sometimes, that the API is slow. For example, With api, I'm opening an assembly, and after assembly opening, it runs update and after that is hiding all axis. And between all of this operations, it appears that there is some lag. Between catia is responding, I can make actions on it, and API looks that it's doing something but...

Tiago Figueiredo
Tooling Engineer

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