Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
martinhoos
in reply to: MegaJerk

Thanks for answer megajerk,

the rule is external - it runs by "before save". If i open only a part, the rule runs ok. If i open a assembly and Change a part in the assembly - i get that message.

Below is the hole rule.

 

	Dim oDoc As PartDocument = ThisApplication.ActiveDocument
	If oDoc.DocumentSubType.DocumentSubTypeID = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
    Dim oDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition
    If Not oDef.HasFlatPattern Then
        oDef.Unfold()
    End If
    Dim oFlatPattern As FlatPattern = oDef.FlatPattern
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area,4) 'use this one for cm^2
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 0.00107639104,4) 'use this one for ft^2
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 100,4) 'use this one for mm^2
    Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 0.0001,3) 'use this one for m^2
    iProperties.Value("Custom", "Flaeche_Zuchnitt") = dArea
	iProperties.Value("Custom", "Einheit") = "QM"
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("AL 0,5")) Then 
	iProperties.Value("Custom", "Benennung") = "Aluminium-Blech formatlos"
	iProperties.Value("Custom", "Abmessung") = "0,5mm"
	iProperties.Value("Custom", "Dicke") = "t=0,5"
	iProperties.Value("Custom", "Artikelnr") = "H50-000-001"
	End If
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("AL 1,5")) Then 
	iProperties.Value("Custom", "Benennung") = "Aluminium-Blech formatlos"
	iProperties.Value("Custom", "Abmessung") = "1,5mm"
	iProperties.Value("Custom", "Dicke") = "t=1,5"
	iProperties.Value("Custom", "Artikelnr") = "H50-000-001"
	End If
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("AL 2,0")) Then 
	iProperties.Value("Custom", "Benennung") = "Aluminium-Blech formatlos"
	iProperties.Value("Custom", "Abmessung") = "2,0mm"
	iProperties.Value("Custom", "Dicke") = "t=2,0"
	iProperties.Value("Custom", "Artikelnr") = "H50-000-002"
	End If
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("AL 3,0")) Then 
	iProperties.Value("Custom", "Benennung") = "Aluminium-Blech formatlos"
	iProperties.Value("Custom", "Abmessung") = "3,0mm"
	iProperties.Value("Custom", "Dicke") = "t=3,0"
	iProperties.Value("Custom", "Artikelnr") = "H50-001-008"
	End If
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("St 1,5")) Then 
	iProperties.Value("Custom", "Benennung") = "Stahl-Blech, S235JR"
	iProperties.Value("Custom", "Abmessung") = "2000x1000x1,5mm"
	iProperties.Value("Custom", "Dicke") = "t=1,5"
	iProperties.Value("Custom", "Artikelnr") = "H50-000-043"
	End If
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("St 2,5")) Then 
	iProperties.Value("Custom", "Benennung") = "Stahl-Blech, S235JR"
	iProperties.Value("Custom", "Abmessung") = "2000x1000x2,5mm"
	iProperties.Value("Custom", "Dicke") = "t=2,5"
	iProperties.Value("Custom", "Artikelnr") = "H50-000-041"
	End If

End If

 

 

Thank you for your help!

Regards Martin