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: 

Iproperty

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
pg47328
289 Views, 5 Replies

Iproperty

Hello, maybe a simple question but i can´t find a way to crack this problem. I have a document constituted by various subAssemblies, i want that all the parts in those subAssemblies to have a iproperty based in the name of sub assembly so i can keep track in the drawings.

5 REPLIES 5
Message 2 of 6
WCrihfield
in reply to: pg47328

Hi @pg47328.  It sounds like you want the parts to know about the assemblies they are being used in.  This is the type of functionality that is usually only available with Vault.  It is generally bad practice to write assembly level data back down to the part level because it can lead to lots of errors and/or incorrect or outdated data later.  If parts knew about every assembly they were being used in, then in theory, the part's file size would get larger every time it gets added into another assembly, and the part file would need to be updated every time it is used in an assembly.

 

Can you give an example of why you need assembly related data to be stored down within the parts, and how that relates to the drawings you mentioned?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 6
pg47328
in reply to: WCrihfield

Hello, thanks for the quick response.

I have a multiple stud frames in inventor (Wall1,...), each one have x number of studs, and when i create the drawings views for each stud, for monitoring purpose, i want to have a parameter in my  Parts List with the name of the sub assembly that the part comes. 

Message 4 of 6
Andrii_Humeniuk
in reply to: pg47328

Hi @pg47328 . This code writes in the description of the detail the name of the subassembly to which it is included. Do you need a list of subassemblies that include a part?

Sub main
	Dim oDoc As Document = ThisApplication.ActiveDocument
	If TypeOf oDoc Is AssemblyDocument Then
		Dim oADoc As AssemblyDocument = oDoc
		Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
		Dim oTM As TransactionManager = ThisApplication.TransactionManager
		Dim newTM As Transaction = oTM.StartTransaction(oADoc, "CreatPropertyNameParent")
		Call WritaNameForPart(oADef.Occurrences)
		newTM.End()
	Else
		MessageBox.Show("Active document is not AssemblyDocument.", "Error!",MessageBoxButtons.OK,MessageBoxIcon.Error)
	End If
End Sub

Private Function WritaNameForPart(ByVal oOccs As ComponentOccurrences)
	For Each oOcc As ComponentOccurrence In oOccs
		If Not oOcc.Suppressed Then
			If TypeOf oOcc.Definition.Document Is PartDocument Then
				Dim oOccDoc As PartDocument = oOcc.Definition.Document
				If oOccDoc.IsModifiable Then
					oOccDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value = oOcc.ParentOccurrence.Name
				End If
			Else
				Call WritaNameForPart(oOcc.SubOccurrences)
			End If
		End If
	Next
End Function

 

Andrii Humeniuk - Leading design engineer

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

Message 5 of 6
pg47328
in reply to: Andrii_Humeniuk

It seems to work fine, thank you. I only have one question, for representing this value in the parts list of the drawing is preferable to have it as an iproperty or as a description as in your code.

Message 6 of 6
Andrii_Humeniuk
in reply to: pg47328

In principle, it does not matter, write where it is more convenient for you. In a specific situation, I chose the description because it seemed convenient to me in the given circumstances.

Andrii Humeniuk - Leading design engineer

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report