×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Get the linked document from drawing view (Drafting)

Get the linked document from drawing view (Drafting)

Get the linked document from drawing view (Drafting)

(OP)
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

RE: Get the linked document from drawing view (Drafting)

Hi,

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

CODE --> CATScript

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

https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...

RE: Get the linked document from drawing view (Drafting)

(OP)
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

RE: Get the linked document from drawing view (Drafting)

(OP)
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

RE: Get the linked document from drawing view (Drafting)

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources