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: 

iLogic Rule to insert sheet metal thickness

18 REPLIES 18
SOLVED
Reply
Message 1 of 19
SeanFarr
5760 Views, 18 Replies

iLogic Rule to insert sheet metal thickness

Hello,

 

In my title block I have a material section that pulls to iProperties from the model

One is material, which displays the material used in the model

and the other is manually input by me in the comments section of the model, I typically only use this field for sheet metal description, example, .125 Sheet Metal,  this saves me from a drawing view to show thickness only.

 

iproperty.png

 

In my sheet metal template I have checked the little box for the thickness model parameter so it will show up as a custom property - model.

 

So i can display the thickness parameter anytime the sheet metal base view is placed.

 

My issue is I want the thickness property to have the following with it "Sheet Metal"

 

But I only want this to appear if the base view is in fact sheet metal, all other parts and assemblies, this field would be blank,

 

So this is what I want when a sheet metal part is placed:

 

iproperty2.png

 

This is what I want to display when a part is placed:

iproperty3.png

 

This is what I get when anything is placed:

 

iproperty4.png

 

Sheet Metal shows up because:

 

iproperty5.png

 

I am looking for help for a Rule that will only apply <Thickness> Sheet Metal to my title block only if the base view is in fact a sheet metal part. Is this possible??

 

Thanks for any help!

Sean Farr
Product Designer at TESInc.ca

Inventor Professional 2014-Update 2 - AutoCAD Electrical 2014
Win7-x64 | ASUS P8Z77-V | i7 3770 -3.4 GHz | 32GB RAM |
240GB SSD | nVidia GTX 670 4GB - 320.49
18 REPLIES 18
Message 2 of 19
SeanFarr
in reply to: SeanFarr

Scratch that, this thread was my option B attempt,

 

I managed to get Option A to finally work over here...which is a much simpler solution!!

 

For curiosity sake though this is what I was working on for a rule to grab thickness, but couldnt quite get there. Anyone know how to pull the Thickness Parameter from a Sheet Metal part and give a result showing <Thickness> Sheet Metal (ex. .125 in Sheet Metal)

 

'Sheet Metal Thickness into Title Block if base view is a sheet metal part

doc = ThisDoc.Document customPropertySet = doc.PropertySets.Item("Inventor User Defined Properties")
'Make sure SheetMetalThickness property exists Try prop = customPropertySet.Item("SheetMetalThickness") Catch 'Assume error means not found customPropertySet.Add("", "SheetMetalThickness") End Try 'Find the filename of the model used in the drawing If ThisDoc.ModelDocument Is Nothing Then Goto handleErrors ElseIf ThisDoc.ModelDocument.DocumentType = kPresentationDocumentObject Goto handleErrors Else modeldocname = IO.Path.GetFileName(ThisDoc.ModelDocument.FullFileName) End If 'Find the Thickness of the sheet metal model used in the drawing SheetMetalThickness = "TEST" 'Write the thickness of the model to the SheetMetalThickness custom iProperty. iProperties.Value("Custom", "SheetMetalThickness") = SheetMetalThickness InventorVb.DocumentUpdate() Exit Sub handleErrors: 'do nothing InventorVb.DocumentUpdate()

 Thanks In Advance!

Sean Farr
Product Designer at TESInc.ca

Inventor Professional 2014-Update 2 - AutoCAD Electrical 2014
Win7-x64 | ASUS P8Z77-V | i7 3770 -3.4 GHz | 32GB RAM |
240GB SSD | nVidia GTX 670 4GB - 320.49
Message 3 of 19
mrattray
in reply to: SeanFarr

You're working way to hard! (to quote JDM Smiley LOL)

This is all you need.

 

iProperties.Value("Custom", "SheetMetalThickness") = Thickness & " Sheet Metal"
Mike (not Matt) Rattray

Message 4 of 19
SeanFarr
in reply to: mrattray

I am slowly becoming to think I was better off without logic! Simply because I know what I want to do, but can never seem to get there!

 

I managed to get the <Sheet Metal Rule> to insert into my titleblock..Great!!

But now, when I create any other Standard Parts (non sheet metal) the material section of my title block will not auto-fill because it is searching for <Sheet Metal Rule>

 

Is there a way for a rule to:

  1. determine if base view is sheet metal or Standard part
  2. if sheet metal, apply the <sheet metal rule> custom iproperty from model
  3. and if it is a standard part, then apply material and comment iproperty from the model


I know i can create 2 different drawing templates, but ideally, I would like to keep just one for all my drawing purposes.

 

There must be a way to determine base view properties, then apply the iproperties based on that??

 

Thanks!

Sean Farr
Product Designer at TESInc.ca

