Custom iProperty based on Custom Content Center part parameters

Custom iProperty based on Custom Content Center part parameters

Shag_Bore
Advocate Advocate
487 Views
5 Replies
Message 1 of 6

Custom iProperty based on Custom Content Center part parameters

Shag_Bore
Advocate
Advocate

I have created my own custom content center library, for this issue I am using the Square HSS library. 

I want a custom iProperty to report in ft rounded up to the next whole number. (Ceil(value))

if I change the formatting of the Base QTY column in the parts lists it changes all value in that column, even if it isn't a length parameter. I don't want a linear unit on a quantity item. 

length_paramter_1.PNG

I have been creating a custom iProperty in my other custom frame generator parts but I was able to do that using an iLogic rule directly in the part before publishing. So that way after using it in an assembly, it will report a number to a custom column "Length (ft)" is the takes the G_L, divides it by 12 to convert to feet then Ceil, to round up to next whole foot. 

FT=Ceil(G_L/12)

oA = FT

iProperties.Value("Custom", "LENGTH (ft)") = oA

The problem I have now is trying to get the "Length (ft)" property to populate on Content Center items, like HSS, Angles, Flat bar etc...non custom members.

 

I created a custom column in the editor, mapped it to my Length(ft) iprop, but I can't get the Expression to work.

length_paramter_2.PNG

 

Any ideas on how to get this value to populate and report on a parts list?

 

Thanks!

 

Sean Farr
Product Designer at Teksign Inc.
Inventor 2016 SP1
Dell Precision 3660
i7-12700 @ 2.40GHz-4.90GHz
32GB DDR5 4400MHz RAM
NIVDIA RTX A2000 6GB
0 Likes
488 Views
5 Replies
Replies (5)
Message 2 of 6

A.Acheson
Mentor
Mentor

@Shag_Bore wrote:

The problem I have now is trying to get the "Length (ft)" property to populate on Content Center items, like HSS, Angles, Flat bar etc...non custom members.

Hi Sean,  When you say this is a non custom members what is your meaning? Is your request to place  these parts as standard and you want to add the custom iproperty "Length (ft)"  before it is saved to the standard CC files folder?

This sounds like a tricky task and something likely CC expressions and or trying to insert the iproperty before saving can handle. Maybe other people have ideas on how to accomplish the task? 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 6

Shag_Bore
Advocate
Advocate

Hey @A.Acheson ,

 

My content center is comprised of custom profiles that I sketched up, authored and published. I am able to fully manipulate these parts to get my desired output. Such as ft^2, lengths etc...

 

It is the profiles that I copied from Inventor libraries to my custom library, like HSS rectangular and square tubes, angles, square/rec stock that I can't get custom values to populate. I believe these "parts" are just databases and there isn't an actual .ipt file for them. 

 

The reason for wanting specific returns like total feet round up to nearest foot, is our IMS system requires these values to "book" the items for the project and to flag any items if there isn't enough in house to complete the project.

 

I do have a few options I suppose, I could re-create these items and author/publish like I did with my custom profiles. Or I could do it in excel as I need to export the parts list to a specific CSV format to import into our IMS software. I would like to do as much as I can inside inventor though.

 

Thanks!

 

  

Sean Farr
Product Designer at Teksign Inc.
Inventor 2016 SP1
Dell Precision 3660
i7-12700 @ 2.40GHz-4.90GHz
32GB DDR5 4400MHz RAM
NIVDIA RTX A2000 6GB
0 Likes
Message 4 of 6

Shag_Bore
Advocate
Advocate

Something that I just realized, because I place these content center items directly in assembly and not on a skeleton file, an .ipt file is created. I have a custom expression to designate the Length before placing in the assembly.

length_paramter_3.PNG

 

So now I think the simplest solution is to just have this rule run in my assembly to create the Custom iProperty for all parts, if it finds the parameter G_L, it will round it up and place the result in the custom iProp.

 

How I would run this rule in an assembly level to affect all parts?

 

FT=Ceil(G_L/12)

oA = FT

iProperties.Value("Custom", "LENGTH (ft)") = oA

 

 

