Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Attributes between documents

NachitoMax
Advisor

Attributes between documents

NachitoMax
Advisor
Advisor

hey

 

Quick question, if I assign attributes at part level like holes or edges, can they be identified in a drawing document?

 

If so, are there any examples?

 

 

Thanks

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Reply
Accepted solutions (1)
470 Views
3 Replies
Replies (3)

YuhanZhang
Autodesk
Autodesk

What do you want to do with the attributes?



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes

NachitoMax
Advisor
Advisor

Hi

 

in my current process, i am iterating through assembly parts. During this process i would like to identify any holes based on a set of conditions (size, type) and add an attribute to them. Then at the end of my process when the assembly is added to a drawing sheet, i would like to find the attributes that were added to the parts in the drawing sheet and add specific labels to them automatically along with dims between specific holes.

 

holes.jpg

So that i could a some leaders and populate the type of hole and also add chain dims between hole types

 

Thanks

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes

YuhanZhang
Autodesk
Autodesk
Accepted solution

Here is a VBA sample code to demonstrate how to get the model geometry with attribute from drawing and create a dimension on it, you need to prepare the data as mentioned in the code before running it:

 

Sub AnnotationOnSpecifiedHoles()
    ' Before running this sample, you should have a drawing document which has a drawing view that
    ' bases on an assembly document, and this assembly document has one part document in it,
    ' and the part has some hole features, and you should add attributes to some hole edges.
    
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oSheet As Sheet
    Set oSheet = oDoc.ActiveSheet
    
    Dim oView As DrawingView
    Set oView = oSheet.DrawingViews(1)
    
    Dim oRefAssy As AssemblyDocument
    Set oRefAssy = oView.ReferencedDocumentDescriptor.ReferencedDocument
    
    Dim oPart As PartDocument
    Dim oOccus As ComponentOccurrencesEnumerator
    
    Set oOccus = oRefAssy.ComponentDefinition.Occurrences.AllLeafOccurrences()
    
    Dim oOccu As ComponentOccurrence
    For Each oOccu In oOccus
        Set oPart = oOccu.Definition.Document
        
        Dim oAttMgr As AttributeManager
        Set oAttMgr = oPart.AttributeManager
        
        Dim oCol As ObjectCollection
        Set oCol = oAttMgr.FindObjects ' you can also specify the attribute value to search here.
        Debug.Print oCol.Count
        
        Dim i As Long
        For i = 1 To oCol.Count
            Dim oobj As Object
            Set oobj = oCol.Item(i)
            
            Dim oObjProxy As Object
            oOccu.CreateGeometryProxy oobj, oObjProxy
            
            Dim oCurves As DrawingCurvesEnumerator
            Set oCurves = oView.DrawingCurves(oObjProxy)
            
            If oCurves.Count > 0 Then
                Dim oCurve As DrawingCurve
                Set oCurve = oCurves.Item(1)
                
                Dim oPos As Point2d
                Set oPos = ThisApplication.TransientGeometry.CreatePoint2d(20, 12)
                
                Dim oIntent As GeometryIntent
                Set oIntent = oSheet.CreateGeometryIntent(oCurve)
                
                Dim oRadDim As RadiusGeneralDimension
                Set oRadDim = oSheet.DrawingDimensions.GeneralDimensions.AddRadius(oPos, oIntent)
            End If
        Next
        
    Next

End Sub

 



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.