ilogic change pattern column count

ilogic change pattern column count

susannah_lowryRR4FU
Explorer Explorer
125 Views
3 Replies
Message 1 of 4

ilogic change pattern column count

susannah_lowryRR4FU
Explorer
Explorer

In this assembly, I want to generate the full assembly on the [Primary] model state, and then add a second model state to isolate a few pieces (just one stack of occurrences in the y-direction). For the full assembly, I want the rectangular pattern to be parameter driven in both the x- and y- direction, but in the second model state I want to change the number of occurrences in the x direction only to 1. But when I look through the members of "RectangularOccurrencePattern" the number of columns is a read-only property. Is there a way to change that?

 

 

 

Dim AOCC1 = Components.AddWithModelState("A1", partPath, "[Primary]", , True)
Dim AOCC2 = Components.AddWithModelState("A2", partPath, "[Primary]")
Dim BOCC1 = Components.AddWithModelState("B1", partPath, "B BLOCK")

Dim TBOFFSET As Double = WINHT + RTOPINS + RBOTINS

'TOP & BOTTOM A BLOCKS
Constraints.AddMate("TOPBOTTOM",AOCC1,"BOTTOM",AOCC2,"TOP",TBOFFSET)
Constraints.AddFlush("AAFRONT",AOCC1,"FRONT",AOCC2,"FRONT")
Constraints.AddFlush("AARIGHT", AOCC1, "RIGHT", AOCC2, "RIGHT")


If REACTYPE = 1 'NORMAL
	
	Dim COCC1 = Components.AddWithModelState("C1", partPath, "C BLOCK") 'THIS IS THE ONLY REACTYPE THAT USES A C BLOCK, SO ADDING IT HERE
	
	Constraints.AddMate("C1BOTL",COCC1,"BOTTOM",AOCC2,"TOP",RTOPINS) 'CONSTRAINS C BLOCK TO BOTTOM LEFT SO PATTERNS ARE POSITIVELY DIRECTIONAL
	Constraints.AddMate("B1BOTL",BOCC1,"BOTTOM",COCC1,"TOP",REALGAP) 'CONSTRAINS B BLOCK TO BOTTOM LEFT SO PATTERNS ARE POSITIVELY DIRECTIONAL

Constraints.AddFlush("CFRONT", AOCC1, "FRONT", COCC1, "FRONT")
Constraints.AddFlush("BFRONT", AOCC1, "FRONT", BOCC1, "FRONT")
Constraints.AddFlush("CLEFT", AOCC1, "LEFT", COCC1, "LEFT")
Constraints.AddFlush("BLEFT", AOCC1, "LEFT", BOCC1, "LEFT")


Dim XPATT As Double = WINWID + STRIP 'WIDTH OF PATTERN ACROSS CORE
Dim YPATTC As Double = WINHT - CBLOCK 'C BLOCK PATTERN VERTICAL DIST
Dim YPATTB As Double = REALGAP + BBLOCK45 'B BLOCK PATTERN VERTICAL DIST
Dim BROWS As Integer = GAPS - 1 'NUMBER OF B BLOCKS

	Dim Cpatt = Patterns.AddRectangular("CBLOCKS", COCC1, LEGS, XPATT, Nothing, "X Axis", _
	columnNaturalDirection := True, rowCount := 2, rowOffset := YPATTC, rowEntityName := "Y Axis", rowNaturalDirection := True)
	
	
'B BLOCK PATTERN
	Dim Bpatt = Patterns.AddRectangular("BBLOCKS", BOCC1, LEGS, XPATT, Nothing, "X Axis", _
	columnNaturalDirection := True, rowCount := BROWS, rowOffset := YPATTB, rowEntityName := "Y Axis", rowNaturalDirection := True)	


oModelStates.Add("LEG")
Component.IsActive("A1") = False
Component.IsActive("A2") = False
'... and then i have no idea how to change the amount of columns in Bpatt & Cpatt to 1

 

0 Likes
Accepted solutions (1)
126 Views
3 Replies
Replies (3)
Message 2 of 4

Curtis_Waguespack
Consultant
Consultant

Hi @susannah_lowryRR4FU ,

The simplest way might be to just use the addrectangular function again, like this:

oModelStates.Add("LEG")
Component.IsActive("A1") = False
Component.IsActive("A2") = False
Patterns.AddRectangular("BBLOCKS", BOCC1, LEGS, 1, Nothing, "X Axis", _
	columnNaturalDirection := True, rowCount := BROWS, rowOffset := YPATTB, rowEntityName := "Y Axis", rowNaturalDirection := True)	

 
But you could also get the API object of the pattern, from the iLogic object, and set it like this:

oModelStates.Add("LEG")
Component.IsActive("A1") = False
Component.IsActive("A2") = False
'get the API object of the pattern
Dim Bpatt_API_Object As RectangularOccurrencePattern = Bpatt.Pattern
Bpatt_API_Object.ColumnCount.Value = 1
'Bpatt_API_Object.RowCount.Value = 1

 
See link for more about the RectangularOccurrencePattern Object: 

https://help.autodesk.com/view/INVNTOR/2026/ENU/?guid=GUID-RectangularOccurrencePattern

Hope that helps, Curtis

EESignature

0 Likes
Message 3 of 4

WCrihfield
Mentor
Mentor
Accepted solution

Hi @susannah_lowryRR4FU.  In your first post you mentioned that the RectangularOccurrencePattern.ColumnCount property being ReadOnly.  If you notice, its value is a 'Parameter' object.  So, even though the property is ReadOnly, we can still access that Parameter, then change the value of that Parameter (Parameter.Value).  We just can not set a different Parameter object as the value of that property directly.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 4

susannah_lowryRR4FU
Explorer
Explorer

Holy crap, that did it! Thank you so much! In case anyone else has this problem (or I have it again sometime and forgot what happened), here's what I have now.

 

Dim compDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim oCPat As RectangularOccurrencePattern
Dim oBPat As RectangularOccurrencePattern

oCPat = compDef.OccurrencePatterns.Item("CBLOCKS")
oCPat.ColumnCount.Value = 1
oBPat = compDef.OccurrencePatterns.Item("BBLOCKS")
oBPat.ColumnCount.Value = 1

 

0 Likes