Need help with iLogic Holes - Pattern

Need help with iLogic Holes - Pattern

harrisons22K9B
Enthusiast Enthusiast
2,454 Views
14 Replies
Message 1 of 15

Need help with iLogic Holes - Pattern

harrisons22K9B
Enthusiast
Enthusiast

Hello,

I am a first time posters and am working on a project that has this cover plate.  I got it working to change size with iLogic, however one feature does not want to render.  The outer ring of bolt holes will only cut up to 12 holes...  I am new to this, and thus have no idea why the holes break on the larger sizes.

 

Anyone know why? 

 

Thanks.

0 Likes
Accepted solutions (1)
2,455 Views
14 Replies
Replies (14)
Message 2 of 15

A.Acheson
Mentor
Mentor

Welcome to the forum, it is good to have another member. 

 

I can't see your part but can you perform the qty change manually in the parameters box? If so what is happening? An error with the sketch or nothing at all?  Post the ilogic code if you think the problem is there. Just copy the code from the editor and paste into this post. If you can provide an image of the problem at hand that always helps too. 

 

For future ilogic related question you can post directly to https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/bd-p/120. For now just continue posting here and if this becomes an ilogic issue we can call a  moderator to move the post over. No need to retype it all again. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 15

harrisons22K9B
Enthusiast
Enthusiast
Here is the code I used, and I've included an picture of the cases:

'Modified code for Online Review
'Harrison S. 'Mechanical Designer: Camcorp Inc. 'harrisons@camcorpinc.com '----Constants----- Bolt_Ring_Offset = 0.75 in Lug_Hole_Offset = 1.625 in fillet_rad = 0.125 in Lug_Radius = 1.500 in lug_length_radius_to_fillet = 1.507 in 'unsure about this one as 24 may be different ' 'constant equation; distance of cover backside from (0,0,0) d1 = face_plane + flange_thickness '----------------- MultiValue.SetList("AL_Size", "10", "8", "12", "14", "16", "20", "24", "0") 'note Case 0 is for troubleshooting Select Case AL_Size Case "10" Outer_Diameter = 20 in Lift_Lug_Angle = 45 deg Shaft_Hole_Dia = 2.125 in Bearing_SQ = 4.375 in QTY_Holes = 12 ul cover_hole_dia = 1 in / 2 ul bearing_hole_dia = 9 in / 16 ul face_plane = 5.875 in Case "8" Outer_Diameter = 16 in Lift_Lug_Angle = 45 deg Shaft_Hole_Dia = 1.625 in Bearing_SQ = 4 in QTY_Holes = 12 ul cover_hole_dia = 7 in / 16 ul bearing_hole_dia = 9 in / 16 ul face_plane = 5.25 in Case "12" Outer_Diameter = 24 in Lift_Lug_Angle = 45 deg Shaft_Hole_Dia = 2.125 in Bearing_SQ = 4.375 in QTY_Holes = 16 ul cover_hole_dia = 7 in / 16 ul bearing_hole_dia = 9 in / 16 ul face_plane = 7.0625 in Case "14" Outer_Diameter = 24 in Lift_Lug_Angle = 45 deg Shaft_Hole_Dia = 2.125 in Bearing_SQ = 4.375 in QTY_Holes = 16 ul cover_hole_dia = 7 in / 16 ul bearing_hole_dia = 9 in / 16 ul face_plane = 8.5625 in Case "16" Outer_Diameter = 30.25 in Lift_Lug_Angle = 45 deg Shaft_Hole_Dia = 2.75 in Bearing_SQ = 5.625 in QTY_Holes = 16 ul cover_hole_dia = 1 in / 2 ul bearing_hole_dia = 3 in / 4 ul face_plane = 9.0625 in Case "20" Outer_Diameter = 34.25 in Lift_Lug_Angle = 45 deg Shaft_Hole_Dia = 2.6875 in Bearing_SQ = 5.625 in QTY_Holes = 20 ul cover_hole_dia = 7 in / 16 ul bearing_hole_dia = 5 in / 8 ul face_plane = 11.25 in Case "24" Outer_Diameter = 40.25 in Lift_Lug_Angle = 60 deg Shaft_Hole_Dia = 2.6875 in Bearing_SQ = 5.625 in QTY_Holes = 24 ul cover_hole_dia = 7 in / 16 ul bearing_hole_dia = 5 in / 8 ul face_plane = 13.25 in End Select
0 Likes
Message 4 of 15

cadman777
Advisor
Advisor

I count 12 holes in the parts requiring more holes than 12.

Is it possible that your 'QTY_Holes' variable is not registered in your CicularArray OccurranceCount (number-of-holes) in the 3d model?

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes
Message 5 of 15

harrisons22K9B
Enthusiast
Enthusiast

what menu am I looking for to check that?

0 Likes
Message 6 of 15

A.Acheson
Mentor
Mentor

Right click the pattern>edit> check qty has your variable parameter name QTY_Holes. If it does not, this will mean it is a static number and will not update from code. Alternately go to the parameters box and find the parameter name in the model parameters equation. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 7 of 15

