selection des corps dans mise en plan avec vba

bonjour,

 

je suis toujours sur mon parametrage d'assemblage, et je touche presque au but. il me manque un petit element.

pour terminer mon projet, j'ouvre une mise en plan, et je lui demande de me positioner des vues de plusieurs pieces. jusque la tou va bien, sauf que je tombe sur une piece avec 2 corps, et je souhaite avoir une vue de mon premier corps en déplié, et une vue de mon second corps.

voici un exemple de ma procedure pour recuperer les vues.

Set swModel = swApp.OpenDoc6("Z:\MACHINE\CONFO\0 confo ORIGINE 3D\Tolerie confo ORIGINE.slddrw", 3, 0, "", longstatus, longwarnings)     'ouvre un fichier plan
    Set Part = swApp.ActiveDoc
    
    Set myModelView = Part.CreateDrawViewFromModelView2("Z:\MACHINE\CONFO\" & Range("d1").Value2 & " embase.sldprt", "*Dessus", 0.33, 0.68, 0)
    boolstatus = Part.ChangeRefConfigurationOfFlatPatternView("Z:\MACHINE\CONFO\" & Range("d1").Value2 & " embase.sldprt", "Défaut")

    Set myModelView = Part.CreateDrawViewFromModelView2("Z:\MACHINE\CONFO\" & Range("d1").Value2 & " aile.sldprt", "*Face", 0.33, 0.43, 0)
    boolstatus = Part.ChangeRefConfigurationOfFlatPatternView("Z:\MACHINE\CONFO\" & Range("d1").Value2 & " aile.sldprt", "Défaut")

    Set myModelView = Part.CreateDrawViewFromModelView2("Z:\MACHINE\CONFO\" & Range("d1").Value2 & " couloir.sldprt", "*Face", 0.33, 0.18, 0)
    boolstatus = Part.ChangeRefConfigurationOfFlatPatternView("Z:\MACHINE\CONFO\" & Range("d1").Value2 & " couloir.sldprt", "Défaut")

    Set myModelView = Part.CreateDrawViewFromModelView2("Z:\MACHINE\CONFO\" & Range("d1").Value2 & " couloir.sldprt", "*Face", 0.95, 0.68, 0)
    'boolstatus = Part.ChangeRefConfigurationOfFlatPatternView("Z:\MACHINE\CONFO\" & Range("d1").Value2 & " couloir.sldprt", "Défaut")

    Set myModelView = Part.CreateDrawViewFromModelView2("Z:\MACHINE\CONFO\" & Range("d1").Value2 & " renfort embase.sldprt", "Etat déplié", 0.95, 0.43, 0)
    boolstatus = Part.ChangeRefConfigurationOfFlatPatternView("Z:\MACHINE\CONFO\" & Range("d1").Value2 & " renfort embase.sldprt", "Défaut")

la piece concernée, est celle avec couloir.sldprt.

 

cordialement.

Bonjour, Pour masquer un corps on peut utiliser la méthode display3 de l'interface ibody2. Il faut au préalable énumérer les corps avec enumbodies2
Bonjour, Pour masquer un corps on peut utiliser la méthode display3 de l'interface ibody2. Il faut au préalable énumérer les corps avec enumbodies2

merci de l'info, mais comment puis je integrer ces instructions?

 

cordialement.

j'ai reussi en ouvrant la piece avec une config precise, et en ajoutant ma vue

boolstatus = Part.Extension.SelectByID2("Z:\MACHINE\CONFO\" & Range("d1").Value2 & " couloir.sldprt", "CONFIGURATIONS", 0, 0, 0, False, 0, Nothing, 0)
    boolstatus = Part.ShowConfiguration2("corps_couloir")
    Set myModelView = Part.CreateDrawViewFromModelView2("Z:\MACHINE\CONFO\" & Range("d1").Value2 & " couloir.sldprt", "Etat déplié", 0.45, 0.18, 0)
    boolstatus = Part.ChangeRefConfigurationOfFlatPatternView("Z:\MACHINE\CONFO\" & Range("d1").Value2 & " couloir.sldprt", "corps_couloir")

1 « J'aime »