Community
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Flat Pattern length and width in Parameters / iProperties

Flat Pattern length and width in Parameters / iProperties

At the Moment, i get the sheet metal size by calling a macro that uses range box function.

It would be great, if these dimensions of the flat pattern (length and width) will appear as read only Parameter to use them in my iProperties - without using a macro.

If i change dimensions in an Assembly that affects the dimensions of the flat pattern, i have to open it and call the macro to get the updated sizes.

 

5 Comments
paul
Advocate

You can get this inside a drawing file - using the sheet extents, but really this is an iproperty. I agree. We need some Solid Edge power inside inventor.

machiel.veldkamp
Collaborator

I have something for sheetmetal that makes a Custom iProp called DIMENSIONS that you can put in your partslist or something. 

 

Here it is:

 

SyntaxEditor Code Snippet

'THIS CODE IS MEANT FOR AUTOMATICALLY DIMENSIONING FLAT PATTERNS 

Sub Main()
    Dim oDoc As PartDocument
    oDoc = ThisDoc.Document
    'ensure this part is a Sheet Metal Part - If not: exit this iLogic Rule ASAP
    If oDoc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}"
        Exit Sub
    End If
    
    Dim oSMDef As SheetMetalComponentDefinition
    oSMDef = oDoc.ComponentDefinition
        'Determines if there is a flat pattern
    If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
        If oSMDef.FlatPattern Is Nothing Then
            'No Flat Pattern Exists
            iProperties.Value("Custom", "DIMENSIONS") = "N/A"
        Else
            'There is a Flat Pattern
            GetExtents
            GetThickness
        End If
    Else 
        MessageBox.Show("THIS IS NO SHEET METAL", "ERROR")
    End If
    
End Sub

Sub GetExtents()
    LengthFrac = Round(SheetMetal.FlatExtentsLength, 0)
    WidthFrac = Round(SheetMetal.FlatExtentsWidth, 0)
    Dim oValue As String
    If WidthFrac > LengthFrac Then
        oValue = (WidthFrac & "x" & LengthFrac)
        
        iProperties.Value("Custom", "DIMENSIONS") = oValue
    Else
        oValue = (LengthFrac & "x" & WidthFrac)
        iProperties.Value("Custom", "DIMENSIONS") = oValue
    End If
End Sub

Sub GetThickness()
    'Get sheet Metal Thickness - Set Description as SHEET "Thickness"mm
    Dim oThickness As String
    oThickness = Parameter("Thickness")
    iProperties.Value("Project", "Description") = "SHEET " & oThickness  & "mm"
End Sub

 Make sure you set it to the triggerlist. I have it "Before save" and "When geometry changes"

dba78
Advocate

Hi,

 

for a Sheetmetal-Document, these iProps already Exist, but they are not visible in the iProp-Dialog.

 

All you have to do is use an expression in your new Custom iProp:

 

2017-02-24_15h21_19.png

 

U can use any iProp in an iProp-Expression, please refer here: iProp Expressions

 

The list of the Sheetmetal-Doc "Design Tracking Properties" is as follows (not tested the need of an actual existing Flatpattern in the Doc...)

 

Design Tracking Properties

Creation Time
Part Number
Project
Cost Center
Checked By
Date Checked
Engr Approved By
Engr Date Approved
User Status
Material
Part Property Revision Id
Catalog Web Link
Part Icon
Description
Vendor
Document SubType
Document SubType Name
Proxy Refresh Date
Mfg Approved By
Mfg Date Approved
Cost
Standard
Design Status
Designer
Engineer
Authority
Parameterized Template
Template Row
External Property Revision Id
Standard Revision
Manufacturer
Standards Organization
Language
Defer Updates
Size Designation
Categories
Stock Number
Weld Material
Mass
SurfaceArea
Volume
Density
Valid MassProps
Flat Pattern Width
Flat Pattern Length
Flat Pattern Area
Sheet Metal Rule
Last Updated With
Sheet Metal Width
Sheet Metal Length
Sheet Metal Area
Material Identifier
Appearance

 

and here the VBA-Code to retrieve them:

 

Sub iprop()
Dim doc As Document
Set doc = ThisApplication.ActiveDocument
Dim p As Property


Debug.Print doc.PropertySets(3).Name
For Each p In doc.PropertySets(3)
Debug.Print p.Name
Next


End Sub

I found these on myself "accidentally", I don't think this were documented...

HTH,

Daniel

 

 

Anonymous
Not applicable

Hello Guys

 

could someone please explain me what the number mean?

 

 "{4D29B490-49B2-11D0-93C3-7E0706000000}"
 "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"

I adapted your suggested method to our needs, so not we have it for the simple rule, but maybe we can also free ourselves from these number?

 

Sub main()
	
    Dim oDoc As PartDocument
    oDoc = ThisDoc.Document
	
    'ensure this part is a sheet metal part - if not: exit this ilogic rule asap
	
    If oDoc.SubType = "{4d29b490-49b2-11d0-93c3-7e0706000000}"
        Exit Sub
    End If
	
	Dim FlatPatternExist As SheetMetalComponentDefinition
	FlatPatternExist = odoc.ComponentDefinition
	
	'determines if there is a flat pattern
	
	If odoc.subtype = "{9c464203-9bae-11d3-8bad-0060b0ce6bb4}" Then
		If FlatPatternExist.FlatPattern Is Nothing Then
			
			'do nothing, write zeros in for the values
			SheetMetalLength = 0
			SheetMetalWidth = 0
			
		Else
				
			LengthValue = SheetMetal.FlatExtentsLength
			WidthValue = SheetMetal.FlatExtentsWidth
			SheetMetalLength = LengthValue
			SheetMetalWidth = WidthValue
				
		End If
			
	End If
		
		iLogicVb.UpdateWhenDone = True
		InventorVb.DocumentUpdate()
		
End Sub 

fx parameter.PNG

Yijiang.Cai
Autodesk

@Anonymous , this is the sub-type of document object. The document type of sheet metal and part document are the same, and we need to use sub-type of document to distinguish these two document type. 

These two numbers are the sub-Type (a published GUID. See DocCLSIDs.h) of this Document.

 "{4D29B490-49B2-11D0-93C3-7E0706000000}"
 "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"

  

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

Submit Idea  

Autodesk Design & Make Report