Ilogic rule to create user paramètre on flat pattern

Ilogic rule to create user paramètre on flat pattern

gildas.lincot
Contributor Contributor
187 Views
1 Reply
Message 1 of 2

Ilogic rule to create user paramètre on flat pattern

gildas.lincot
Contributor
Contributor

Hi folks!

 

I need some help to create a new rule. I wish to create a user parameter in the flat pattern of a sheet metal part. This user parameter is a text format and it will be a contraction of the iproperties ’part number’ and the ’letter revision’ of the part.

Is there someone to help me ?

Thanks to any help.

Salut

0 Likes
188 Views
1 Reply
Reply (1)
Message 2 of 2

gcoombridge
Advisor
Advisor

@gildas.lincot have a try of this (code below). I was having issues unless I explicity named the parameters as belonging to the flat pattern but this seems to work.

Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
    
'ensure this part has a flat pattern
Dim oSMDef As SheetMetalComponentDefinition
oSMDef = oDoc.ComponentDefinition
Dim oUserP As UserParameter

If oSMDef.FlatPattern Is Nothing Then 
	'tell the user there is no flat pattern
	MessageBox.Show("This file has no flat pattern", "iLogic")
Else
	oSMDef.FlatPattern.Edit
		
		Try
			t = oSMDef.FlatPattern.Parameters.UserParameters.Item("FileStatus")
			oSMDef.FlatPattern.Parameters.UserParameters.Item("FileStatus").Value = iProperties.Value("Project", "Part Number") & " - " & iProperties.Value("Project", "Revision Number")
		Catch ' create parameter
			oUserP = oSMDef.FlatPattern.Parameters.UserParameters.AddByValue("FileStatus",iProperties.Value("Project", "Part Number") & " - " & iProperties.Value("Project", "Revision Number"),kTextUnits)
		End Try
	
	'oSMDef.FlatPattern.ExitEdit
End If

 It will check if there is a flat pattern. The parameter created is called "FileStatus" 

Use iLogic Copy? Please consider voting for this long overdue idea (not mine):https://forums.autodesk.com/t5/inventor-ideas/string-replace-for-ilogic-design-copy/idi-p/3821399
0 Likes