Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

2017 - SheetMetal Extents Properties

1 REPLY 1
Reply
Message 1 of 2
Anonymous
502 Views, 1 Reply

2017 - SheetMetal Extents Properties

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
Tags (2)
1 REPLY 1
Message 2 of 2
MechMachineMan
in reply to: Anonymous

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.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report