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

Check part description fx linked or not

k14348
Advocate

Check part description fx linked or not

k14348
Advocate
Advocate

Hi,

    I have a main assembly with 10 No. of parts. I would like to check all 10 Parts description starts with = or not. If Description not starts with = sign then i need that file name list.

 

Thanks,

Karth

 

0 Likes
Reply
Accepted solutions (1)
533 Views
4 Replies
Replies (4)

JelteDeJong
Mentor
Mentor

you can try this.

Dim notLinkedList As String = ""
Dim AssDoc As AssemblyDocument = ThisDoc.Document

For Each doc As Document In AssDoc.ReferencedDocuments
    Dim oPropSets As PropertySets = doc.PropertySets
    Dim oPropSet As PropertySet = oPropSets.Item("Design Tracking Properties")
    Dim oPartNumiProp As Inventor.Property = oPropSet.Item("Description")
    If (oPartNumiProp.Expression = Nothing) Then
        notLinkedList = notLinkedList + doc.FullFileName + System.Environment.NewLine
        Continue For
    End If
    If (oPartNumiProp.Expression.StartsWith("=") = False) Then
		notLinkedList = notLinkedList + doc.FullFileName + System.Environment.NewLine
    End If
Next

MsgBox(notLinkedList)

Jelte de Jong
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.

EESignature


Blog: hjalte.nl - github.com

0 Likes

k14348
Advocate
Advocate

Hi,

   Thanks for your reply. As i know only vba i expect this coding in vba. Thanks for understanding.

 

Regards,

Karth

0 Likes

k14348
Advocate
Advocate

Hi,

   Can anybody correct this code to open the partDocument. If "=" sign not there.

Option Explicit

Sub DescriptCheck()

    Dim oApp As Application
    Set oApp = ThisApplication
    
    Dim oAsmDoc As AssemblyDocument
    Set oAsmDoc = oApp.ActiveDocument
    
    Dim oPartDoc As PartDocument
    
    Dim oProp As Property
    
    For Each oPartDoc In oAsmDoc.AllReferencedDocuments
    Set oProp = oPartDoc.PropertySets.Item("Design Tracking Properties").Item("Description")
    
    Dim oVal As Variant
    
    oVal = oProp.Expression
    
    MsgBox (oVal)
    
    If Left(oVal, 1) = "=" Then
    MsgBox ("yes")
    
    Else
    
    'oPartDoc.Open I need this line to open the doc
    
    End If
    
    
    Next

    
End Sub
0 Likes

WCrihfield
Mentor
Mentor
Accepted solution

I think the line you're looking for is:

 

 

Call ThisApplication.Documents.Open(oPartDoc.FullFileName, True)
'Or in your case
Call oApp.Documents.Open(oPartDoc.FullFileName, True)

 

 

I hope this helps.
If this solves your problem, or answers your questions, please click 'Accept As Solution".
Or, if this helps you reach your goal, please click 'LIKES" :thumbs_up:.

 

Also, if you're interested, here are a few of the 'Ideas' I'd like to get implemented.
If you agree with any of them, please vote for them.

  • Add more capabilities to the 'Customize' dialog box (exe. Add Tab & Add Panel) Click Here
  • MessageBox, InputBox, and InputListBox Size & Format Options Click Here
  • Constrain & Dimension Images In Assembly Sketches & Drawing Sketches (TitleBlocks & SketchedSymbols) Click Here
  • Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) Click Here
  • Add SolidBodies Folder In iLogic Rule Editor Model Tab Click Here
  • Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder Click Here
  • SetDesignViewRepresentation - Fix limitations for DrawingView of a Part Click Here

Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes