- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a rule that checks if parts in an assembly are sheet metal. if they are it adds a custom iproperty to the part, and is supposed to fill the custom property with the length and width of the part.
It all works except for the actual length and width of the flat pattern.
SyntaxEditor Code Snippet
Dim oDoc As Document Dim asmDoc As AssemblyDocument asmDoc = ThisApplication.ActiveDocument Dim asmDef As AssemblyComponentDefinition asmDef = asmDoc.ComponentDefinition For Each oDoc In asmDoc.AllReferencedDocuments If oDoc.DocumentType = kPartDocumentObject And oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Dim propertyName As String = "Blank Size" Dim propertyValue As String = Round(SheetMetal.FlatExtentsWidth, 0) & " x " & Round(SheetMetal.FlatExtentsLength, 0) customPropertySet = oDoc.PropertySets.Item("Inventor User Defined Properties") Try prop = customPropertySet.Item(propertyName) Catch ' Assume error means not found customPropertySet.Add("", propertyName) prop = customPropertySet.Item(propertyName) End Try prop.Value = propertyValue End If Next
I'm assuming it has to do with the property value as string, and thought something along the lines of this
Dim oSheet As PartDocument
oSheet = ThisApplication.ActiveDocument
Dim oSheetmetal As SheetMetalComponentDefinition
oSheetmetal = oSheet.FlatPattern
Dim propertyName As String = "Blank Size"
Dim propertyValue As String = oSheetmetal.Length() & " x" & osheetmetal.Width()
Is required.
Am I on the right track? Could someone point me in the right direction here?
Cheers
Solved! Go to Solution.