Run Rule from Case

Run Rule from Case

Formsprag
Advocate Advocate
377 Views
2 Replies
Message 1 of 3

Run Rule from Case

Formsprag
Advocate
Advocate

I have several rules that need to run depending on if a Workpoint exist in a view.

The rule runs, no errors or anything else; nothing happens! I can run the rules one at the time just fine.

 

'Get Sheet, View, Intent
Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Sheet:1")
Dim FRONT_VIEW = Sheet_1.DrawingViews.ItemByName("FRONT VIEW")

'Standard Housing
Dim WP_S_MP = FRONT_VIEW.GetIntent("2021_2-250008-15-001:1", "WP_S_MP")
'Metric Housing
Dim WP_M_MP = FRONT_VIEW.GetIntent("2021_2-250008-15-M001:1", "WP_M_MP")
'Low Temperature Housing
Dim WP_L_MP = FRONT_VIEW.GetIntent("2021_2-250008-15-L001:1", "WP_L_MP")
'Metric Low Temperature Housing
Dim WP_LM_MP = FRONT_VIEW.GetIntent("2021_2-250008-15-LM001:1", "WP_LM_MP")
	
For Each oPoint As WorkPoint In ThisDoc.ModelDocument.ComponentDefinition.WorkPoints
	
	Select Case oPoint.Name
		
	Case "WP_S_MP"
	iLogicVb.RunRule("Standard_Dimensions_Front_View")
	
	Case "WP_M_MP"
	iLogicVb.RunRule("Metric_Dimensions_Front_View")
		
	Case "WP_L_MP"
	iLogicVb.RunRule("Low_Temperature_Dimensions_Front_View")
	
	Case "WP_LM_MP"
	iLogicVb.RunRule("Metric_Low_Temperature_Dimension_Front_View")	
		
	End Select
	Next
0 Likes
378 Views
2 Replies
Replies (2)
Message 2 of 3

RodrigoEiras
Advocate
Advocate

Good morning,

 

I would say that the reason may be that you may not be getting any workpoints by using:

ThisDoc.ModelDocument.ComponentDefinition.WorkPoints

 Normally I would get a model from a view in the drawing, not directly from the drawing document.

 

Dim oView As DrawingView = ThisDrawing.Sheet("Sheet:1").View("A").View
Dim oAssy As AssemblyDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument

 

I hope this helps.

 

Best regards

 

0 Likes
Message 3 of 3

WCrihfield
Mentor
Mentor

How you're calling out the model document is just fine, that's how I normally to it too.  It's way simpler that way, when you only have one model being represented within the drawing.

I believe the problem is within the GetIntent() function.  If you pay close attention to what that function is asking for within the little tool-tip like message when you hover over the "GetIntent", you will notice several possible input variables.  All but the first are Optional.

 

GetIntent tool-tip.png

 

If one is optional, and you don't want to specify it, but you do want to specify one of the following optional variables, you need to put commas (,) to hold the places of those empty variables, before the one you want to specify.

I'm not sure what you are trying to specify by "WP_S_MP", but the PointIntentEnum value should look something like this "PointIntentEnum.kCenterPointIntent".  That function won't accept the String name of a WorkPoint.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes