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: 

Assembly with iLogic

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
252 Views, 3 Replies

Assembly with iLogic

 Hello all,

I need to create an iLogic assembly like a train track, each piece of the rail butted against the next up to a desired overall length of track. The desired length of each rail would be no longer than 129 inches, and used as may times as possible, and then at the end of the track the last rail would be whatever is needed in length, but no longer than the maximum length. I am not sure if this can be sketch driven or if it is better to use iparts, constraints and overall length to drive the assembly. The overall length of the track would never be greater than 635 inches. I want to use as many of the same length rails as any difference in rail length would caused the need to create a new part number for that length rail.

 

Regards, Scott

 

3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

Hi Scott,

 

This is doable.  I'd start with the assembly and write a rule to calculate the quantities and lengths of each piece of your track, including the minimum length in the calcs if that's a requirement.

 

I see two different methods you could do for insertion of the parts:

 

  1. You could have the first piece (full sized) and last piece (remainder) already in the assembly and drive the full sized piece length as well as its patterns count and spacing, based off the calcs.  You can place the last piece and drive it's length in the same method.
  2. Make copies of template track parts and place them at specific coordinates and drive their lengths, again based off the calcs.

Sound fun?  🙂

 

 

Message 3 of 4
Anonymous
in reply to: Anonymous

Randy,

 

I am very new to iLogic and still getting the hang of the code and what I am having prolems with is digging down to the individual tack to change the lenght while in the assembly. I have been trying your first suggestion for some time, but when I change the lenght in the individual track through iLogic code it does not change in the assembly, even after hitting upate or adding the update code at end of program.

 

Thank you for your help,

 

Scott

 

Message 4 of 4
MechMachineMan
in reply to: Anonymous

'Database units are always cm so you may need to convert units to what you want to work with (as done in the line below)

oPatternOccurrenceNumber = Math.Floor( oDoc.UnitsOfMeasure.ConvertUnits(oDoc.ComponentDefinition.Parameters.Item("THICKNESS").Value, "cm", "mm") / 10) 'for 10 mm spacing

 

oPatternSpacing = 10 'mm

 

oDrivenDoc.ComponentDefinition.Parameters.Item("PatternOccurenceCount").Value = oPatternOccurrenceNumber

oDrivenDoc.ComponentDefinition.Parameters.Item("PatternSpacing").Value = oDrivenDoc.UnitsOfMeasure.ConvertUnits(oPatternSpacing, "mm", "cm")

 

 

 

 USE BELOW HERE; ABOVE IS AN EXAMPLE OF CHANGING UNITS AND DOING MATH THINGS

 

 

Dim oDoc As Document = ThisApplication.Documents.Open("C:\Backing Plate.ipt", False)     ' Change this as req'd

Dim oDrivenDoc As Document = ThisApplication.Documents.Open("C:\Driven Doc.ipt", False)   ' Change this as req'd

 

oDrivenDocParams = oDrivenDoc.ComponentDefinition.Parameters.

oDocParams = oDoc.ComponentDefinition.Parameters.

 

'To access parameter values within oDriven doc, use (after declaring as above):

'oDrivenDocParams.Item("PARAMETER_NAME_HERE").Value =

 

'To access parameter values within oDoc, use:

'oDocParams.Item("PARAMETER_NAME_HERE").Value =


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

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

Post to forums  

Autodesk Design & Make Report