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!

Get the linked document from drawing view (Drafting)

Status
Not open for further replies.

Maddy02

Mechanical
Feb 14, 2013
114
IN
Hi,
I've a view (generative view) linked to a product
Im trying to open this Product Document from the generated view.

Note: view is generated from one of the Enhanced Scene.

Product Tree Structure is as below:
|- Product
|- Part1
|
|
|-Applications
|- Scenes
|-Scene.1
When i use the following method it fails -
Set oLinkReferenceProduct = View.GenerativeBehavior.Document '--------> Works gives back the scene.1
Set oLinkReferenceProductParent = oLinkReferenceProduct.Parent '-----------> Gives Scenes Collection
Set oDocLinked = oLinkReferenceProductParent.Parent '-----------> ' Returns object i.e Technological object.
Set oDoc =oDocLinked.Parent '--------------------> Fails
or
Set oLink = oView.GenerativeLinks.FirstLink --------> Works gives back the scene.1
Set oLinkParent = oLink.Parent --------> Works gives back the Scenes
Set oLinkParentParent = oLinkParent.Parent ------> Gives back object i.e Technological object.

My question is how to get the parent document through view in this case?

Hope to get a valuable feedback on how to go ahead.

Regards,
Maddy
 
Replies continue below

Recommended for you

Hi,

Something like this (you need to have a drawing view activated, is not working for unfolded views) ?

Code:
Sub CATMain()

Dim drawingDocument1 As Document
Set drawingDocument1 = CATIA.ActiveDocument

Dim drawingSheets1 As DrawingSheets
Set drawingSheets1 = drawingDocument1.Sheets

Dim drawingSheet1 As DrawingSheet
Set drawingSheet1 = drawingSheets1.ActiveSheet

Dim drawingViews1 As DrawingViews
Set drawingViews1 = drawingSheet1.Views

Dim drawingView1 As DrawingView
Set drawingView1 = drawingViews1.ActiveView

drawingView1.Activate

Dim FullName
FullName =  drawingView1.GenerativeBehavior.document.ReferenceProduct.Parent.Fullname

Dim Box, Speicher As Long
MsgBox "Path and File:" & Chr (13) & Chr (10)  &  FullName  ,64, "LINKED TO"

End Sub

Regards
Fernando

 
Hi Ferdo

Thanks for reply,

Tried with you code but still getting the same error as earlier (attached error snap and links for reference).
Somehow i wasn't able to get the document link from the view so that i can open the document thro' macro.

Regards,
Maddy

 
 http://files.engineering.com/getfile.aspx?folder=17e42505-2622-44de-9a31-371090e706f2&file=Untitled.jpg
Hi Ferdo

Thanks for reply,

Tried with you code but still getting the same error as earlier (attached error snap and links for reference).
Somehow i wasn't able to get the document link from the view so that i can open the document thro' macro.

Regards,
Maddy
 
 http://files.engineering.com/getfile.aspx?folder=b941581a-fd13-412e-9672-a088cae9a277&file=Untitled.jpg
Hi,

Got the solution.

Upon restart both methods works and think some thing in memory was obstructing the method.

Set oDocLinked = drawingView1.GenerativeBehavior.document.ReferenceProduct.Parent '(Works when link points to model directly)

Set oDocLinked = drawingView1.GenerativeBehavior.document.Parent.Parent '(Works when link points to a Scene)

Sometimes mind gets nowhere.....

Regards,
Maddy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top