Remove 2 characters from a string user parameter with ilogic inventor

Remove 2 characters from a string user parameter with ilogic inventor

jgomis.ext
Enthusiast Enthusiast
952 Views
4 Replies
Message 1 of 5

Remove 2 characters from a string user parameter with ilogic inventor

jgomis.ext
Enthusiast
Enthusiast

Hi everybody,

I think it's a simple problem, I would like to remove two characters in a string with ilogic.

I have this parameters :

jgomisext_0-1680869011829.png

And I would like to supress the ":1" in all theses parameters. If someone have the solution 🙂

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

bradeneuropeArthur
Mentor
Mentor
Could you share the ipt file

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 5

jgomis.ext
Enthusiast
Enthusiast

Hi, I can't because it's too big.

But i'am in an .iam and I find the names of my ipt with 

Form_name_viro = oAsmCompDef.Occurrences.Item(1).Name 'Virole

And the result of these names are the parameters updisdes 🙂 

0 Likes
Message 4 of 5

WCrihfield
Mentor
Mentor

Here is an example of a simple way to 'split' assembly component names into two parts, to get just the part before the colon (:) symbol.  When you use the 'Split' tool on a string, then specify what character to use as the splitting tool, it will return an array of Strings representing that original String split into multiple parts, determined by the splitting tool you specified.  Then I am just using (0) after that, to get the first item within that array of Strings, because array's are zero based, which means the first item index is zero, not one.

Dim sCompName As String = "Part1:1"
Dim sBeforeColon As String = sCompName.Split(":")(0)
Dim sAfterColon As String = sCompName.Split(":")(1)
MsgBox("sBeforeColon = " & sBeforeColon & vbCrLf & _
"sAfterColon = " & sAfterColon, vbInformation, "Split Component Name")

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 5

Curtis_Waguespack
Consultant
Consultant

Hi @jgomis.ext 

 

You could use the Trim function for this.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Dim TestString As String = "Long_Part_Name_Example:1"

TestString = TestString.Trim(CChar(":")).Remove(TestString.Length - 2)

MsgBox(TestString,,"iLogic")

 

EESignature

0 Likes