thanks!

Sean Farr
Product Designer at Teksign Inc.
Inventor 2016 SP1
Dell Precision 3660
i7-12700 @ 2.40GHz-4.90GHz
32GB DDR5 4400MHz RAM
NIVDIA RTX A2000 6GB
0 Likes
Message 5 of 6

Shag_Bore
Advocate
Advocate

I found some references and managed to get this code to work but it needs some work. Right now it is searching the assembly for the parameter G_L and then reporting 0 to the custom parameter of each part because G_L only exists in the parts and not the assembly. 

 

I don't know how to get the rule to search the parts for the parameter, if it find it, rounds it, then reports it to the custom iProp. 

 

Sub Main()
Dim oAsmDoc As AssemblyDocument 
oAsmDoc = ThisApplication.ActiveDocument  
Call Iterate(oAsmDoc.ComponentDefinition.Occurrences, 1)
End Sub 

Private Sub Iterate(Occurrences As ComponentOccurrences, Level As Integer) 
'Iterate through Assembly

Dim oOcc As ComponentOccurrence 
For Each oOcc In Occurrences 

'Find Parts in Assembly
Dim TeksignPart As String
TeksignPart = oOcc.Name
Try 

FT=Ceil(G_L/12)

oA = FT

'iProperties.Value("Custom", "LENGTH (ft)") = oA
'Write iProps to Parts
iProperties.Value(TeksignPart, "Custom", "LENGTH (ft)") = oA


Catch
'MsgBox("Message!")            
End Try
        
'Run through the sub assemblies 
If oOcc.DefinitionDocumentType = kAssemblyDocumentObject Then
Call Iterate(oOcc.SubOccurrences, Level + 1) 
End If 
Next 
End Sub
Sean Farr
Product Designer at Teksign Inc.
Inventor 2016 SP1
Dell Precision 3660
i7-12700 @ 2.40GHz-4.90GHz
32GB DDR5 4400MHz RAM
NIVDIA RTX A2000 6GB
0 Likes
Message 6 of 6

A.Acheson
Mentor
Mentor

You just need to filter by part document using the below snippet just inside the sub routine Iterate. The document filter further down is for assembly only and this will then call the sub routine to search all the children of that assembly. 

 

 

 

 

If oOcc.DefinitionDocumentType = kPartDocumentObject Then
   Logger.Info(Part Occurrence Name: ", oOcc.Name)
   ' INSERT OPERATION HERE
End If

 

 

 

 

 

 

You can also switch to using reference documents instead of occurrences. A referenced document is just like selecting occurrence (1). All other occurrences linked to the document will be changed at the same time. So a faster processing speed. Here is a link to article discussing approaches for working with assemblies. Here is the link for an article working to get the iproperties via the API. Using the ilogic iproperties snippet gets a little tricky to reference so it is better replace that with the API version. 

 

 

 

 

 

   ' Get the active assembly.
    Dim oAsmDoc As AssemblyDocument= ThisApplication.ActiveDocument
    
	' Get all of the referenced documents.
    Dim oRefDocs As DocumentsEnumerator = oAsmDoc.AllReferencedDocuments

    ' Iterate through the list of documents.
    Dim oRefDoc As Document
    For Each oRefDoc In oRefDocs    
		
		Logger.Info("All Documents: ", oRefDoc.DisplayName)
		' Check to see if this is a part.
        If oRefDoc.DocumentType = kPartDocumentObject Then
		   Dim oPartDoc as PartDocument = oRefDoc
           Dim oPartDef as PartComponentDefinition = oRefDoc.ComponentDefinition
           Logger.Info("Part Documents: ", oRefDoc.DisplayName)
           Try
           ' Get custom property in part
           Dim CustomiProp as Inventor.Property = oPartDoc.Propertysets.Item("Inventor User Defined Properties").Item("LENGTH (ft)")
           
		   ' Set the parameter         
		   Dim param as Inventor.Parameter = oPartDef.Parameters.Item("G_L")
		   CustomiProp.Value = param.Value
			
		   Catch
		   End Try
        End If
     
    Next

 

 

 

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan