Frame Generator - Miter and cut detail - customized BOM

Frame Generator - Miter and cut detail - customized BOM

Anonymous
Not applicable
4,601 Views
25 Replies
Message 1 of 26

Frame Generator - Miter and cut detail - customized BOM

Anonymous
Not applicable

Hi Guys,

This One is a good one for all you cleaver i Logic people.

 

I have a BOM that I want to use the Cutdetals from frame generator.

My need is for the figure of text that is created is not how my bosses want to use it.

The angle is created from the back edge of the box but typically the saw man will move the saw from 0 deg's which is 90 deg out from the the angle that inventor created. (hopefully you know what I mean)

so where Cutdetail says 51.33deg in my bom i want it to say 38.67deg.

first how would i do this???

also I want to bring the details into the Part number column to read as I have manually entered below.

Any Ideas on how to do this??

TEST BOM.JPG 

0 Likes
Accepted solutions (2)
4,602 Views
25 Replies
Replies (25)
Message 21 of 26

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@Anonymous,

 

Try this.

Sub Main() 
    ' Get the active assembly. 
    Dim oAsmDoc As AssemblyDocument 
    oAsmDoc = ThisApplication.ActiveDocument  
	 
    ' Get the assembly component definition. 
    Dim oAsmDef As WeldmentComponentDefinition  
    oAsmDef = oAsmDoc.ComponentDefinition 

    ' Get all of the leaf occurrences of the assembly. 
    Dim oLeafOccs As ComponentOccurrencesEnumerator 
    oLeafOccs = oAsmDef.Occurrences.AllLeafOccurrences 

    ' Iterate through the occurrences and print the name. 
	Dim cnt As Integer 
	cnt = 0
	Dim total As Double  
	 
	Dim oOcc As ComponentOccurrence
	For Each oOcc In oLeafOccs
		If oOcc.DefinitionDocumentType = kPartDocumentObject Then
            Dim oReferDoc As PartDocument
            oReferDoc = oOcc.ReferencedDocumentDescriptor.ReferencedDocument
                   
            Dim oProp As Inventor.Property
            For Each oProp In oReferDoc.PropertySets.Item(4)
            
                If oProp.DisplayName = "CUTDETAIL1" Then
					Dim oName As String 
					oName = oProp.Name
					
                    Dim sawAngle As String
                    sawAngle = oProp.Value 
					
					Dim angle(2) As String 
					angle = sawAngle.Split(" ")
			
					If angle(0) = "Miter" Then
						
						Dim needAngle As Double
						needAngle = 90 - Convert.ToDouble(angle(1))
						 
						oReferDoc.PropertySets.Item(4).Item(oName).Value = "Miter " + needAngle.ToString + " deg"
					
					End If 
                End If
                
            Next 
            
        End If
		 
		 
	Next   

End Sub

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 22 of 26

Anonymous
Not applicable

Hi Chandra,

This code appears to work perfect in our weldment template.

Thanks 

0 Likes
Message 23 of 26

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

If code is working, click on "Accept solutions"

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 24 of 26

BLA_fpineda
Enthusiast
Enthusiast

Hi @chandra.shekar.g 

 

First of all, thank you for the solution it looks nice.

 

Let me say that once I executed the rule, the second time it does not update the information. It seems like the rule is not running.

 

Do you have any idea to fix that?

 

Thank you,

0 Likes
Message 25 of 26

Anonymous
Not applicable

CUT ANGLECUT ANGLE

 

 

Capture2.PNGCapture3.PNG

 

hello

 

i write the rule in the assembly but it does not change the inverse angle on the BOM when i execute it

 

i'm french, i  replace 'CUTDETAIL1" by 'DETAILDECOUPE1' .....

 

Please could you help me.

 

i have ever write code in javascript and i don't  find console to execute the code and see if it works or executed and 

 

you will find my assembly to see 

 

 

Sub main()
	
' Get the active assembly. 
    Dim oAsmDoc As AssemblyDocument 
    oAsmDoc = ThisApplication.ActiveDocument  
	 
    ' Get the assembly component definition. 
    Dim oAsmDef As AssemblyComponentDefinition  
    oAsmDef = oAsmDoc.ComponentDefinition 

    ' Get all of the leaf occurrences of the assembly. 
    Dim oLeafOccs As ComponentOccurrencesEnumerator 
    oLeafOccs = oAsmDef.Occurrences.AllLeafOccurrences 

    ' Iterate through the occurrences and print the name. 
	Dim cnt As Integer 
	cnt = 0
	Dim total As Double  
	 
	Dim oOcc As ComponentOccurrence
	For Each oOcc In oLeafOccs
		If oOcc.DefinitionDocumentType = kPartDocumentObject Then
            Dim oReferDoc As PartDocument
            oReferDoc = oOcc.ReferencedDocumentDescriptor.ReferencedDocument
                   
            Dim oProp As Inventor.Property
            For Each oProp In oReferDoc.PropertySets.Item(4)
            
                 If oProp.DisplayName.Contains("DETAILDECOUPE2") = True Then
					Dim oName As String 
					oName = oProp.Name
					
                    Dim sawAngle As String
                    sawAngle = oProp.Value 
					
					Dim angle(1) As String 
					angle = sawAngle.Split(" ")
			
					Select Case angle(0)
					Case "Angle de coupe" 
						If angle(2) <> 90 Then 
						needAngle = 90 - Convert.ToDouble(angle(2))
						oReferDoc.PropertySets.Item(4).Item(oName).Value = "Angle de coupe " + needAngle.ToString + " deg"
					End If
					
					Case "Coupe d'onglet" 
						If angle(1) <> 90 Then 
						needAngle = 90 - Convert.ToDouble(angle(1))
						oReferDoc.PropertySets.Item(4).Item(oName).Value = "Coupe d'onglets " + needAngle.ToString + " deg"
					End If
                	End Select
				End If
            Next 
        End If	 
	Next   
	
End Sub

  

0 Likes
Message 26 of 26

DeanDavey
Explorer
Explorer
Accepted solution

hi, how do you run this script?

 

Thank you!