Write iPropertie from .idw to part

Write iPropertie from .idw to part

Anonymous
Not applicable
728 Views
5 Replies
Message 1 of 6

Write iPropertie from .idw to part

Anonymous
Not applicable

Hello,

 

I want to know if it possible to write an iProperty in the IDW to the iProperties of the part that is placed in the IDW.

The iProperty is the "Pagenumber" of the idw.

 

I have build an configurator which will print different IDWs with different pagenumbers and after processing, it needs to be written to the part number.  

 

 

0 Likes
Accepted solutions (1)
729 Views
5 Replies
Replies (5)
Message 2 of 6

Cadmanto
Mentor
Mentor

Not on a normal day. Smiley Wink

The model drives the drawing, not the other way around.  Only way I can think of would be through iLogic.

What is your scenario?

 


Windows 10 x64 -16GB Ram
Intel i7-6700 @ 3.41ghz
nVidia GTS 250 - 1 GB
Inventor Pro 2018

 

Best Regards,
Scott McFadden
(Colossians 3:23-25)


0 Likes
Message 3 of 6

Anonymous
Not applicable

Hi,

 

I want to try this through iLogic, but after trying and searching multiple times, i couldn't find any solution that will match this problem

0 Likes
Message 4 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@Anonymous,

 

Try suggestions in below blog link.

 

http://adndevblog.typepad.com/manufacturing/2018/05/ilogic-to-copy-iproperties-from-drawing-document-to-model-document.html

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 5 of 6

Anonymous
Not applicable

Many many thanks. This link helped me to find my solution

0 Likes
Message 6 of 6

mario.garzon
Community Visitor
Community Visitor

Just recovered this from google cache:

 

Sub Main()
	If Not ThisApplication.ActiveDocument.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
		Messagebox.Show("Current document is not drawing docuemnt", "Inventor")
		Exit Sub
	End If
	Dim value_List As List(Of String) = New List(Of String)

	value_List.Add(iProperties.Value("Project", "Vendor"))
	value_List.Add( iProperties.Value("Project", "Stock Number"))
	value_List.Add(iProperties.Value("Project", "Project"))
	value_List.Add(iProperties.Value("Project", "Designer"))

	Dim oDoc As Document
	oDoc = ThisDrawing.ModelDocument 

	If oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
		
		Update_Properties(oDoc,  value_List)
		
		Dim oAsyDoc As AssemblyDocument 
		oAsyDoc = oDoc
		 
		Dim oReferDoc As Document 
		Dim occ As ComponentOccurrence 
		Dim oDef As AssemblyComponentDefinition 
		oDef = oAsyDoc.ComponentDefinition  

		For Each occ In oDef.Occurrences 			
			If occ.SubOccurrences.Count = 0 Then
				oReferDoc = occ.ReferencedDocumentDescriptor.ReferencedDocument
				Update_Properties(oReferDoc, value_List)
			Else				
				oReferDoc = occ.ReferencedDocumentDescriptor.ReferencedDocument
				Update_Properties(oReferDoc,   value_List)
				processAllSubOcc(occ,  value_List)
			End If				
		Next 
		
	Else If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
		Update_Properties(oDoc, value_List)
	End If 

End Sub 

Private Sub processAllSubOcc(ByVal oCompOcc As ComponentOccurrence , value_List As List(Of String))
    
	Dim oSubCompOcc As ComponentOccurrence
	Dim oReferDoc As Document 
    For Each oSubCompOcc In oCompOcc.SubOccurrences
        If oSubCompOcc.SubOccurrences.Count = 0 Then
            oReferDoc = oSubCompOcc.ReferencedDocumentDescriptor.ReferencedDocument
			Update_Properties(oReferDoc,value_List)			
        Else
            oReferDoc = oSubCompOcc.ReferencedDocumentDescriptor.ReferencedDocument
			Update_Properties(oReferDoc ,value_List)			
            Call processAllSubOcc(oSubCompOcc, value_List)
        End If
    Next
	
End Sub

Sub Update_Properties(oDoc As Document,   value_List As List(Of String))
	
	oDoc.PropertySets.Item("Design Tracking Properties").Item("Vendor").Value = value_List.Item(0)
	oDoc.PropertySets.Item("Design Tracking Properties").Item("Stock Number").Value = value_List.Item(1)
	oDoc.PropertySets.Item("Design Tracking Properties").Item("Project").Value = value_List.Item(2)
	oDoc.PropertySets.Item("Design Tracking Properties").Item("Designer").Value = value_List.Item(3)	 
	oDoc.Save()
	
End Sub
0 Likes