an array of simple components with varying angle constraints.

an array of simple components with varying angle constraints.

mda2249
Enthusiast Enthusiast
371 Views
3 Replies
Message 1 of 4

an array of simple components with varying angle constraints.

mda2249
Enthusiast
Enthusiast

so far there is a few ways to do this, that' ive researched, my illogic being, just terrible. the simples way for me would be to create a sketch based pattern with lines spaced x_step apart, total number of 40, and each step, the line angles by 2.25 degrees.

then using imates, I will constrain the "simple component" to these lines, and pattern for what i'm needing.

**how can I use ilogic to create a pattern where the 40 lines are created, each one increases by 2.25 degrees.

I'm not attaching a file, because I don't see a need for that.

remember you are talking to a ilogic newb (so acronyms will not make sence to me); but I have found these resources; just struggling to put the pieces together.

 

option one is something like this: and then i'd have to still figure out the array.

https://modthemachine.typepad.com/my_weblog/2012/04/drawing-in-a-sketch.html

 

:this is option 2 to pattern and vary the angle using ilogic.

https://help.autodesk.com/cloudhelp/2019/DEU/Inventor-iLogic/iLogic_API/html/7d8a2ed5-bf8e-7908-430a...

 

this whole thing is confusing to be because if i could just index each step (of the pattern) i could just multiply the next step by 2.25 and manipulate it that way; no idea how to code this in illogic, maybe MATLAB if i could remember the syntax.

thanks all

-mda

0 Likes
372 Views
3 Replies
Replies (3)
Message 2 of 4

Ralf_Krieg
Advisor
Advisor

Hello

 

Option one

Will not work, cause there is no angle argument in a rectangular pattern.

 

Option two

You can create all the sketchlines, constraints and dimensions and add the part occurrences in your assembly and add there constraints again. This is a lot of code work to do. Don't know if this is necessary.

Is there any need to change the rotation angle or the distance between the occurrences later or are these values only varying on insert and will then be fixed?

 

It would be relative simple possible to add 40 occurrences of a part in an assembly, move and rotate each occurrence while they is inserted and ground it.

Here's an example. You will need a part document called "SimplePart.ipt" in C:\Temp or modify the path in line 23. Open an assembly and run the iLogic code. It will insert 40 occurrences. Everyone is moved by 20mm in X-direction and rotated 2.25° around Z-axis relative to the prior occurrence.

 

Dim iCnt As Integer = 40 'count of occurrences to insert
Dim dAngle As Double = 2.25 'angle in degree
Dim dDistance As Double = 20 'offset between occurrences

' Set a reference to the assembly component definintion.
' This assumes an assembly document is open.
Dim oAssDoc As AssemblyDocument=ThisDoc.Document
Dim oAsmCompDef As AssemblyComponentDefinition= oAssDoc.ComponentDefinition
Dim oTG As TransientGeometry= ThisApplication.TransientGeometry
Dim oTrans As Transaction= ThisApplication.TransactionManager.StartTransaction(oAssDoc, "Multinsert")
Dim i As Integer
Dim oMatrix As Matrix = oTG.CreateMatrix

Try
    For i = 0 To iCnt - 1
        ' Set the rotation of the matrix for a 2.25 degree rotation about the Z axis.
        Call oMatrix.SetToRotation(i * dAngle * 3.14159265358979 / 180, oTG.CreateVector(0, 0, 1), oTG.CreatePoint(0, 0, 0))
    
        ' Set the translation portion of the matrix so the part will be positioned at (i*20,0,0).
        Call oMatrix.SetTranslation(oTG.CreateVector(i * dDistance, 0, 0))
    
        ' Add the occurrence.
        Dim oOcc As ComponentOccurrence = oAsmCompDef.Occurrences.Add("C:\Temp\SimplePart.ipt", oMatrix)
        
        oOcc.Grounded = True
		
		oMatrix.SetToIdentity
    Next
	
	oTrans.End
Catch ex As Exception
	MsgBox(ex.Message & vbCrLf & ex.StackTrace, MsgBoxStyle.Critical, "iLogic")
	oTrans.Abort
End Try

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 3 of 4

arsenii_yavtushenko
Contributor
Contributor

Hello,

 

I have a little tough time following the idea, can you link a picture of the end result that you are trying to achieve?

 

To make a sketch pattern, you can create a Circular Array with a set angle, which will be equal to 2.5 degrees * 40 lines = 100 degrees from start to end. In this case, the distance between the bottom points of each line is determined by how far that bottom point is from the center of the array

 

iMates are designed to make quick and repeatable constraints in assemblies, if the macro you are trying to create does it all at once, you really don't need to deal with those, since regular constraints should suffice.

 

Those are the current ideas I have on the subject..

0 Likes
Message 4 of 4

mda2249
Enthusiast
Enthusiast

hello all, thanks for the feedback and help. i'll need some help here, and I thank you.

the idea is to pattern 40 (of the same) shapes, each instance angled +2.25 degrees from the last. so shape #3 is angled 4.5 degrees from the first one which is angled at zero. I just need something that will let me place the shape in quickly, so I don't have to change each sketch angle 40 times, and constraint each one 40 times and etc etc etc. I hope that hleps clear my question up. I will use imates, for constraints. 

 

attached is a screenshot of what i'm trying to automate.

mda2249_0-1651078680638.png

 

 

mda2249_1-1651078734315.png

 

0 Likes