10-18-2021
05:23 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-18-2021
05:23 PM
Ilogic for note generation?
I would like upon drawing creation, notes to be generated. If Aluminum 6061 is chosen as the model material, then a note would be generated:
MATERIAL: ALUMINUM 6061-T6, -T651 OR -T6511 PER ASTM B209,
ASTM B211, AMS-QQ-A-200/8A OR AMS4027.
This would be pulled from an excel spreadsheet where the spreadsheet would be arranged by material
-Mark
i7-7700K @4.2GHz
32 GB Ram
Nvidia Quadro 5000
i7-7700K @4.2GHz
32 GB Ram
Nvidia Quadro 5000
10-19-2021
12:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-19-2021
12:22 AM
You can use the general note for this. here is a small example. I created a simple excel sheet with two columns to test this. you need to add some check if the material is not found for example.
You can chaneg the code if you need custom formatted text. if you run the code twice, it will place a new note as well i hope this gives you a good starting point.
Sub main ' This assumes a drawing document is active. Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument Dim modelDoc = ThisDrawing.ModelDocument Try If modelDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then Dim oPart As PartDocument oPart = modelDoc 'get active material oMaterial = oPart.ComponentDefinition.material.name Else Logger.Info("model is not part") Exit Sub End If Catch Logger.Info("No model document") Exit Sub End Try 'ophalen template path definitie oPathWP = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath 'get data from excel oFile = oPathWP & "\Projects\PRJ0081\Mat.xlsx" i = GoExcel.FindRow(oFile, "Sheet1", "Material", "=", oMaterial) oNewText = GoExcel.CellValue(oFile, "Sheet1", "B"&i) ' Set a reference to the active sheet. Dim oActiveSheet As Sheet oActiveSheet = oDrawDoc.ActiveSheet ' Set a reference to the GeneralNotes object Dim oGeneralNotes As GeneralNotes oGeneralNotes = oActiveSheet.DrawingNotes.GeneralNotes Dim oTG As TransientGeometry oTG = ThisApplication.TransientGeometry ' Create text with simple string as input. Since this doesn't use ' any text overrides, it will default to the active text style. Dim sText As String sText = oNewText Dim oGeneralNote As GeneralNote oGeneralNote = oGeneralNotes.AddFitted(oTG.CreatePoint2d(3, 18), sText) End Sub