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!

Add new component 1

Status
Not open for further replies.

Santa123

Mechanical
Oct 2, 2006
80
PL
Hello,

I'v been trying to add new component to 3 Product of rootProduct, I do't know how to activate 3 Product. Plese give me some tips, I can't move on with my programming,


Sub CATMain()

Dim oDocuments As Dosuments
Set oDocuments = CATIA.Documents

Dim oProductDocument As Document
Set oProductDocument = oDocuments.Add("Product")

Dim oProduct As Product
Set oProduct = oProductDocument.Product

Dim oProducts As Products
Set oProducts = oProduct.Products

'Add a new products to the collection.
for i=1 to 5
Set oProduct = oProducts.AddNewComponent("CATProduct", ""&i)
next

'activate 3 Product to add new Product to it.
Dim activProduct As Product
set activProduct = CATIA.ActiveDocument.Product.Products.item(3)

'Add new component to Product
Set oProduct3 = activProduct.AddNewComponent("CATProduct", "BD")


'oProduct.item(2).ApplyWorkMode DESIGN_MODE
'set Dok = DokInst.ReferenceProduct.Parent
'activProduct.ApplyWorkMode DESIGN_MODE

End Sub


Best Regards
Santa
 
Replies continue below

Recommended for you

ufff, Done, Maybe this will be of some help for some very beginners like me :)

Sub CATMain()

Dim oDocuments As Documents
Set oDocuments = CATIA.Documents

Dim oProductDocument As Document
Set oProductDocument = oDocuments.Add("Product")

Dim oProduct As Product
Set oProduct = oProductDocument.Product

Dim oProducts As Products
Set oProducts = oProduct.Products

'Add a new products to the collection. This adds both a product reference and a product component.
for i=1 to 5
Set oProduct = oProducts.AddNewComponent("CATProduct", ""&i)
next

Dim newProduct As Product
Set newDocument =CATIA.ActiveDocument.Product.Products.item(3) ' Activate appropriate Product

Set oProduct = newDocument.Products.AddNewComponent("CATProduct", "new")

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top