Suppress a feature in Model in Drawing

Suppress a feature in Model in Drawing

tmathieson
Advocate Advocate
482 Views
4 Replies
Message 1 of 5

Suppress a feature in Model in Drawing

tmathieson
Advocate
Advocate

Hello All,

 

hope everyone is doing alright.  i am working on a ilogic rule for creating a drawing package, and it is coming along quite well.  i am having one issue where i want to suppress some features in the view model based on certain criteria.  my issue is i can't figure out how to get the feature suppress. i can update parameters OK, but this is giving me issues. i keep getting an error on the  'hole_suppress.Add' line...

 

"Error on Line 186 : Argument not specified for parameter 'Index' of 'Public ReadOnly Default Property Item(Index As Object) As Inventor.PartFeature'. "

 

			
			Dim oPartDef_FORM As PartComponentDefinition
			oPartDef_FORM = oModel_formed.ComponentDefinition
			oBaseView_FORMED = NewSheet.DrawingViews.AddBaseView(oModel_formed, oPoint3, 1 / 30, ktopViewOrientation, kHiddenLineRemovedDrawingViewStyle, , , oBaseViewOptions)
			oBaseView_FORMED.RotateByAngle(PI)
			'
			' NOW PASS PARAMETERS TO FORMED PART
			'
			oPart_F = oBaseView_FORMED.ReferencedDocumentDescriptor.ReferencedDocument
			propSet = oPart_F.PropertySets.Item("Inventor User Defined Properties")
			oPartDef_FORM.Parameters.Item("CROWN_RADIUS").Value = c_rad_1
			oPartDef_FORM.Parameters.Item("INSIDE_RADIUS").Value = H_RAD_1 
			oPartDef_FORM.Parameters.Item("PITCH").Value=PITCH_V 
			oPartDef_FORM.Parameters.Item("NUMB_S_HAUNCH").Value=H_RAD_H 
			oPartDef_FORM.Parameters.Item("NUMB_S").Value=TOT_S 
			oPartDef_FORM.Parameters.Item("DEPTH").Value=DEPTH_V 
			oPartDef_FORM.Parameters.Item("CIRC_HOLE_SP").Value=CIR_HOLE_SP_V
			oPartDef_FORM.Parameters.Item("FLAT_SPOT").Value=FLAT_SPOT_V
			oPartDef_FORM.Parameters.Item("LEG_S").Value=LEG_S_V 
			oPartDef_FORM.Parameters.Item("LEG").Value = LEG_LENGTH_V
			oPartDef_FORM.Parameters.Item("THICKNESS").Value = THICKNESS_V
			Dim hole_suppress As ObjectCollection
			hole_suppress.Add oPartDef_FORM.Features.Item.Name("HAUNCH_SIDE_HOLES")
			If LEG_S_V <= 1 Then
			    oPartDef_FORM.SuppressFeatures(hole_suppress)
			End If

 as always, any help/insight is greatly appreciated!

0 Likes
Accepted solutions (2)
483 Views
4 Replies
Replies (4)
Message 2 of 5

Andrii_Humeniuk
Advisor
Advisor
Accepted solution

Hi @tmathieson . Please check if it works as you wanted.

Dim oPartDef_FORM As PartComponentDefinition
oPartDef_FORM = oModel_formed.ComponentDefinition
oBaseView_FORMED = NewSheet.DrawingViews.AddBaseView(oModel_formed, oPoint3, 1 / 30, ktopViewOrientation, kHiddenLineRemovedDrawingViewStyle, , , oBaseViewOptions)
oBaseView_FORMED.RotateByAngle(PI)
'
' NOW PASS PARAMETERS TO FORMED PART
'
oPart_F = oBaseView_FORMED.ReferencedDocumentDescriptor.ReferencedDocument
propSet = oPart_F.PropertySets.Item("Inventor User Defined Properties")
oPartDef_FORM.Parameters.Item("CROWN_RADIUS").Value = c_rad_1
oPartDef_FORM.Parameters.Item("INSIDE_RADIUS").Value = H_RAD_1 
oPartDef_FORM.Parameters.Item("PITCH").Value=PITCH_V 
oPartDef_FORM.Parameters.Item("NUMB_S_HAUNCH").Value=H_RAD_H 
oPartDef_FORM.Parameters.Item("NUMB_S").Value=TOT_S 
oPartDef_FORM.Parameters.Item("DEPTH").Value=DEPTH_V 
oPartDef_FORM.Parameters.Item("CIRC_HOLE_SP").Value=CIR_HOLE_SP_V
oPartDef_FORM.Parameters.Item("FLAT_SPOT").Value=FLAT_SPOT_V
oPartDef_FORM.Parameters.Item("LEG_S").Value=LEG_S_V 
oPartDef_FORM.Parameters.Item("LEG").Value = LEG_LENGTH_V
oPartDef_FORM.Parameters.Item("THICKNESS").Value = THICKNESS_V
For Each oFeat As PartFeature In oPartDef_FORM.Features
	If oFeat.Name.Contains("HAUNCH_SIDE_HOLES") Then
		oFeat.Suppressed = True
	End If
Next

  

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

Message 3 of 5

WCrihfield
Mentor
Mentor
Accepted solution

I don't know what version of Inventor you may have, but this sounds like a good place to use multiple ModelStates in the part with different parameter values & feature suppression statuses in each one, then simply switch which ModelState the view is set to, instead of trying to control all of those different aspects of the model backwards from the drawing.  Just looking at the situation from a different perspective...perhaps without all of the needed design intent knowledge.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 5

tmathieson
Advocate
Advocate

thanks @Andrii_Humeniuk  !!

just what I needed!

works great!  thanks again!

0 Likes
Message 5 of 5

tmathieson
Advocate
Advocate

Morning @WCrihfield .  thanks for the suggestion on model states.  for this particular task, there is only one set of holes that are suppress or not suppressed, so @Andrii_Humeniuk  code works fine in this case.  i have used model states in other projects, but have been bitten by them a couple times as shown in the attached picture. so i've been shying away from them, but still use them, but with caution.

 

thanks, and a have a good one!!