Not applicable
07-25-2016
03:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I'm currently working on a rule and I have one slight problem. The problem is that this rule returns the measurements from the assembly, I want the measurements from the referenced documents.
Sub Main()
Dim StartTime As DateTime
Dim aElapsedTime As TimeSpan
StartTime = Now
Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oRefDocs As DocumentsEnumerator = oAsmDoc.AllReferencedDocuments
aPropParNum = oAsmDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value
aFileNameWithoutExt = IO.Path.GetFileNameWithoutExtension(oAsmDoc.FullDocumentName)
For Each oRefDoc In oRefDocs
bPropParNum = oRefDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value
bFileNameWithoutExt = IO.Path.GetFileNameWithoutExtension(oRefDoc.FullDocumentName)
bFullpath = IO.Path.GetFullPath(oRefDoc.FullDocumentName)
bFileName = IO.Path.GetFileName(oRefDoc.FullDocumentName)
If oRefDoc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject Then
If InStr(bFileNameWithoutExt, "koker", CompareMethod.Text) = 1 Then
ThisApplication.Documents.Open(bFullpath, True)
InventorVb.DocumentUpdate()
aDocument = ThisApplication.ActiveDocument
iProperties.Value(aDocument, "Custom", "aMeasure") = Measure.ExtentsHeight
iProperties.Value(aDocument, "Custom", "bMeasure") = Measure.ExtentsWidth
iProperties.Value(aDocument, "Custom", "cMeasure") = Measure.ExtentsLength
If aDocument.Open Then aDocument.Close(True)
End If
End If
Next
aElapsedTime = Now().Subtract(StartTime)
bElapsedTime = aElapsedTime.TotalSeconds
oWrite = System.IO.File.CreateText("X:\01 productie\25 Werkvoorbereiding\07 Zaaglijsten\" & aFileNameWithoutExt & ".txt")
oWrite.WriteLine(aFileNameWithoutExt & vbCrLf & DateString & " " & Timestring)
oWrite.WriteLine("All data was collected in " & Round(bElapsedTime, 2) & "s" & vbCrLf & "")
oWrite.WriteLine("Tubes:" & vbCrLf & oListB)
oWrite.Close()
End Sub
Thank you, Stan Mertens
Solved! Go to Solution.