Automated Centerline Pattern in Assembly

Automated Centerline Pattern in Assembly

shannon.lundrigan
Contributor Contributor
473 Views
3 Replies
Message 1 of 4

Automated Centerline Pattern in Assembly

shannon.lundrigan
Contributor
Contributor

I'm trying to add a circular centerline pattern to a drawing and have code that works for a part drawing, but I'm trying to apply this to an assembly view and get the "Object reference not set to an instance of an object" error.

I know that it's failing on the "GetPatternFaceIntent" line but I'm not sure how to fix it.

Any help is appreciated

 

Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Sheet:1")
Dim FrontView = Sheet_1.DrawingViews.ItemByName("Front")
oParam = Parameter("Part.ipt", "PatternInstances")

PatternQuantity = Parameter("Part.ipt", "PatternInstances")

CenterPoint = FrontView.GetIntent("Center Point")

Dim patternFaceList As New List(Of GeometryIntent)

For i = 1 To PatternQuantity

	Dim patternFace = FrontView.GetPatternFaceIntent("Circular Pattern8", {i }, 1)
	patternFaceList.Add(patternFace)

Next

Dim centerlinePattern = Sheet_1.Centerlines.AddCenteredPattern("Centerline Pattern", CenterPoint, patternFaceList, closed :=True)

(  Inventor 2022)

Shannon Lundrigan, P.Eng.
Technical Consultant - MFG
SolidCAD - A Cansel Company
0 Likes
474 Views
3 Replies
Replies (3)
Message 2 of 4

robertast
Collaborator
Collaborator

Try the examples here. Maybe it will work for you

http://hjalte.nl/40-hole-position-dimensions 

Message 3 of 4

WCrihfield
Mentor
Mentor

Hi @shannon.lundrigan.  I'm not familiar with the method you are using (GetPatternFaceIntent), but it doesn't look right to me, so I thought I would point you to the online help page for its documentation, which may help.  There are two variations of that method too...one for when the view is of a Part, and one for when the view is of an assembly.  It looks to me like the way you are filling in the values, it must be the part version.

Here is the link.

https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=6352450f-04e5-b408-a4c1-37d6f4c4bf8e 

As you can see, it is using a couple of odd objects (PatternFeatureIndexArgument & FaceIndexArgument) as its second and third input variable types.  This leads me to believe that you may have to construct/create variables for those two objects to use in those two positions before that line of code, then use the two created variables into that method.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 4

Ralf_Krieg
Advisor
Advisor

Hello

 

Is it possible you only need to add the component name where the "Circular Pattern8" is located?

Dim patternFace = FrontView.GetPatternFaceIntent("Part.ipt","Circular Pattern8", {i }, 1)

 

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes