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!

Catia Macro programming Help

Status
Not open for further replies.

Alan Lowbands

Aerospace
May 17, 2017
274
GB
Hi again,
I have recently needed some macro's or scripts and have managed to botch a few together, Frankenstien code made from bits of others I found here and on the web.
I would like to learn how to compile the odd thing myself and was hoping someone may be able to point me in the direction of some tutorials.
If anyone has a guide to how to use the information in the V5Automation file it would be a big help as I don't understand exactly what it is telling me :(
Sorry for being a bit thick
Any help would be greatly appreciated.

regards
Alan
 
Replies continue below

Recommended for you

Hi Alan,

In order to compile your code, you need to use another language than VBA or CATScrpit, the closest one would be VB.

So get MS visual studio and read some stuff like that

If you want to understand the chm file, you need to have more understanding on OO coding. Object Oriented in case you wonder. You can start with google or youtube (for easy access video). You should also be able to find many course online... (invest some time now)

now my question, why do you want to compile your code?

Eric N.
indocti discant et ament meminisse periti
 
Thanks for the reply.
Basically I would like to automate some boring tasks.
I work in tool design but much of the work is bringing drawings up to customer specifications.
Going over sometimes hundreds of drawings and changing how things like how a hole is dimensioned can be a bit monotonous and time consuming.
Even changing a dimension line type requires multiple mouse clicks so being able to write a little bit off code to do it with one or two could save me a lot of time.
And it looks interesting :)

regards
Alan
 
To change dimensions style you can use following command T:Dim*. Just enter this in the start command

Regards,
Jenia Ladkov
 
Thanks Jenia,
The problem I have is that I wouldn't know what a T:Dim start command looked like.
I have a lot to learn :)

regards
Alan
 
2017-06-13_8-32-26_gn8ale.png


Eric N.
indocti discant et ament meminisse periti
 
Thanks Itsmyjob,
Can you use that command inside vb script?
The only thing holding me up at the moment is changing a one part dimension line to 2 parts.
I've searched the web but come up with nothing
I did managed to botch together a bit of code to standardise some fastener parts. Just to save me the time filling in properties, adding an axis system, changing colour and material.
I think I'm going to enjoy learning this stuff :)

Regards
Alan
 
Hi Guys,
I've struggled with this now for about a week and haven't got any further.
The Automation help file is Double Dutch to me, I just don't understand what its telling me. I need a 'Dummy's guide to Automation help files'
Could someone give me a pointer with the 'changing a dimension line to 2-parts' problem I'm having.
It would be really appreciated.

I also found a macro that creates rough stock dimensions called 'e3roughStock'
Does anyone know if the code is available anywhere to see?
It seems to be encoded so I don't know if it is.

Thanks Gents

regards
Alan
 
plz contact radek for the source code

if the chm file is Double Ductch to you then go read VBA for Dummys, it won't take long before you can actually do something with CATIA script and the chm file.

please help me understand: changing a dimension line to 2-parts a picture could help (post using the upload image function plz)

Eric N.
indocti discant et ament meminisse periti
 
Hi itsmyjob,
Thanks for the reply,
I'll get a copy of VBA for Dummy's, I think I need it.
I'll also contact Radek and see if he will let me take a look at the code.

The 2-part dim line is basically the dimension reads horizontally.
I have attached a jpeg, cant see the upload image function? If you can point me to where it is ill upload it.

regards
Alan

 
 http://files.engineering.com/getfile.aspx?folder=f84f2508-840b-4bda-96a8-0d4a7b9c5d8e&file=2-part_dim_line.jpg
Code:
Dim myDim As DrawingDimension
Set myDim = CATIA.ActiveDocument.Selection.Item(1).Value

Dim myDimLine As DrawingDimLine
Set myDimLine = myDim.GetDimLine

myDimLine.DimLineGraphRep = catDimLine2Parts

within 2 minutes of reading the chm file...

Eric N.
indocti discant et ament meminisse periti
 
Thank you :)
I can take a hint and will be reading the VBA for Dummy's.

best regards
Alan
 
Hi again itsmyjob,
Last questions I hope.

I've been looking for VBA for Dummies but most of the ones I can see are saying VBA for Excell or other specific software.
Could you tell me the best one to get?
also
How can I get a message to Radek to see if he will let me take a look at the roughstock code.

your help has been much appreciated

regards
Alan
 
VBA for dummies will be with Excel... this book is here to give you some basic of VBA and the interface (and excel VBA knowledge can't hurt too much)

You can find book on catia programming if you search but I have the feeling this will do just as fine. What is in the other book is on this forum or the coe forum or some other web blog. no need more book.

for CATIA oriented question, check chm file or thread560-251808 and if you don't get it search the forum, if still in trouble ask the question here.

for general VBA question, search stackoverflow.com

Eric N.
indocti discant et ament meminisse periti
 
There's BASIC, Beginners' All-purpose Symbolic Instruction Code circa. 1964, that's been enhanced over the decades. Visual Basic is Microsoft's contribution to the Basic language. Visual Basic for Applications, also Microsoft, refers to the basic that is packaged in Microsoft applications like Word, Excel, Access, Power Point, Outlook. Each of these VBA's contain extensions of VB with object properties and methods that are only applicable to that application: Word has Document object properties and methods where Excel has Workbook object properties and methods; each with an application object model.

So there are things that an Excel VBA reference would have in common with a Word VBA reference and other things that it would not.

Finally, if you understand how VB works in general and you have some understanding of an application's object model and have access to a decent VB editor like the one in Excel and a HELP reference for your application's VBA, you can figure out how to program another application that you know very little about. For instance, from the Excel VBA editor, I've learned how to code for an Attachmate terminal emulator that interfaces a mainframe computer and also manipulate MS Project that I have a very rudimentary knowledge of.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Thanks for the reply, most of that went right over my head and hurt my tiny brain though :)

Had a dozen or so drawings today to tidy up.
Mostly missed dims and silly GD&T tolerances.
So I thought, I'll do some little scripts that change the contents of the GD&T box too what I want.
A few easy little scripts, one for dowel holes, one for clearance holes, one for surface tolerance. double click and presto the box is filled in.
Fell over at the first hurdle. Where the hell is the GD&T in the automation file.

I'm sure the person/persons that wrote that did it to annoy me.......................
I will find it if it kills me

alan :(

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top