07-26-2017
07:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
07-26-2017
07:00 AM
Is there a good reason you need to use the specific WeldmentComponentDefinition instead of the generic ComponentDefinition?
From my messing around with this, it appears to work just fine.... I'm assuming refdoc probably isn't actually a weldmentcomponentdefinition like you expect it to be.
Sub Main() Dim oCD As ComponentDefinition For Each oSubDoc in ThisDoc.Document.AllReferencedDocuments If oSubDoc.DocumentType = kAssemblyDocumentObject 'AssemblyDocument If oSubDoc.ComponentDefinition.Type = ObjectTypeEnum.kWeldmentComponentDefinitionObject Dim oWCD As WeldmentComponentDefinition = oSubDoc.ComponentDefinition oCD = oWCD MsgBox(oWCD.Document.FullFileName) Goto Continue1 Else Dim oACD As AssemblyComponentDefinition = oSubDoc.ComponentDefinition oCD = oACD End If Else 'Part Doc If oSubDoc.ComponentDefinition.Type = ObjectTypeEnum.kSheetMetalComponentDefinitionObject Dim oSCD As SheetMetalComponentDefinition = oSubDoc.ComponentDefinition oCD = oSCD Else Dim oPCD As PartComponentDefinition = oSubDoc.ComponentDefinition oCD = oPCD End If End If Next Continue1: MsgBox(oCD.Document.FullFileName) End Sub 'kVirtualComponentDefinitionObject - 100675072 'kWeldmentComponentDefinitionObject - 100673280 'kAssemblyComponentDefinitionObject - 100663808 'kPartComponentDefinitionObject - 83886592 'kSheetMetalComponentDefinitionObject - 150995200
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.
Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization

iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization
iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type