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: 

Uneven pattern with parameters

13 REPLIES 13
SOLVED
Reply
Message 1 of 14
Anonymous
799 Views, 13 Replies

Uneven pattern with parameters

Hi,

 

The single bar on the side needs to be patterned unevenly across the length. However due to this being a parametric model, there can be a ranging number of these from 3-30 meaning the sketch driven pattern may not work properly. Is there any way I can do this uneven pattern with custom number of these features? Thanks!cadfile5.JPG

Labels (1)
13 REPLIES 13
Message 2 of 14
WCrihfield
in reply to: Anonymous

Use a sketch pattern within the sketch that is driving this feature.  And use a UserParameter as the Quantity value.  That Quantity Parameter will do the math comparing part length and spacing between the lines, to figure how many it needs.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 14
Anonymous
in reply to: WCrihfield

Hi,

 

Is this what you mean? I am patterning the point within the sketch however can only do this in even spacings? Is there a way to do this unevenly?cadfile 7.JPG

Message 4 of 14
WCrihfield
in reply to: Anonymous

Oh, OK.  I guess I misunderstood the original post.  So, you're wanting to create a set of lines (or points) that are all uneven?  In that case, you're probably stuck with doing it manually.  To create a set of geometry using code automation, you're going to have to be able to explain the geometry and its placement/positioning mathematically, one way or another.  I am currently unaware of a randomizing method for creating geometry in Inventor right now.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 14
Anonymous
in reply to: WCrihfield

Yes essentially a hybrid between rectangular pattern and sketch driven where the user inputs how many of them and spacing between and the model shows this. I'll have a go and see what method I can come up with. Any other help is much appreciated. 

Message 6 of 14
WCrihfield
in reply to: Anonymous

Would a sketch pattern of a sketch pattern work for your application?  For example...first sketch a set of geometry, to use as the 'random' portion, then create a regular sketch pattern with all of the first set of geometry selected.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 7 of 14
Anonymous
in reply to: WCrihfield

Hi,

 

I'm not quite sure what you mean by this. Would you be able to edit the file i sent in the inital forum post and send it back with your suggestions? Thanks. 

Message 8 of 14
WCrihfield
in reply to: Anonymous

Nope. It sounded better in my head than it worked in reality.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 9 of 14
Anonymous
in reply to: WCrihfield

Do you know how to supress a certain occurence within the sketch driven pattern using ilogic. I have never used it but i understand its possible? Would you be able to explain it simply as I'm not very experienced with this!

 

Message 10 of 14
WCrihfield
in reply to: Anonymous

Sure. Once you've created either a Pattern in a Part using one of the tools within the (3D Model tab / Pattern panel), you can click the little plus sign next to that feature in the Model browser, then right click on one of the Occurrences, then choose Suppress.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 11 of 14
Anonymous
in reply to: WCrihfield

Would you be able to advise a way to do this automatically using Ilogic? 

Message 12 of 14
WCrihfield
in reply to: Anonymous

Yes, if I knew which I wanted to suppress.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 13 of 14
Anonymous
in reply to: WCrihfield

Hi,

 

I would like to suppress a feature called '140 JR PATTERN'. Would you be able to write a code to help? This didn't work for me:

This is the error: "ThisAssembly: This document "Parametric 1" is not an assembly."

Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
Dim oPattern As OccurrencePattern 
'calls the pattern by name
oPattern = oDoc.ComponentDefinition.OccurrencePatterns.Item("140 JR PATTERN") 

oPattern.OccurrencePatternElements(3).Components(1).OccurrencePatternElements(3).Suppressed=True

 

Message 14 of 14
WCrihfield
in reply to: Anonymous

Try this:

In the code below, I'm showing 3 different ways to do it.  I currently have the first two options commented out.

 

 

Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition

''Option 1
'For Each oFeat As PartFeature In oDef.Features
'	If oFeat.Name = "140 JR PATTERN" Then
'		oFeat.Suppressed = True
'	End If
'Next

''Option 2
'Try
'	Feature.IsActive("140 JR PATTERN") = False
'Catch
'	MsgBox("Couldn't turn the '140 JR PATTERN' off.")
'End Try

''Option 3
For Each oRPatt As RectangularPatternFeature In oDef.Features.RectangularPatternFeatures
	If oRPatt.Name = "140 JR PATTERN" Then
		Dim oFeats As ObjectCollection = oRPatt.Definition.ParentFeatures
		oRPatt.Suppressed = True
		For Each oFeat As Object In oFeats
			If oFeat.Type = ObjectTypeEnum.kExtrudeFeatureObject Then
				oFeat.Suppressed = True
			ElseIf oFeat.Type = ObjectTypeEnum.kWorkPlaneObject Then
				oFeat.Visible = False
			End If
		Next
	End If
Next

Let me know how these work for you.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report