Error in aream rule when saving assembly

Error in aream rule when saving assembly

Charlies_3D_T
Advocate Advocate
547 Views
4 Replies
Message 1 of 5

Error in aream rule when saving assembly

Charlies_3D_T
Advocate
Advocate

Hello,

 

I have the following problem. See screenshot for the error message.

 

If i save the parts in part then i don't have an error. When i update an ass and i save it i get an error on each sheetmetal part. Below is my ilogic. 

 

Hope someon knows the problem.

 

 

Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
Dim oCompDef As SheetMetalComponentDefinition
oCompDef = oDoc.ComponentDefinition

'Check For flat pattern, if none, create one
If oCompDef.HasFlatPattern = False Then

oCompDef.Unfold
Parameter("Lengte") = SheetMetal.FlatExtentsLength
Parameter("Breedte") = SheetMetal.FlatExtentsWidth

Else
Parameter("Lengte") = SheetMetal.FlatExtentsLength
Parameter("Breedte") = SheetMetal.FlatExtentsWidth

End If
0 Likes
Accepted solutions (1)
548 Views
4 Replies
Replies (4)
Message 2 of 5

DRoam
Mentor
Mentor
Accepted solution

One of the things you have to think about when writing rules is if it should run on the document the rule stored in, or on the currently-active document. In general, most rules are intended to run on the document the rule is stored in. To make that happen, change this line:

 

oDoc = ThisApplication.ActiveDocument

to this:

 

oDoc = ThisDoc.Document
0 Likes
Message 3 of 5

bradeneuropeArthur
Mentor
Mentor
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
Dim oCompDef As SheetMetalComponentDefinition
oCompDef = oDoc.ComponentDefinition

Dim ple As Inventor.Parameter
ple = oCompDef.Parameters.UserParameters.AddByValue("Lengte",1,"mm")

Dim pbr As Inventor.Parameter
pbr = oCompDef.Parameters.UserParameters.AddByValue("Breedte",1,"mm")

'Check For flat pattern, if none, create one
If oCompDef.HasFlatPattern = False Then

oCompDef.Unfold
Parameter("Lengte") = SheetMetal.FlatExtentsLength
Parameter("Breedte") = SheetMetal.FlatExtentsWidth

Else
Parameter("Lengte") = SheetMetal.FlatExtentsLength
Parameter("Breedte") = SheetMetal.FlatExtentsWidth

End If

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 4 of 5

bradeneuropeArthur
Mentor
Mentor

You forgot to add the parameter Lengte and Breedte….

Regards,

Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Dimension Component! | Partlist Export! | Derive I-properties! | Vault Prompts Via API! | Vault Handbook/Manual!
Drawing Toggle Sheets! | Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 5

Charlies_3D_T
Advocate
Advocate

@DRoam 

 

Stupid mistake! I had other rules with the same problem!

 

Thank you for the solution!

0 Likes