cadman777
Advisor
Advisor

Here's a visual of what Alan said:

 

cadman777_0-1642694660093.png

 

 

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes
Message 8 of 15

WCrihfield
Mentor
Mentor

I opened the part that was originally posted.  A sketch with a circular pattern of center points being used by the Hole feature.  The model parameter that is being used as the quantity of the sketch pattern is the "QTY_Holes" parameter.  When I suppress both local iLogic rules, then I can change that parameter's value manually, and see the quantity of holes changing in the model.  However, the problem is that these parameter changes are changing the sketch pattern OK, but the hole feature is not updating its 'positions' properly.  It seems a bit random, if it will update properly.  And after changing the parameter's value, I am not seeing the 'update' tool highlight, which would indicate that it needs to be updated to see the changes.  I also tried clicking the Manage tab > Rebuild All tool, but that does not appear to fix the hole feature's positions either.  I can tell that what needs to happen is to get the hole feature and modify its HoleFeature.HoleCenterPoints, or something similar, to force it to update properly after the parameter change.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 9 of 15

harrisons22K9B
Enthusiast
Enthusiast

so I have to make a singular hole, and pattern the hole.  As opposed to making the pattern as points in a sketch?

0 Likes
Message 10 of 15

WCrihfield
Mentor
Mentor
Accepted solution

That might work out better for you in a configuration/automation type situation.  However, I came up with an additional iLogic rule that seems to be working for this situation.  This iLogic rule is set-up to be triggered to run when the value of that parameter changes.  Then it gets the Part document.  Then updates it.  Then gets the sketch that the hole feature is based on.  Gathers all center points within it into a collection.  Then gets the hole feature, and sets the collection of center points to it, as mentioned in my earlier post.  Check this out on your end and see if it will work for you.  (I was testing it while I had your other two local iLogic rules suppressed.)

Again, this would be in its own local iLogic rule.  Probably after the other two.

oTrigger = QTY_Holes
Dim oPDoc As PartDocument = ThisDoc.Document
oPDoc.Update
oSketch = oPDoc.ComponentDefinition.Sketches.Item("Sketch4")
Dim oCPoints As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
For Each oSPoint As SketchPoint In oSketch.SketchPoints
	If oSPoint.HoleCenter Then
		oCPoints.Add(oSPoint)
	End If
Next
'MsgBox("There are now " & oCPoints.Count & " center points in the sketch.",,"")
oHoleFeat = oPDoc.ComponentDefinition.Features.HoleFeatures.Item("Hole1")
Dim oHDef As SketchHolePlacementDefinition = oHoleFeat.PlacementDefinition
oHDef.HoleCenterPoints = oCPoints
oPDoc.Update

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡 or you can Explore My CONTRIBUTIONS

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 11 of 15

harrisons22K9B
Enthusiast
Enthusiast

will try this, if the alternative of making a hole, then patterning that fails.

 

I'm sure this will be helpful when I get to the more complex flanges later in the assembly.

 

Thanks all.

Message 12 of 15

cadman777
Advisor
Advisor

That's typically how I do it.

Making a group of SketchPoints is good if the pattern is inconsistent.

But if you want a symmetrical pattern of holes, the best way I found to do it is make 1 point and 1 hole, and then pattern the hole feature. Since I can't look at your part file (my Inventor is too old), I have to guess at what's going on.

 

@WCrihfield's remedy is good, but for me, it's too complicated. It requires learning more iLogic, and then trial-and-erroring it till I get it right, which can take days. Who wants to pay you for many days' time when youi can streamline the process using existing features? So whenever possible, I simplify the process by using existing Inventor features with simple iLogic.

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes
Message 13 of 15

WCrihfield
Mentor
Mentor

@harrisons22K9B , @cadman777 

It seems to me like it might make a slight difference in your drawing annotations, which way you produce those holes.  For instance, if you use the 'Hole and Thread' tool on the 'Feature Notes' panel of the 'Annotate' tab of a drawing to call out the holes.  If I'm remembering correctly, when you create all the holes in one hole feature, the quantity in that hole note will come out correct, but I can't remember if doing the holes by patterning one hole feature messes that up.  Either way, if the quantity note isn't right, it's just a minor irritation which is quickly fixable.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 14 of 15

cadman777
Advisor
Advisor

Good point.

I just checked and the hole count is correct when using the Hole annotation in the drawing.

However, I've encountered wrong hole count in drawing annotation many times in the past.

However, I never took the time to figure out what causes that and how to fix it.

I usually just manually change the number to reflect the reality of it.

But when you want to automate drawings, I suppose you have to get it right one way or the other.

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes
Message 15 of 15

harrisons22K9B
Enthusiast
Enthusiast

I recall something like that from basic training, but at this point I'm nearing a deadline and so showing it working is needed over quantities that I'm not going to get to in a month...

 

Do appreciate you typing up some code, and I will certainly look at it to decipher and learn it.  However that will be when I am off the clock.

0 Likes