Aller au contenu

Liste des feuilles d'une mise en plan


uisghe

Messages recommandés

Inventor 2017

 

Bonjour,

 

je travaille sur un plan qui a déjà une 30aine de folio (c'est le client qui veut un seul fichier :wacko: ).

 

J'aimerais faire une table qui appelle (automatiquement évidement, et que ça suive en cas de modif) le nom de chaque feuille et son n°.

 

Est-ce possible ?

Lien vers le commentaire
Partager sur d’autres sites

Avec ilogic ou VBA oui, maintenant j'ai pas le code sous la main, je vais regarder j'ai déjà fait un truc similaire pour des tables de contrôle de dimensions.

Affival SAS - Cored Wire and Wire Feeder for Steel Plant and Foundry Industry

Elficast - Cored Wire for Foundry applications

Autodesk Inventor 2014

Windows 7 64bits

LENOVO W530 - i7-3630QM@2.40GHz - 16Go RAM - QUADRO K1000M

Lien vers le commentaire
Partager sur d’autres sites

Bon c'est brut de décoffrage et faut adapter mais ça marche en VBA. Il faut créer une table dans les styles nommée "DrawingList" avec 2 colonnes

 

 

 


Public Sub DrawingListCreate()
   Dim oDwgDocument As DrawingDocument
   Dim oSheet As Sheet
   Set oDwgDocument = ThisApplication.ActiveDocument
   Set oSheet = oDwgDocument.ActiveSheet
   
   Dim oCustomTable As CustomTable
   Dim oCustomTables As CustomTables
   Set oCustomTables = oSheet.CustomTables
   'Contrôle si il existe déjà une table "DrawingList" et la supprimer si c'est le cas
   For Each oCustomTable In oCustomTables
       If oCustomTable.Title = "DrawingList" Then
       oCustomTable.Delete
       End If
   Next
       
   Dim oCellPageNumber As Cell
   Dim oCellDrawingNumber As Cell
   Dim oDrawingListDimensionCount As Integer
   oDrawingListDimensionCount = 0
   oDrawingListDimensionCount = oDwgDocument.Sheets.Count
   If oDrawingListDimensionCount > 0 Then
       Dim oColumnTitle(0 To 1) As String
       oColumnTitle(0) = "Column1"
       oColumnTitle(1) = "Column2"
       
       Dim oActiveTableStyle As TableStyle
       Dim oTableTitle As String
       Dim style As TableStyle
       Set oActiveTableStyle = oDwgDocument.StylesManager.TableStyles("DrawingList")
       oTableTitle = oActiveTableStyle.Title
       Dim oBorder As Border
       Set oBorder = oSheet.Border
       Dim dimX, dimY As Double
       dimX = oBorder.RangeBox.MinPoint.X
       dimY = oBorder.RangeBox.MaxPoint.Y
       Dim oFieldDrawingListTable As CustomTable
       Set oFieldDrawingListTable = oSheet.CustomTables.Add(oTableTitle, ThisApplication.TransientGeometry.CreatePoint2d(0, 0), UBound(oColumnTitle) + 1, oDrawingListDimensionCount, oColumnTitle)
       oDrawingListDimensionCount = 0
       Set oSheet = Nothing
       For Each oSheet In oDwgDocument.Sheets
           oDrawingListDimensionCount = oDrawingListDimensionCount + 1
           Set oCellDrawingNumber = oFieldDrawingListTable.Rows.Item(oDrawingListDimensionCount).Item("Column1")
           oCellDrawingNumber.value = oSheet.Name
           Set oCellPageNumber = oFieldDrawingListTable.Rows.Item(oDrawingListDimensionCount).Item("Column2")
           oCellPageNumber.value = oDrawingListDimensionCount
       Next oSheet
'        For Each oInspectionDimension In oSheet.DrawingDimensions
'            If oInspectionDimension.IsInspectionDimension Then
'                oInspectionDimensionCount2 = oInspectionDimensionCount2 + 1
'                oInspectionDimensionString = Replace(oInspectionDimension.text.text, "n", "Ø")
'                Set oCellInspectionDimensionItem = oFieldVerificationTable.Rows.Item(oInspectionDimensionCount2).Item("Column1")
'                oCellInspectionDimensionItem.value = oInspectionDimensionCount2
'                oInspectionDimension.SetInspectionDimensionData kRoundedEndsInspectionBorder, oInspectionDimensionCount2
'                Set oCellInspectionDimension = oFieldVerificationTable.Rows.Item(oInspectionDimensionCount2).Item("Column2")
'                oCellInspectionDimension.value = oInspectionDimensionString
'            End If
'        Next
       oFieldDrawingListTable.style = oActiveTableStyle
       Dim height, width As Double
'        Debug.Print oFieldVerificationTable.RangeBox.MaxPoint.X & "-" & oFieldVerificationTable.RangeBox.MinPoint.X
'        Debug.Print oFieldVerificationTable.RangeBox.MaxPoint.Y & "-" & oFieldVerificationTable.RangeBox.MinPoint.Y
       width = oFieldDrawingListTable.RangeBox.MaxPoint.X - oFieldDrawingListTable.RangeBox.MinPoint.X
       height = oFieldDrawingListTable.RangeBox.MaxPoint.Y - oFieldDrawingListTable.RangeBox.MinPoint.Y
'        Debug.Print width & "-" & height
       iPosition = 2
       Select Case iPosition
           Case 1 ' bas gauche
               dimX = oBorder.RangeBox.MinPoint.X
               dimY = oBorder.RangeBox.MinPoint.Y
               oFieldDrawingListTable.position = ThisApplication.TransientGeometry.CreatePoint2d(dimX, dimY + height)
           Case 2 ' haut gauche
               dimX = oBorder.RangeBox.MinPoint.X
               dimY = oBorder.RangeBox.MaxPoint.Y
               oFieldDrawingListTable.position = ThisApplication.TransientGeometry.CreatePoint2d(dimX, dimY)
           Case 3 ' haut droite
               dimX = oBorder.RangeBox.MaxPoint.X
               dimY = oBorder.RangeBox.MaxPoint.Y
               oFieldDrawingListTable.position = ThisApplication.TransientGeometry.CreatePoint2d(dimX - width, dimY)
       End Select
   End If
End Sub

 

Affival SAS - Cored Wire and Wire Feeder for Steel Plant and Foundry Industry

Elficast - Cored Wire for Foundry applications

Autodesk Inventor 2014

Windows 7 64bits

LENOVO W530 - i7-3630QM@2.40GHz - 16Go RAM - QUADRO K1000M

Lien vers le commentaire
Partager sur d’autres sites

  • 3 mois après...

Créer un compte ou se connecter pour commenter

Vous devez être membre afin de pouvoir déposer un commentaire

Créer un compte

Créez un compte sur notre communauté. C’est facile !

Créer un nouveau compte

Se connecter

Vous avez déjà un compte ? Connectez-vous ici.

Connectez-vous maintenant
×
×
  • Créer...

Information importante

Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookie, sinon nous supposerons que vous êtes d’accord pour continuer. Politique de confidentialité