iLogic

Anonymous

iLogic

Anonymous
Not applicable

I have a train of cars which can range from 2 to 240 cars depending on parameters given by a user. The cars are connected to each other via work points that located on either end. I need to place a final bumper at the end of this assembly. I am looking to create ilogic code or something that will locate the last car in the assmebly then locate the correct work point on this car and finally attach the bumper. If it is even possible.

0 Likes
Reply
Accepted solutions (1)
1,025 Views
10 Replies
Replies (10)

MechMachineMan
Advisor
Advisor

Do you just have it suppressing the cars from one end in order to get it to the right number?


--------------------------------------
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
0 Likes

Anonymous
Not applicable

Yes. I have a message box that displays the number of cars visible in the assembly.

0 Likes

MechMachineMan
Advisor
Advisor
Could you just have the first and last car and pattern the peices between; not actually have the last car connect to the 2nd last one, instead it would be placed by distance from the first, and the other parts would be patterned to perfect fill the distance? This wouldn't work if you need flexibility in the model, however.

--------------------------------------
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
0 Likes

Anonymous
Not applicable

I actually tried that and it didnt quite work because the number of cars varies.

0 Likes

MechMachineMan
Advisor
Advisor
The length of cars varies? If the number of cars varies you can just change
the amount of cars created by the pattern...?

--------------------------------------
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
0 Likes

Anonymous
Not applicable

The number of cars vary. I attached a picture of the different ways that the line of cars could end up. The red and green lines are the different possiblities so the location of the last car could vary. I cannot make these different options using a pattern. Does this make sense? I am really bad at explanations...  

 

 getting to second street.png

0 Likes

MechMachineMan
Advisor
Advisor

Ahh yes, I see.

If it works for you, you could always make an assosciative pattern along any of the given full paths i think.


or you could use an imate on the tail end of the cars and to join them and then just have a bumper inserted at the last remaining open iMate.

 


--------------------------------------
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
0 Likes

Anonymous
Not applicable

The only thing is that the lengths change automatically. I'm trying to find a way for the final bumber to snap automatically into place whenever the length is changed.

0 Likes

Anonymous
Not applicable

Do you know of any code that would allow me to locate the last car and then constrain the bumper to it?

0 Likes

Anonymous
Not applicable
Accepted solution

 

Sub Main()

    Dim oAsmCompDef As AssemblyComponentDefinition
    oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition


       Dim oOcc1 As ComponentOccurrence
    oOcc1 = oAsmCompDef.Occurrences.Item(245)

    Dim oOcc2 As ComponentOccurrence
    oOcc2 = oAsmCompDef.Occurrences.Item(246)


        Dim oPartPoint1 As WorkPoint
     oPartPoint1 = oOcc1.Definition.WorkPoints.Item(1)

    Dim oPartPoint2 As WorkPoint
    oPartPoint2 = oOcc2.Definition.WorkPoints.Item(1)

    Dim oPartPlaneXY As WorkPlane
    oPartPlaneXY = oOcc1.Definition.WorkPlanes(3)
    
    Dim oPart2PlaneXY As WorkPlane
    oPart2PlaneXY = oOcc2.Definition.WorkPlanes(3)

    
        Dim oAsmPoint1 As WorkPointProxy
    Call oOcc1.CreateGeometryProxy(oPartPoint1, oAsmPoint1)

    Dim oAsmPoint2 As WorkPointProxy
    Call oOcc2.CreateGeometryProxy(oPartPoint2, oAsmPoint2)
    
    Dim oPartPlane1 As WorkPlaneProxy 
    Call oOcc1.CreateGeometryProxy(oPartPlaneXY, oPartPlane1)
    
    Dim oPart2Plane1 As WorkPlaneProxy
    Call oOcc2.CreateGeometryProxy(oPart2PlaneXY, oPart2Plane1)

    
    ' Create the constraint using the work point proxies.
    Call oAsmCompDef.Constraints.AddMateConstraint(oAsmPoint1, oAsmPoint2, 0)
    Call oAsmCompDef.Constraints.AddMateConstraint(oPartPlane1, oPart2Plane1, 0)
 
End Sub