.IAM Folder Folder Information to .IPT Occurrence

.IAM Folder Folder Information to .IPT Occurrence

estringer
Advocate Advocate
429 Views
4 Replies
Message 1 of 5

.IAM Folder Folder Information to .IPT Occurrence

estringer
Advocate
Advocate

Is it possible to pass information from a folder in an .IAM to an .IPT within that folder? If release folders were created, could that release number and other information be pushed as Occurrence Properties to the .IPT’s within that folder?

0 Likes
Accepted solutions (1)
430 Views
4 Replies
Replies (4)
Message 2 of 5

Cadkunde.nl
Collaborator
Collaborator

Here is how you can look through an assembly and find each occurrence that is in that same folder or subfolders

 

Dim AsmDoc As AssemblyDocument = ThisDoc.Document
Dim dir As String = System.IO.Path.GetDirectoryName(AsmDoc.FullFileName)

For Each odoc As Document In AsmDoc.AllReferencedDocuments
	If odoc.FullDocumentName.Contains(dir) Then
		MsgBox("found" & vbLf & odoc.FullFileName)
	End If
Next
0 Likes
Message 3 of 5

Cadkunde.nl
Collaborator
Collaborator

Here is an example how you can set the folder info to a custom iproperty.

You could make that a external rule that is triggered before save:

 

Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim oPropSets As PropertySets = oDoc.PropertySets
Try
	oPropSets.Item("Inventor User Defined Properties").Item("Folder").Value = System.IO.Path.GetDirectoryName(oDoc.FullFileName)
Catch
	oPropSets.Item("Inventor User Defined Properties").Add(System.IO.Path.GetDirectoryName(oDoc.FullFileName), "Folder")
End Try

 I'm not sure what you mean by release folders and release numbers.

 

With both examples you can make something that changes  iproperties in an occurrence when saving an assembly.

Here is a list of all iproperties: https://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html

 

Let me know if you need more help

 

0 Likes
Message 4 of 5

estringer
Advocate
Advocate

@Cadkunde.nl ,

Releases would be parts and assemblies that are to be released for production together. We create very large assemblies that include different releases and are trying to figure out ways to keep that organized. We would like to put the smaller assemblies into the "release" folders in the larger assemblies model browser and have the assemblies "inherit" the folder properties so that we can create easily filtered BOM's based on that information.

0 Likes
Message 5 of 5

Cadkunde.nl
Collaborator
Collaborator
Accepted solution

Ok well with the examples shown before that should be possible.

You can find directories, add that as iproperty, and change iproperties

 

What you cannot do is 'move' occurrences to different folders from within that assembly. (save and replace is possible)

And it is possible with coding in vault and move files based on category.

 

Did this solve your question?

0 Likes