Inventor Professional 2014-Update 2 - AutoCAD Electrical 2014
Win7-x64 | ASUS P8Z77-V | i7 3770 -3.4 GHz | 32GB RAM |
240GB SSD | nVidia GTX 670 4GB - 320.49
Message 5 of 19
mrattray
in reply to: SeanFarr

I, personally, don't like automating from the drawing side. It seems to always get messy. (We can do it that way if neccessary, but it's just not as pretty.)

I would set this up as a rule in the part template that populates a single property field with whatever information you want. We can determine from there whether it's a sheet metal part type or make use of some other means that you prefer to toggle methods of defining the property. From there it's trivial to write whatever data you want to the property.

Let me know exactly what you want and I'll be happy to whip something up for you.

Mike (not Matt) Rattray

Message 6 of 19
jdkriek
in reply to: mrattray

I agree with Matt. My ConstructStockNumber iLogic is in the part files. The rule in the sheetmetal template formats one way and the rule(s) in other templates format another way.

 

But you can easily determine what type of part is open. Here's an example.

 

Dim oDoc = ThisApplication.ActiveDocument
If oDoc.DocumentType = kPartDocumentObject Then 'Confirm part
	If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'Confirm Sheetmetal
		MsgBox("Sheetmetal Format")
		Stock = "PL " & dThickness
	Else 'Confirm Standard
		MsgBox("Standard Format")
		Stock = "PL " & RoundToFraction(dThickness, 1/32, RoundingMethod.RoundUp)  
	End If
iProperties.Value("Project", "Stock Number") = UCase(Stock)
End If
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 7 of 19
SeanFarr
in reply to: mrattray

From where I am at now, i think the simplist solution is to create this rule in the drawing template.

 

My workflow is create part or sheet metal part, fill a few iProperties, then once I insert my Base View onto drawing sheet, the drawing sheet is auto-filled.

 

If we can make a rule to do this, then I don't have to do anything to my part templates.

 

Also I know the easiest way to do this is to have 2 separate drawing templates, one that calls out the sheet metal rule property and the other will call out the simple material property, but if possible, I would like to have just one drawing template.

 

Thanks for your help!!

Sean Farr
Product Designer at TESInc.ca

Inventor Professional 2014-Update 2 - AutoCAD Electrical 2014
Win7-x64 | ASUS P8Z77-V | i7 3770 -3.4 GHz | 32GB RAM |
240GB SSD | nVidia GTX 670 4GB - 320.49
Message 8 of 19
SeanFarr
in reply to: jdkriek

hmm..i am not quite understanding then what it is you mean, in regards to having the rule in the part/sheet metal templates, how would I show the material of either a part or sheet metal component when the base view is inserted into the sheet.

 

For a standard part, i use the "material" iProperty and "comment" iProperty if more info is require

For Sheet Metal, the custom iProperty "<Sheet Metal Rule> "is used to relay what size and material of sheet metal is used.

 

I don't quite understand how to make the rules in the modeling templates apply to my drawing templates.(

 

Thanks!!

Sean Farr
Product Designer at TESInc.ca

Inventor Professional 2014-Update 2 - AutoCAD Electrical 2014
Win7-x64 | ASUS P8Z77-V | i7 3770 -3.4 GHz | 32GB RAM |
240GB SSD | nVidia GTX 670 4GB - 320.49
Message 9 of 19
mrattray
in reply to: SeanFarr

