×
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

Applying Macro to Document opened

Applying Macro to Document opened

Applying Macro to Document opened

(OP)
Hello All,

I have searched for responses thanks to the search tool, without success, so here my question.
I have also searched in Doc on line help.

I am trying to develop a macro, which basically, open 2D files, create unfolded view from 3D and save as with .dxf format.

For the moment, the macro is working for a particular 3D CATPart (name of the CATPart written in macro).

the next step is to make the macro working for active document.

My question is : How can I make the macro working on 3D active document ?

here below the code:

' =====================================================
' creation unfold view dans 2D
' =====================================================
'

Dim documents1 As Documents
Set documents1 = CATIA.Documents

Dim drawingDocument1 As Document
Set drawingDocument1 = documents1.NewFrom("C:\Temp\Drawings\ANSI_F.CATDrawing")

Dim drawingSheets1 As DrawingSheets
Set drawingSheets1 = drawingDocument1.Sheets

Dim drawingSheet1 As DrawingSheet
Set drawingSheet1 = drawingSheets1.Item("F1.1")

drawingSheet1.Activate     

Dim drawingViews1 As DrawingViews
Set drawingViews1 = drawingSheet1.Views

Dim drawingView1 As DrawingView
Set drawingView1 = drawingViews1.Add("AutomaticNaming")

Dim drawingViewGenerativeLinks1 As DrawingViewGenerativeLinks
Set drawingViewGenerativeLinks1 = drawingView1.GenerativeLinks

Dim drawingViewGenerativeBehavior1 As DrawingViewGenerativeBehavior
Set drawingViewGenerativeBehavior1 = drawingView1.GenerativeBehavior


Dim partDocument1 As Document
'Set partDocument1 = documents1.GetCurrentDocument
Set partDocument1 = documents1.Item("123456.CATPart") -------> part used for creation. How can I create a general application ? (by selecting the active document )

Dim product1 As CATBaseDispatch
Set product1 = partdocument1.GetItem("PartNumber")


Thanks for your help, and sorry in advance if this question has already been asked.

Best Regards,

Yann
 

RE: Applying Macro to Document opened

Catia.ActiveDocument

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