Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual studio macro for CATIA 3

Status
Not open for further replies.

TiagoFigueiredo

Industrial
May 22, 2013
494
PT
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)?
 
Replies continue below

Recommended for you

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

- Romania
- EU
 
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?

 
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

- Romania
- EU
 
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😃.
 
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...
 
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
 
Selection.item().value doesn't match part1 object type. That's the error.
 
Thanks cilici I have realized what you mean.

and finally it works :)

Many thanks
Tiago Figueiredo
Tooling Engineer
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top