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!

Generate AllCatPart from Product (Vb.net)

Status
Not open for further replies.

elmundo777

Automotive
Jun 23, 2020
93
BY
Hello
I have a button on the vb.net form.
with its help I try to generate AllCatPart
But nothing happens, but some report menu is called up.
The code I use is below:
Code:
Dim actdoc As ProductDocument
actdoc = Catia.ActiveDocument
Dim MySel As Selection
MySel = Catia.ActiveDocument.Selection
MySel.Clear()
MySel.Add(actdoc.Product)
'CATIA.RefreshDisplay = True
Catia.StartCommand("Generate CATPart from Product...")

Perhaps something should be highlighted or transferred? Please tell me how to implement this correctly.
 
Replies continue below

Recommended for you

This command is literally 2 clicks away or pressing 3 buttons. What's the benefit of macroing it?
 
This is an example of a button. In fact, in the middle of a large cycle, she should make allcatparts from the list of products and then load them into one product.
The meaning of the question is still the same - the procedure for generating an allcatparts is not performed
 
Code:
Dim oBGRoot, oBGProd, sError
        Dim oProd2Part As DECPartToPart
        Dim oAllCatPart As part
        Set oBGRoot = CATIA.ActiveDocument
        Set oBGProd = oBGRoot.Product
        Set oProd2Part = oBGProd.GetItem("DECPartToPart")
        oProd2Part.SetOption ("KeepAnnotations")
        oProd2Part.Run
        sError = oProd2Part.GetError
        If sError <> "" Then
            MsgBox sError, 16, "Exception DECPartToPart. Aborting."
            Exit Sub
        End If
        Set oAllCatPart = oProd2Part.GetResult.part

regards,
LWolf
 
but in your case you should use
Set oProd2Part = oProduct.GetItem("DECProductToPart")

regards,
LWolf
 
com object error in line of code
Code:
oProd2Part.SetOption ("KeepAnnotations")
if i'm comment out this line the code works
Thank you
 
yeah, that's because I used the code for part-to-part conversion...and wanted to keep the annotations.
Something I havn't found any documentation for--just happened to guess right :) Others might find it useful...

regards,
LWolf
 

I found it very useful. I'm trying to find any documentation, without success so far.

It is a class which extends CATBaseDispatch.

So, there is no other way than late binding those lines of code.

Another piece of mystery to this, is where did you find the "KeepAnnotations" argument.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top