- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have seen very similar questions posted everywhere, however I keep getting a "ComponentDefinition" error whenever i run the below code:
Sub Main() Dim oOpenDocs As DocumentsEnumerator = ThisApplication.Documents.VisibleDocuments For Each oDoc As Document In oOpenDocs If oDoc.DocumentType = Inventor.DocumentTypeEnum.kDrawingDocumentObject Dim oParas As UserParameters = oDoc.Document.ComponentDefinition.Parameters.UserParameters Dim oPara As UserParameter Try oPara = oParas.Item("Drawing Type") Catch oPara = oParas.AddByValue("Drawing Type", "Part", UnitsTypeEnum.kTextUnits) End Try iLogicVb.RunExternalRule("AutoCAD Export.iLogicVb") End If Next End Sub
I understand the external rule command line required the full directory I have removed it just for this post, the AutoCAD Export vb code will read a parameter called "Drawing Type" to determine if its a part or assembly drawing.
However on older iterations of my templates I have used different parameters.
Id like to check each drawing file thats open if "Drawing Type" paramter exists and if not create it, however everytime I run the rule it gives me this error: Public member 'Document' on type '_DocumentClass' not found.
Other posts suggest changing the command to ThisDoc.ActiveDocument but I fear this will just take the value of the first page and will not continuously do it for each drawing missing this parameter.
Solved! Go to Solution.