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!

Applying Macro to Document opened

Status
Not open for further replies.

YannP

Computer
Nov 27, 2006
1
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
 
Replies continue below

Recommended for you

Status
Not open for further replies.

Part and Inventory Search

Sponsor