iLogic Component replace with user planes

iLogic Component replace with user planes

chayman
Enthusiast Enthusiast
551 Views
7 Replies
Message 1 of 8

iLogic Component replace with user planes

chayman
Enthusiast
Enthusiast

Hi there -

 

I have a question regarding user planes, iLogic and constraints.

 

Essentially, I have a TLA where that is driven by iLogic which includes a form. The code works great and all except when it comes to constraints. 

 

In my code, only one part will be replaced (depending on user criteria) and the TLA will adjust accordingly. HOWEVER, each time the part is replaced, it's original constraints are lost. So what I did, I went into each individual ipt that will be replaced, gave all parts the exact same planes (user created) named them the exact same name but I am still losing the relationships. So what I have basically done now is give each part it's own constraints and then suppressed all other constraints through iLogic. This was fine when only 3 parts were involved but now it is growing and becoming unmanageable.

 

Is there a simpler solution or something I am doing wrong?

 

0 Likes
552 Views
7 Replies
Replies (7)
Message 2 of 8

MechMachineMan
Advisor
Advisor

If your code is simply deleting then adding a different component, this behavior is expected.

 

If your code is using the Component.Replace method or the .ReplaceReference method, then it sounds like there is a deeper issue.

 

At any rate, post your code and we can take a look.

 

As well, iLogic based concerns are better suited in the Inventor Customization forum.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 3 of 8

Xun.Zhang
Alumni
Alumni

Hello,

Post your code with a sample file would be great for us to solve it.

Thanks!


Xun
Message 4 of 8

chayman
Enthusiast
Enthusiast

I don't delete the part, I use Component.Replace for all of them. Here is a snippet of one line of code:

 

SyntaxEditor Code Snippet

X_Motor = ThisDoc.Document.ComponentDefinition.Occurrences.Item(12).Name

'10HP
    '1200RPM
        If Motor = "10HP 256T 1200RPM" Then
        Component.Replace(X_Motor, "C:\Users\\Motors\Baldor_10HP_1180RPM_256T.ipt", True)
        Parameter("Motor Base:1", "Motor_E") = 5 in
        Parameter("Motor Base:1", "Motor_2F") = 10 in
        Parameter("Motor Base:1", "Motor_H") = 0.59375 in
        Parameter("Motor Base:1", "Slot_Length") = 1.75 in
        'Suppressed Constraints
            Constraint.IsActive("5HP_215T_1200RPM: Mate 3") = False
            Constraint.IsActive("5HP_215T_1200RPM: Flush 1") = False
            Constraint.IsActive("7.5HP_254T_1200RPM: Flush 1") = False
            Constraint.IsActive("7.5HP_254T_1200RPM: Mate 1") = False
            Constraint.IsActive("2/3/7.5HP_145/213T_900/1200/1800RPM: Mate 1") = False
            Constraint.IsActive("2/3/7.5HP_145/213T_900/1200/1800RPM: Flush1") = False
        'Active Constraints
            Constraint.IsActive("5/10HP_184/256T_1200/1800RPM: Mate 1") = True
            Constraint.IsActive("5/10HP_184/256T_1200/1800RPM: Flush 1") = True

 I have also attached a sample part (motor) that will be replaced under certain selections. All the planes that you see on the sample part are consistent with all other motors that are to be replaced. 

 

In my TLA, it takes 5 total constraints with the motor in order to have it function the way I want. Hence user planes WL_A through WL_D. It would be so much easier if I can just have 5 constraints drive the whole TLA rather than writing code for 'Active constraints vs 'Supressed constraints.

0 Likes
Message 5 of 8

chayman
Enthusiast
Enthusiast

Can I get any help with this?

0 Likes
Message 6 of 8

Xun.Zhang
Alumni
Alumni

Thanks for the sharing and let me invite iLogic expert @JaneFan to help you more.

Thanks!


Xun
0 Likes
Message 7 of 8

JaneFan
Autodesk
Autodesk

Hi @chayman

 

How about the behavior if you do the same step to replace the component via manually behavior in UI? Do the relative constraints retain as normal status after component replace operation? If so, there should be something wrong with Component.Replace() in iLogic with your model; otherwise, it is designed behavior that the replaced model and the original model don't match. 




Jane Fan
Inventor/Fusion QA Engineer
Message 8 of 8

chayman
Enthusiast
Enthusiast

@JaneFan

 

When I do a manual component replace, the same issue occurs. 3/5 constraints work, but 2/5 can't be resolved.

It's consistent with WP_C and WP_D if that helps.

 

WL_A, WL_B and WL_D all function correctly...these are the part origin (XZ, YZ and XY) planes. User planes D & C are offset planes from the base of the motor and the shaft....could something be incorrect there?

 

 

0 Likes