- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Input the number of circular patterns as a parameter
hello
I completed the code to create a pattern using iLogic code.
I would like to input the number of patterns as a parameter so that the number of patterns changes depending on the parameter value.
However, since it is entered as a value rather than a parameter, the model does not change even if the parameter changes.
In the code, only integer values can be entered.
What should I do?
Please refer to the code below.
If (oCompName = "HOLDER-A:" & i) Or (oCompName = "HOLDER-B:" & i) Then Dim patName As String = oCompName & ":PATTERN" Dim patAngl As Integer = 360 / pAts Dim circPattern = Patterns.AddCircular(patName, oCompName, Parameter("HOLA_C"), patAngl, oCompName, "Z축", axisNaturalDirection := True, lockRotation := False)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Assuming that the code block iterates through all components and the oCompName is correctly reading the occurence.Name the following should be checked:
First, make sure that your parameter type for the number of patterns is unitless:
If (oCompName = "HOLDER-A:" & i) Or (oCompName = "HOLDER-B:" & i) Then
Dim patName As String = oCompName & ":PATTERN"
Dim patAngl As Integer = 360 / pAts
Dim circPattern = Patterns.AddCircular(patName, oCompName, pAts, patAngl, oCompName , "Z축", axisNaturalDirection := True, lockRotation := False)
End If
What is changed is the reference to 'pAts' in the function for the pattern.
Please let me know if it worked. If not, please share the code where oCompName is declared to get a better understanding.
Kind regards,
Alexander Boogaard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi!
You need an Integer number to use as the pattern repetition number.
But, If your pattern value comes from an function, sometimes you will not get an integer number:
Anyway, you can use some operators (similar to excel)to achieve the Integer number:
In this case i selected the lower Integer value, but you can set other options:
Tip: the units must be UL (unitless).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The part where pAts is defined is omitted..
pAts = Parameter("HOLA_C"),
Dim aOcc As Inventor.ComponentOccurrence = ThisApplication.CommandManager.Pick(kAssemblyOccurrenceFilter, "Pick contente part to be patterned") Dim oCompName As String = aOcc.Name
Waiting for your reply...