Message 1 of 30
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I need an iLogic routine that returns the length, width and thickness extents of a
part created from a solid body model using the "make components" command. I know
that Inventor has sheet metal functions for getting the X & Y values of a sheet
metal part from its flat pattern so I started there by converting my standard part
to sheetmetal & then creating a flat pattern. This seems to work fine for getting
the Length & the Width of the part but I don't know how to get an accurate thickness.
My first thought was to use iProperties.Volume and then divide that value by
SheetMetal.FlatExtentsArea but that only works if the part is square/rectangular and
has no cutouts or holes. Is there a way to get the actual thickness from the flat
pattern or elsewhere? Keep in mind the parts I'm dealing with were created with Make
Components so they don't have parameters that I can pull the width from.
Assuming someone can help me with the Thickness issue I would also like to know how
to exit the flat pattern at the end. I might even want to exit the flat pattern,
delete it and turn the part back into a standard part (that may be unnecessary).
Any help with this would also be appreciated.
Anyhoo, here is my code thus far:
'The purpose of this iLogic is to get length, width and thickness values for parts
that are created from 'multi-body solid models using the "Make Part" Or "Make Components"
command. This is done by converting'the standard parts to sheet metal, creating
flat patterns and using the SheetMetal.FlatExtents commands 'Checks to see if the active document is a standard part. If ThisApplication.ActiveDocument.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" 'If it is a standard part it is converted to sheet metal Try ThisApplication.ActiveDocument.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Catch 'catch error and exit rule when part can't be converted 'example: multiple solid body part Return End Try End If 'Gets the document's units of measure Dim uom As UnitsOfMeasure = ThisApplication.ActiveDocument.UnitsOfMeasure 'Converts length unit to a string Dim Units As String = uom.GetStringFromType(uom.LengthUnits) 'Gets the X & Y dimensions of the part from sheetmetal extents X=SheetMetal.FlatExtentsLength Y=SheetMetal.FlatExtentsWidth
'****** This is where I'm trying to calculate the thickness ****** 'Calculates the Z dimension of the part using part volume and sheetmetal extents.
'Might be a better way to do this but this is was my best idea at the time.
'Not such a good idea after all as it only works if the part is square/rectangular and has no holes!!! Z=iProperties.Volume/SheetMetal.FlatExtentsArea Dim LengthString As String = MaxOfMany (X,Y,Z) Dim WidthString As String = X + Y + Z - MaxOfMany (X,Y,Z) - MinOfMany(X,Y,Z) Dim ThicknessString As String = MinOfMany (X,Y,Z) 'Sets iProperties for Length, Width & Thickness. Unit string is added to each value.
'No formatting is done to these values and all the decimal places are left in place.
'My thought here is that these values are to be used in the BOM only and formatting can be handled by the parts list settings. iProperties.Value("Custom", "Length") = LengthString & " " & Units iProperties.Value("Custom", "Width") = WidthString & " " & Units iProperties.Value("Custom", "Thickness") = ThicknessString & " " & Units 'Leave FlatPattern and return to Folded model'***I don't know how to do this*** 'ThisDoc.Save
Solved! Go to Solution.