Stock Number for different sheet metal rules

Stock Number for different sheet metal rules

ThomasSwanson
Advocate Advocate
971 Views
4 Replies
Message 1 of 5

Stock Number for different sheet metal rules

ThomasSwanson
Advocate
Advocate

Hello All,

 

I'm trying to come up with a way to automate the filling of the stock number field in the iproperties for different sheet metal rules.  Currenlty I have linked the name of the rule to the description field using the =<Sheet Metal Rule>. So using that varible is out. 

 

A quick solution was to make custom materials for all of the stock numbers and then link that to the sheet metal rule using the material box.  This will work except I need to show material name on the parts list. 

 

If only each sheet metal rule had its on iproperties, this would be so easy.

 

Can this be done with Ilogic? 

 

Thanks

 

Forgot to add Inventor pro 2013

0 Likes
972 Views
4 Replies
Replies (4)
Message 2 of 5

jtylerbc
Mentor
Mentor

I think you can do this with iLogic.

 

Use " SheetMetal.GetActiveStyle() " to find the name of the currently active sheet metal rule.

 

You can then use it to define If / Then /ElseIf statements to set your stock number.  For example:

 

If SheetMetal.GetActiveStyle() = "Default" Then
	iProperties.Value("Project", "Stock Number") = "12345"
	
ElseIf 'Insert next condition
	'insert next Stock Number line
End If

 

Add as many ElseIf statements as you need to set the stock numbers for all your sheet metal rules.

 

0 Likes
Message 3 of 5

ThomasSwanson
Advocate
Advocate

Thanks for the quick reply.  I've been slammed so I haven't have a chance to try it out until today. 

It seems to be working well.  I just have one follow up question and I'm sure its syntax related.  All of the sheetmetal rule names have the " symboyl in them such as 1 1/2" HR Plate.   How can I add the name of the sheetmetal rule in because the extra " seems to mess up the code.

 

Thanks

0 Likes
Message 4 of 5

jtylerbc
Mentor
Mentor

That does seem syntax related. My first impulse would be to tell you to just take the quote marks out of the style names. However, you may have reasons I'm not aware of that would make that undesirable.

Maybe someone else with more coding knowledge than mine will come along with a solution for including quotes without interfering with the code - I'm not aware of one myself.


0 Likes
Message 5 of 5

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

probably you have found how to do 🙂

 

add one more  " ahead of the char ".

 

iProperties.Value("Project", "Stock Number") = "1 1/2"" HR Plate"

 

0 Likes