Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

VBA Get the linked product's name of a drawing view based on a scene 1

Status
Not open for further replies.

Arpad_Jacso

Computer
Aug 22, 2019
14
Hi,

I would like to get the Product's name (e.g: Something.CATProduct) from a drawing view which generated from an enchanted scene.
I've tried the
oDrawingView.GenerativeLinks.FirstLink.Parent.Name 'which gives me "Scenes".

and also tried the
oDrawingView.GenerativeBehavior.document.Parent.Name 'which still gives me "Scenes".

oDrawingView.GenerativeLinks.FirstLink.Parent.Parent.Name or oDrawingView.GenerativeBehavior.document.Parent.Parent.Name doesn't work, it gives an error.

I also found ferdo's earlier reply for the same question:
oDrawingView.Activate
oDrawingView.GenerativeBehavior.document.ReferenceProduct.Parent.Fullname 'but is still gives me an error.

How the hell can I obtain the parent or the referenceproduct of the "Scenes"??
 
Replies continue below

Recommended for you

Hi.

You were on the right track.

In VBA use typed variable:

Code:
Dim prd as Product
set prd = oDrawingView.GenerativeBehavior.document.Parent.Parent
MsgBox prd.Name

In CATScript you can't simply "cast" to a type so use [tt]PspWorkbench.GetInterface[/tt]:

Code:
Dim psp ' as PspWorkbench
Dim doc: for each doc in CATIA.Documents
  if TypeName(doc) = "ProductDocument" then
    set psp = doc.Product.GetTechnologicalObject("PspWorkbench")
    exit for
  end if
next
Dim prd: set prd = psp.GetInterface("CATIAProduct", oDrawingView.GenerativeBehavior.document.Parent.Parent)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor