Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Write iPropertie from .idw to part

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
630 Views, 5 Replies

Write iPropertie from .idw to part

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.  

 

 

5 REPLIES 5
Message 2 of 6
Cadmanto
in reply to: Anonymous

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)


Message 3 of 6
Anonymous
in reply to: Cadmanto

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

Message 4 of 6
chandra.shekar.g
in reply to: Anonymous

@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



Message 5 of 6
Anonymous
in reply to: chandra.shekar.g

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

Message 6 of 6

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report