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 to Tie Engraved or Embossed Text to Part Number iProperty

12 REPLIES 12
Reply
Message 1 of 13
tdswanson
2553 Views, 12 Replies

iLogic to Tie Engraved or Embossed Text to Part Number iProperty

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!

12 REPLIES 12
Message 2 of 13
xiaodong_liang
in reply to: tdswanson

Hi tdswanson,

 

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

Message 3 of 13
tdswanson
in reply to: xiaodong_liang

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

 

Message 4 of 13
ian.solomon
in reply to: tdswanson

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?

Message 5 of 13
GosponZ
in reply to: ian.solomon

 Insert the User parameter you just created.

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

Message 6 of 13
tdswanson
in reply to: GosponZ

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!

Message 7 of 13
GosponZ
in reply to: tdswanson

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

Message 8 of 13
tdswanson
in reply to: GosponZ

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.

Message 9 of 13
GosponZ
in reply to: tdswanson

I just try with IV2013 working perfect

Thanks

Message 10 of 13
ian.solomon
in reply to: GosponZ

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.

 

Message 11 of 13
miechh
in reply to: tdswanson

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)
Message 12 of 13
miechh
in reply to: miechh

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)
Message 13 of 13
miechh
in reply to: miechh

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)

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

Post to forums  

Autodesk Design & Make Report