What John and I are suggesting is that you leave your drawing template how you have it (that is, set to pull a property's value), and use iLogic to populate the value of said property from within the part file. This is simpler (and therefore, more stable) because we're working right where everything is, instead of "reaching through a window" to the part's information.
Mike (not Matt) Rattray

Message 10 of 19
SeanFarr
in reply to: mrattray

I might be catching on,

 

So in a rough example here, on my drawing sheet I would have a custom iProperty in the titleblock called, lets say "CustomMaterial"

 

In my Standard part template, a rule that would take the material used in the part and apply it to "CustomMaterial"

 

and within my Sheet Metal template, a rule would take my <Sheet Metal Rule> and apply it to "CustomMaterial"

 

so what ever part/model is placed onto the drawing sheet the iProperty "CustomMaterial" will populate the material used information to the title block??

 

or something along these lines?

 

either way, if you guys say it is best to leave the drawing sheet, then I will, but I am not sure how to continue either way.

 

Thanks

Sean Farr
Product Designer at TESInc.ca

Inventor Professional 2014-Update 2 - AutoCAD Electrical 2014
Win7-x64 | ASUS P8Z77-V | i7 3770 -3.4 GHz | 32GB RAM |
240GB SSD | nVidia GTX 670 4GB - 320.49
Message 11 of 19
jdkriek
in reply to: mrattray

When you insert properties into your drawing title block or sketched symbols you can choose where that property comes from. In this case I have written to the Stock Number in the model, so I simply insert that into my drawing block. Which then of course displays automaticly when a view is inserted.

 

propsformmodel2.PNG

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 12 of 19
SeanFarr
in reply to: jdkriek

Ok, for material in a Standard part, I placed the material iproperty and this autofills no problem

but the problem occurs when I drop a sheet metal part, because I want more than just the material to show up,

maybe this image will help explain...

 

iproperty6.png

Thanks!

 

Sean Farr
Product Designer at TESInc.ca

Inventor Professional 2014-Update 2 - AutoCAD Electrical 2014
Win7-x64 | ASUS P8Z77-V | i7 3770 -3.4 GHz | 32GB RAM |
240GB SSD | nVidia GTX 670 4GB - 320.49
Message 13 of 19
SeanFarr
in reply to: jdkriek

Basically, I am avoiding manual input of values such as stock number etc...material is pre-determined by selection in modeling and my sheet metal rules are pre-defined as well in the sheet metal template.

 

Thanks

Sean Farr
Product Designer at TESInc.ca

Inventor Professional 2014-Update 2 - AutoCAD Electrical 2014
Win7-x64 | ASUS P8Z77-V | i7 3770 -3.4 GHz | 32GB RAM |
240GB SSD | nVidia GTX 670 4GB - 320.49
Message 14 of 19
mrattray
in reply to: SeanFarr

I would set this up so that your title block only references the <SheetMetalRule> property (or whatever property your heart desires; the point is one property, not two)
Then in your part file, you populate that one property with either just the material name, or all of the other info you want using an iLogic rule that looks at whether the part in question is sheet metal or not.
Mike (not Matt) Rattray

Message 15 of 19
jdkriek
in reply to: mrattray

My thoughts exactly Matt.

 

In this case MaterialInfo custom iProperty (or whatever you want) in the models will drive the drawing. If it's sheetmetal then it will contain SheetMetalRule custom iProperty else it will contain just the Material.

 

 

Dim oDoc = ThisApplication.ActiveDocument
If oDoc.DocumentType = kPartDocumentObject Then 'Confirm part
	If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'Confirm Sheetmetal
		Stock = iProperties.Value("Custom", "SheetMetalRule") 
	Else 'Confirm Standard
		Stock = iProperties.Material
	End If
iProperties.Value("Custom", "MaterialInfo") = Stock
End If
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 16 of 19
SeanFarr
in reply to: jdkriek

Thanks Jon and Matt!!

 

Been using Inventor everyday for over a year now and everyday you or someone else shows me something new!!

 

The seems to be working perfectly!!

 

send me a message if you ever end up in Sudbury, Ontario, I'll buy ya a drink!!

 

Thanks again!

Sean Farr
Product Designer at TESInc.ca

Inventor Professional 2014-Update 2 - AutoCAD Electrical 2014
Win7-x64 | ASUS P8Z77-V | i7 3770 -3.4 GHz | 32GB RAM |
240GB SSD | nVidia GTX 670 4GB - 320.49
Message 17 of 19
jdkriek
in reply to: SeanFarr

You are quite welcome Sean, glad we could point you in the right direction. 😉

 

Btw, it never hurts to have a little error checking:

 

Dim oDoc = ThisApplication.ActiveDocument
If oDoc.DocumentType = kPartDocumentObject Then 'Confirm part
	If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'Confirm Sheetmetal
		Try: Stock = iProperties.Value("Custom", "SheetMetalRule") 
			Catch: MsgBox("SheetMetalRule iProperty Doest not exist")
		End Try
	Else 'Confirm Standard
		Stock = iProperties.Material
	End If
	Try: iProperties.Value("Custom", "MaterialInfo") = Stock
		Catch: MsgBox("MaterialInfo iProperty Doest not exist")
	End Try
Else 
	MsgBox("File is not a part")
End If
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 18 of 19
jcabrera
in reply to: jdkriek

All i get is Steel, Mild. Do i need to setup iproperties before?

Message 19 of 19
xmortium
in reply to: jdkriek

Hello I hope you can help me, I just finished a sheet ire gradually modifying it through a multipurpose form iLogic em. The problem is this, I have in the box are several factors that will automatically fill because and easily schedule (NAME, SCALE, DATE, NO PLANO, ETC), however when a plane of a piece is done it automatically takes the material thereof and copies it to the box (there's no problem) the problem is that when he said assembly is not true for obvious reasons, what I want is to know how to sack the code in iLogic that when it is a this delimiting assembly can say (mixed or not Applicable N / A) through iLogic way or another. Thank you very much, Deputy sheet inventor 2015 version and given me blows to the head and not give how to solve this problem. Cheers Link leaf .....

 

http://a360.co/1M2OoHl

 

 

 

https://forums.autodesk.com/autodesk/attachments/autodesk/120/59353/1/Captura.JPG

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

Post to forums  

Autodesk Design & Make Report