drafting catia

Bonjour

je suis débutante en macro , j'ai commencé à réaliser un macro déstiner au drafting, j'ai pu réaliser 2 vues (front and rignt riews) mais ca macro est pour un 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.000000, 0.000000, 1.000000
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
Dim double1
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

 

je veux l'adapter à un catproduct donc je change ce statement qui est souligné  par ça mais ça marche pas

Set product1 = productDocument1.GetItem("Product")

ça d'un coté d'un autre je veux réaliser une coupe (cut) de la vue de face je dois déclarer les coordonnées de la ligne comme suit

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

mais j'ai pas pu exploiter cette commande:

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

 

quelqu'un peut m'aider ?

merci d'avance

bonjour,

le code que vous mettez n'est pas complet, si vous souhaitez avoir de l'aide, mettez le code complet et les prérequis pour lancer le code ( par exemple être dans l'atelier drafting, avoir une part nommée "Part1" chargée dans catia, les bibliothèques de référence a charger dans vba si nécessaire)

Cordialement