Continue to Site

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!

Macro to insert catalog part

Status
Not open for further replies.

TiagoFigueiredo

Industrial
May 22, 2013
497
I, I have created some PKT templates, and stored them in a catalog.

Now I want to add those PKT templates by using macros, and automate a few things, Like the inputs, save with the desired Part Number...

I have made a few searches, but didn't found anything relevant. But is it possíble to to add this products or parts stored in catalogs, by using macro?

Tiago Figueiredo
Tooling Engineer

Youtube channel:
 
Replies continue below

Recommended for you

Hello, have u tried recording your operations and "globalize" them?

Regards,
M
 
in "C:\Program Files\Dassault Systemes\B30\win_b64\code\bin\V5Automation.chm" search for "instantiate user feature"

regards,
LWolf
 
MKEdits said:
Hello, have u tried recording your operations and "globalize" them?

You mean, record macro? Yes I did, but the results of recording, didn't worked...

LWolf said:
in "C:\Program Files\Dassault Systemes\B30\win_b64\code\bin\V5Automation.chm" search for "instantiate user feature"

That's for user features and power copies, or there is something that i'm not seeing. I need for template insertion.

Tiago Figueiredo
Tooling Engineer

Youtube channel:
 
If there is no commands as a result of recording - those functions has no API, if there was something but only "didnt work"- you can paste lines of earned code here and we will solve it.

Regards,
M
 
I,

I have made the recording and here it's the result:

Code:
Sub CATMain()

Dim documents1 As Documents
Set documents1 = CATIA.Documents

Dim productDocument1 As ProductDocument
Set productDocument1 = documents1.Item("conj.CATProduct")

Dim product1 As Product
Set product1 = productDocument1.Product

Dim products1 As Products
Set products1 = product1.Products

Dim product2 As Product
Set product2 = products1.Item("0001.1")

Set product2 = products1.Item("0001.1")

product1.PartNumber = "conj1"

Dim partDocument1 As PartDocument
Set partDocument1 = documents1.Item("CATPart4.CATPart")

Dim product3 As Product
Set product3 = partDocument1.GetItem("0001")

product3.PartNumber = "00011"

Dim partDocument2 As PartDocument
Set partDocument2 = documents1.Item("CATPart6.CATPart")

Dim product4 As Product
Set product4 = partDocument2.GetItem("0002")

product4.PartNumber = "00021"

Dim productDocument2 As ProductDocument
Set productDocument2 = CATIA.ActiveDocument

Dim product5 As Product
Set product5 = productDocument2.Product

Set product5 = product5.ReferenceProduct

product1.PartNumber = "conj1"

product3.PartNumber = "00011"

product4.PartNumber = "00021"

Set product2 = products1.Item("0001.1")

Set product2 = products1.Item("0001.1")

End Sub

Just to make sure, that we are all talking about the same thing. This is similar to what I want to automate, but instead of having CATIA interface, having a macro, to automate a few other things, like rename the component.






Tiago Figueiredo
Tooling Engineer

Youtube channel:
 
I really like AutoIT better than native macros. Much more understandable and much more flexible. If you can do it with a keyboard and a mouse then you can do so with AutoIT.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor