iLogic to Tie Engraved or Embossed Text to Part Number iProperty

iLogic to Tie Engraved or Embossed Text to Part Number iProperty

tdswanson
Collaborator Collaborator
3,132 Views
12 Replies
Message 1 of 13

iLogic to Tie Engraved or Embossed Text to Part Number iProperty

tdswanson
Collaborator
Collaborator

Hey everyone:

 

I'm happy to report that after soaking up tons and tons of information here, I finally have something to actually contribute to the masses......

 

I had wanted to find a way to engrave/emboss the part number on a part model and have it be parametrically tied to the part number iProperty.  Since it doesn't appear that I can create a text box and insert the iProperty directly, here's what I did to work around this.  (I setup my part templates to have this out of the box....)

 

1.  Within, the IPT file, add a user text parameter called "PartNo" and set its initial value to any text value.

2.  Create your sketch for your text to be engraved.  Insert the User parameter you just created.

3.  Create the engraving/embossing for your text.

4.  Create the following iLogic rule:

 

' Requires a User Text Parameter called "PartNo" prior to running
' Set the appropriate event trigger to taste
If Parameter("PartNo") <> iProperties.Value("Project", "Part Number") Then
Parameter("PartNo") = iProperties.Value("Project", "Part Number")
InventorVb.DocumentUpdate()
End If

 5.  I set this rule to fire using the "iProperty Change" event trigger.  So if the iProperty is set or changed, your text will update.  Obviously, you can set this to run with whatever trigger you like.

 

Use it in good health!

3,133 Views
12 Replies
Replies (12)
Message 2 of 13

xiaodong_liang
Autodesk Support
Autodesk Support

Hi tdswanson,

 

This is really cool! Thanks a lot sharing the good solution! It will be of much help for some developers.

0 Likes
Message 3 of 13

tdswanson
Collaborator
Collaborator

No problem.  Glad I could finally offer something rather than just sponge!

 

0 Likes
Message 4 of 13

Anonymous
Not applicable

This is a great piece of code. Thanks.

 

I am trying to apply it to an iPart Factory part so it propgates the part number to engraved text on each of the family member parts.

 

It works in the partent part, but the family parts only get the part number of whatever member is active in the parent.

 

Any ideas what 'trigger' I can use to make it work in this instance?

0 Likes
Message 5 of 13

GosponZ
Collaborator
Collaborator

 Insert the User parameter you just created.

I can't insert text parameter. Can you explain? Inventor 2012

0 Likes
Message 6 of 13

tdswanson
Collaborator
Collaborator

1.  Start a sketch on the plan where you want the text.

2.  Make a text box where in the sketch

3.  In the drop down called "source", change the value from "Model Parameters" to "User Parameters"

4.  In the Parameter drop down, choose the parameter you created

5.  Click the "Add Parameter" button to the right.

 

Now the parameter is there and you can format the text as required.....

 

Good luck!

0 Likes
Message 7 of 13

GosponZ
Collaborator
Collaborator

I know that but it doesn't work in 2012 i beleive.

0 Likes
Message 8 of 13

tdswanson
Collaborator
Collaborator

Hmmm.  I would have thought that I was using IV2012 when I created this procedure, but I'm not sure.  If the above method doesn't work or isn't available, then you're probably right.  I'm certain that I was using this in IV2013 though.

0 Likes
Message 9 of 13

GosponZ
Collaborator
Collaborator

I just try with IV2013 working perfect

Thanks

0 Likes
Message 10 of 13

Anonymous
Not applicable

Any ideas on how to propogate this to the iPart family members?. The part number is correct in the child parts, but the text does not update.

 

0 Likes
Message 11 of 13

miechh
Collaborator
Collaborator

A bit of a late response... BUT this is really great!


Product Design Suite 2024
Inventor 2024 (v 28.20.27200.0000), Vault Basic 2024
Fusion 360
HP Workstation Z4
Intel Xeon 3.4GHz
32GB RAM
Windows 10 Professional (64bit)
0 Likes
Message 12 of 13

miechh
Collaborator
Collaborator

One thing though, I'm trying this technique to do the same in the Flat Pattern of a sheet metal part. We want the engraving to be visible only in the flat pattern. First problem is that the user text parameter that's driven by the iLogic rule, is not available in the Flat Pattern, but in the Folded Model only. Making a new user text parameter in the Flat Pattern, then in iLogic copying the program line responsible for filling in the user parameter and pointing it to the newly created parameter doesn't work. Is it even possible to control text parameters in the Flat Pattern with iLogic?


Product Design Suite 2024
Inventor 2024 (v 28.20.27200.0000), Vault Basic 2024
Fusion 360
HP Workstation Z4
Intel Xeon 3.4GHz
32GB RAM
Windows 10 Professional (64bit)
0 Likes
Message 13 of 13

miechh
Collaborator
Collaborator

Found the solution here:

 

http://forums.autodesk.com/t5/inventor-customization/sheetmetal-flat-pattern-sketch-parameters/m-p/4...

 

My code:

' Requires a User Text Parameter called "PartNo" prior to running
' Set the appropriate event trigger to taste
Dim oDoc as Document = ThisApplication.ActiveDocument 'Get handle to active document
Dim pd_Part As PartDocument = oDoc	'Get handle to part
Dim cd_Def as SheetMetalComponentDefinition = pd_Part.ComponentDefinition	'Get handle to componentdefinition
Dim p_param as Parameter = cd_Def.FlatPattern.Parameters.UserParameters("DXFFF")	'Declare variable linked to flat pattern user parameter

TempString = iProperties.Value("Custom", "DXF_FILENAME")& "_" & iProperties.Value("Project", "Revision Number")
If Parameter("DXFF") <> TempString Then	'Something changed? Then follow steps below
	Parameter("DXFF") = iProperties.Value("Custom", "DXF_FILENAME")& "_" & iProperties.Value("Project", "Revision Number") 'Fill Folded Model user parameter with new contents
	p_param.Value = Parameter("DXFF")	'Fill Flat Pattern user parameter with new contents
	InventorVb.DocumentUpdate()
End If

Product Design Suite 2024
Inventor 2024 (v 28.20.27200.0000), Vault Basic 2024
Fusion 360
HP Workstation Z4
Intel Xeon 3.4GHz
32GB RAM
Windows 10 Professional (64bit)
0 Likes