01-18-2023
06:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
01-18-2023
06:05 AM
Hi @meGVGMF. Using ThisDoc.Document will usually return the same document object as ThisDoc.FactoryDocument, when you have that model document open directly, and 'active' on your screen, but just as @CattabianiI pointed out, that may not be the case in other odd situations, where you may not be directly editing the model as the 'active' document. He also pointed out one of the main tools for checking if the document you have is a 'member' or 'factory', which I also pointed out within the 'Link' at the end of my earlier responce.
Here is an example you can look at:
Dim oDoc As Document = ThisDoc.Document 'or ThisDoc.FactoryDocument
Dim oMSTable As ModelStateTable = Nothing
If oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
Dim oADoc As AssemblyDocument = oDoc
If oADoc.ComponentDefinition.IsModelStateMember Then oADoc = oADoc.ComponentDefinition.FactoryDocument
oMSTable = oADoc.ComponentDefinition.ModelStates.ModelStateTable
ElseIf oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
Dim oPDoc As PartDocument = oDoc
If oPDoc.ComponentDefinition.IsModelStateMember Then oPDoc = oPDoc.ComponentDefinition.FactoryDocument
oMSTable = oPDoc.ComponentDefinition.ModelStates.ModelStateTable
Else
Exit Sub 'wrong document type
End If
'now you should have obtained the ModelStateTable from the 'Factory' document
Dim oMyCol As ModelStateTableColumn = Nothing
For Each oCol As ModelStateTableColumn In oMSTable.TableColumns
If oCol.ReferencedDataType = iComponentColumnTypeEnum.kFilePropertyColumn And _
oCol.DisplayHeading = "MyCustomPropertyName" Then
oMyCol = oCol : Exit For
End If
Next
oMSTable.TableRows.Item("ModelStateName").Item(oMyCol).Value = ""
'oMSTable.TableRows.Item("ModelStateName").Item("ColumnHeading").Value = ""
Wesley Crihfield
(Not an Autodesk Employee)