Hi All,
I am currently working on an add in that iterates through an assembly and creates various drawings. A useful parameter for this is the sheetmetal extents for the flatpattern drawings. This is easy enough to get when working with a sheetmetal part file but when I try to drill down from the assembly file I can't seem to get at it. EG
SyntaxEditor Code Snippet
'SCALE DXF ACCORDING TO BLANK EXTENTS'*******************************************************************************************************************************'* Find out if it is a sheetmetal part'***************************************************************************************************************************** ' Make sure the document is a sheet metal document. If docFile.SubType <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then MessageBox.Show( "Not a sheetmetal part so no flat pattern", "Sheetmetal") Else Dim oCompDef As SheetMetalComponentDefinition oCompDef = docFile.ComponentDefinition '***********CREATE THE FLATPATTERN ' Create a new NameValueMap object extents_length = oCompDef.SheetMetal.FlatExtentsLength extents_width = oCompDef.SheetMetal.FlatExtentsWidth MessageBox.Show("Sheetmetal extents are:-" & extents_length & "x" & extents_width, "Title") Dim oCurve As DrawingCurve Dim oBaseViewOptions As NameValueMap oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap DrawingViewScale = 0.2 'True = folded view 'False = flat pattern view oBaseViewOptions.Add("SheetMetalFoldedModel", False) oPoint3 = ThisApplication.TransientGeometry.CreatePoint2d(9, 15) oFlatView = oSheet.DrawingViews.AddBaseView(docFile, oPoint3, DrawingViewScale, kDefaultViewOrientation, kHiddenLineRemovedDrawingViewStyle,,, oBaseViewOptions) MessageBox.Show("Flatpattern Created at Scale " & DrawingViewScale, "Title") '*********************************************' Add bend notes For Each oCurve In oFlatView.DrawingCurves If oCurve.EdgeType = Inventor.DrawingEdgeTypeEnum.kBendDownEdge _ Or oCurve.EdgeType = Inventor.DrawingEdgeTypeEnum.kBendUpEdge Then ' Create the bend note oBendNote = oSheet.DrawingNotes.BendNotes.Add(oCurve) End If
The variables "extentslength" and "extentswidth" remain = 0
What is the correct syntax for getting this data for each sheetmetal part?
Thanks
Richard
Ok?
The code you posted is simply intended to be ran from a part file and creates the flat pattern/drawing....
So do just that - open the part file and let the rule create the flat pattern?
Your needs otherwise aren't very clear, and there is no obvious attempts in the code to make it be ran from an assembly, or to even do anything to expand it's functionality.
Can't find what you're looking for? Ask the community or share your knowledge.