Place components using coordinates

Place components using coordinates

Anonymous
Not applicable
4,396 Views
9 Replies
Message 1 of 10

Place components using coordinates

Anonymous
Not applicable

I am trying to figure out a way to place a component in an assembly using coordinates relative from the WCS.  Anybody have any ideas?  I am setting up a routine to place then array components in an assembly.

0 Likes
Accepted solutions (1)
4,397 Views
9 Replies
Replies (9)
Message 2 of 10

blair
Mentor
Mentor

You can place the IPT in the IAM file and then use the "Current Offset from Parent Assembly Origin" in the iProperties Occurrence Tab.

 

A rather odd way to assembly a model, most place and ground the first component at the Origin in a correct position and then place and constrain the parts to the base part and other constrained parts in the IAM.

 

Or just place and constrain part to the Origin Plane(s) in the IAM.


Inventor 2020, In-Cad, Simulation Mechanical

Just insert the picture rather than attaching it as a file
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Delta Tau Chi ΔΤΧ

0 Likes
Message 3 of 10

Anonymous
Not applicable
True. It is a very weird way to create an assembly. I am trying to create a routine in iLogic to insert an iPart and then array it. This is a subassembly going into a major assembly. I am here for Autodesk Consulting to help a client integrate Inventor into their workflow. They want to have the routine establish everything from a single dialogue box. Insert the iPart at on offset position from the WCS, and then do an array. They want to be able to pick the component from a list, insert it at a given location from 3 datums (x,y,z) and then call out the column count, the row count, and then do it again. Non of the parts in this subassembly will be at the origin. I know I can go into iProperties and do the offset there, I am just trying to figure out if it can be done either in iLogic or VB.

Thanks for responding. It is lonely out here sometimes.

David M Anthony
Autodesk Evangelist
Professional Software Solutions
3152 Bown Way
Boise Idaho, 83706
208-550-5465

???

?
?
0 Likes
Message 4 of 10

blair
Mentor
Mentor

Not sure how to get at the Angle components in the Occurance Tab. Then if you can access the data through iLogic


Inventor 2020, In-Cad, Simulation Mechanical

Just insert the picture rather than attaching it as a file
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Delta Tau Chi ΔΤΧ

0 Likes
Message 5 of 10

Anonymous
Not applicable
Me neither. But it won't stop me from trying. If I figure it out, I'll shoot you an email and we can both celebrate. Lol.

David M Anthony
Autodesk Evangelist
Professional Software Solutions
3152 Bown Way
Boise Idaho, 83706
208-550-5465

???

?
?
0 Likes
Message 6 of 10

Curtis_Waguespack
Consultant
Consultant

Hi danthony,

 

Here is a quick iLogic rule that places a file based on provided co-ordinated (in centimeters).

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

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

 

' File path to use
oPath = "C:\Temp\block.ipt"

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim oMatrix As Matrix = oTG.CreateMatrix
Dim oOccurrence As ComponentOccurrence

' Place component
oOccurrence = oAsmCompDef.Occurrences.Add(oPath, oMatrix)
oMatrix.SetTranslation(oTG.CreateVector(0, 10, 0)) 
oOccurrence.Grounded = True 

EESignature

0 Likes
Message 7 of 10

Anonymous
Not applicable
Thank you so much. I will try this out and see if I can get it to work. I use your book to teach Inventor. I just finished a class teaching the power utility in Idaho, Idaho Power. They are a long time customer for training. This time they went with Frame Generator, Cable Generator and Stres Analysis. We also touched on iPart and iLogic. Good class and a good group of people.

Again, thanks. I'm honored to talk to you and receive your wisdom. I have been on Autodesk products since 1986, and am a person who wants to help all members of the community.

Thank you.

D

David M Anthony
Autodesk Evangelist
Professional Software Solutions
3152 Bown Way
Boise Idaho, 83706
208-550-5465

???

?
?
0 Likes
Message 8 of 10

cwhetten
Advisor
Advisor

You might have already thought of this, but in case you haven't:

 

Have you looked into iMates to see if they help with this situation?  That is, help with the placement--not the array.

 

Cameron Whetten
Inventor 2016

0 Likes
Message 9 of 10

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi danthony,

 

Thanks for the kind words.

 

Note that the previous example had a line of code out of order, and therefore did not set the co-cordinates correctly.

 

Here's an updated version that fixes that and creates the pattern as well. It also has some user inputs to make it bit easier to experiment with.

 

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

 

 

' File path to use
oPath = "C:\Temp\block.ipt"

'[ Place component
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim oMatrix As Matrix = oTG.CreateMatrix
Dim oOccurrence As ComponentOccurrence

'get user input
oX = InputBox("Enter the X co-ordinate, in inches.", "iLogic", "0")
oY = InputBox("Enter the Y co-ordinate, in inches.", "iLogic", "0")

'placement co-ordinates in cm's
oMatrix.SetTranslation(oTG.CreateVector(oX * 2.54, oY* 2.54, 0)) 
oOccurrence = oAsmCompDef.Occurrences.Add(oPath, oMatrix)
oOccurrence.Grounded = True 
'zoom all
ThisApplication.ActiveView.Fit
']

'[ create collection to hold item(s) to be patterned
Dim oParentOccs As ObjectCollection
oParentOccs = ThisApplication.TransientObjects.CreateObjectCollection

'add the component we just placed to the collection
oParentOccs.Add(oOccurrence) 
']

'[ create pattern
Dim oXAxis As WorkAxis
Dim oZAxis As WorkAxis
Dim oRectOccPattern As RectangularOccurrencePattern
oXAxis = oAsmCompDef.WorkAxes.Item(1)
oYAxis = oAsmCompDef.WorkAxes.Item(2)
'oZAxis = oAsmCompDef.WorkAxes.Item(3)

'get user input
oColCount = InputBox("Enter the Column count (X direction)", "iLogic", "2")
oColSpacing = InputBox("Enter the Column spacing (X direction) in inches", "iLogic", "1.6")
oRowCount = InputBox("Enter the Row count (Y direction)", "iLogic", "1")
oRowSpacing = InputBox("Enter the Row spacing (Y direction) in inches", "iLogic", "1.6")


oRectOccPattern = oAsmCompDef.OccurrencePatterns.AddRectangularPattern(oParentOccs, oXAxis, True, _
oColSpacing * 2.54, oColCount, oYAxis, True, oRowSpacing* 2.54, oRowCount)

'zoom all
ThisApplication.ActiveView.Fit
']

 

EESignature

Message 10 of 10

SharkDesign
Mentor
Mentor

This is brilliant!

Is there anyway to control which direction the part faces in?

  Inventor Certified Professional
0 Likes