Is there a way return the current row number of an iPart at the PART LEVEL without the use of component instances, or using findrow without changing the active row?
I have a repetitive part (valve housing) that users can customize with a form. Very often there are features (end fittings) included with threads. Currently, I use iParts to switch between "cosmetic" threads (for drawings) and modeled threads (for 3D printing) in my parts. I want to be able to set the end fitting type using the form and show/hide the modeled threads using iParts.
In this situation, the ilogic code related to the iParts should be completely dependent on which factory member has been activated by the user, not the other way around.
I've tried the following code and similar variants to simply return the active member rownumber without changing the active member, but it asks for the component instance. At the PART LEVEL, what would the component instance be? I'm using the filename property because this is for a template file, so the part name and member names will change when a user creates the part and specifies a part number for the file name (tried converting it to a string to play nicer with the rownumber function).
Can I use the findrow (use parent filename) function without the extra search criteria?
oName = CStr(ThisDoc.FileName(False)) rowNumber = iPart.RowNumber(oName)
I'm using Inventor 2021, windows 10.
Solved! Go to Solution.
Solved by dutt.thakar. Go to Solution.
You will probably need to detect the part is an iPart by the occurance then run a loop through the members in the factory and select by name which member you want to make active. To be clear you just want to select another member from the factory correct? How are you thinking of activating the rule?
Can you share a simple setup with the structure you will be using, What level will everything be at? Is the rule to be internal or external?
Im on inv2020 so a file may not help me but a few pictures would help too.
Can you share the code you have already tried? It will give some context 🤔
If you are looking for something like this, Try the below code in your iPart Factory file. It will return the index number of the active row.
Dim oDoc As PartDocument = ThisApplication.ActiveDocument Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition Dim oFactory As iPartFactory = oDef.iPartFactory Dim oRow As iPartTableRow = oFactory.DefaultRow MessageBox.Show(oRow.Index)
If this is not what you need, please try recording a screencast or video and explain what you are exactly trying to achieve.
Hope this helps.
This did exactly what I needed it to do. Thanks! I'm just learning about the component definitions in iLogic and didn't know I could pull ipart info using it.
Just as an FYI to anyone who is trying to recreate this, I found a workaround that actually aids with trigger events.
To reiterate, the intent of this code is to suppress specific features depending on the end fitting type (as they have different threads in different locations) so each one has its own coil feature. But at the same time, I want to be able to switch the modeled threads on and off (suppressed) regardless of which end fitting type it was for 3D printing and making drawings, respectively. This, in effect, doesn't allow for a static ipart table, as different features need to be suppressed for each type of end fitting, hence the need for the ilogic code being able to know what ipart member was active so that the code could do the suppressing for me.
My workaround involved making a custom iproperty (i called it threadsuppress). the iPart members would change this custom property to either YES or NO. The rule used this YES/NO condition for an if statement that either suppressed only the desired features based on the end fitting type, or suppressed all of them. This created a circular loop so that every time the member was changed, it changed an iProperty, which triggered the rule to run, which in turn suppressed the appropriate features.
Can't find what you're looking for? Ask the community or share your knowledge.