Drafting catia

Hello

I'm a beginner in macro, I started to make a macro destiner to drafting, I was able to make 2 views (front and rignt riews) but this macro is for a catpart


Set drawingView1 = drawingViews1.Add("AutomaticNaming")

Set drawingViewGenerativeLinks1 = drawingView1.GenerativeLinks

Set drawingViewGenerativeBehavior1 = drawingView1.GenerativeBehavior

drawingViewGenerativeBehavior1.SetGPSName "DefaultGenerativeStyle.xml"

Set documents1 = CATIA. Documents

'===============

strFilePath = CATIA. FileSelectionBox("Select part", "*. CATPart", 0)

If strFilePath = "" Then Exit Sub

Set partDocument1 = CATIA. Documents.open(strFilePath)

'===============
Set product1 = partDocument1.GetItem("Part1")
drawingViewGenerativeBehavior1.Document = product1
drawingViewGenerativeBehavior1.DefineFrontView 1.000000, 0.000000, 0.000000, 0.0000000, 0.0000000, 1.0000000
drawingView1.x = 1500
drawingView1.y = 420.500000
drawingView1.Scale = 1.000000
Set drawingViewGenerativeBehavior1 = drawingView1.GenerativeBehavior
drawingViewGenerativeBehavior1.Update
drawingView1.Activate
Set drawingDocument1 = CATIA. ActiveDocument
Set drawingSheet1 = drawingSheets1.ActiveSheet
Set drawingViews1 = drawingSheet1.Views
Set drawingView1 = drawingViews1.ActiveView
Set drawingViewGenerativeBehavior1 = drawingView1.GenerativeBehavior
Set drawingView2 = drawingViews1.Add("AutomaticNaming")
Set drawingViewGenerativeBehavior2 = drawingView2.GenerativeBehavior
drawingViewGenerativeBehavior2.DefineProjectionView drawingViewGenerativeBehavior1, catfrontView
Set drawingViewGenerativeLinks2 = drawingView2.GenerativeLinks
Set drawingViewGenerativeLinks1 = drawingView1.GenerativeLinks
drawingViewGenerativeLinks1.CopyLinksTo drawingViewGenerativeLinks2
drawingView2.x = 594.500000
drawingView2.y = 420.500000
Double Dim1
double1 = drawingView1.Scale
drawingView2.Scale = 1.000000
Set drawingViewGenerativeBehavior2 = drawingView2.GenerativeBehavior
drawingViewGenerativeBehavior2.Update
drawingView2.ReferenceView = drawingView1
drawingView2.AlignedWithReferenceView
Set specsAndGeomWindow1 = CATIA. ActiveWindow
Set specsViewer1 = specsAndGeomWindow1.ActiveViewer
specsViewer1.Reframe
specsViewer1.Reframe

End Sub

 

I want to adapt it to a catproduct so I'm changing this statement which is underlined  by that but it doesn't work

Set product1 = productDocument1.GetItem("Product")

On one side of the other I want to make a cut of the front view I have to declare the coordinates of the line as follows

Dim SectionProfile
ReDim SectionProfile(3)
SectionProfile(0) = -480.
SectionProfile(1) = 450.
SectionProfile(2) = 70.
SectionProfile(3) = 450.

but I couldn't use this command:

MyView.GenerativeBehavior. DefineSectionView SectionProfile, SectionView, Offset, 0, MyParentViewGB

 

Can anyone help me?

thank you in advance

Hello

The code you put is not complete, if you want to have help, put the complete code and the prerequisites to launch the code (for example be in the Drafting workshop, have a part named "Part1" loaded in catia, the reference libraries to load in vba if necessary)

Kind regards