Ilogic and grabbing model value into drawing

Ilogic and grabbing model value into drawing

sreed
Enthusiast Enthusiast
1,445 Views
3 Replies
Message 1 of 4

Ilogic and grabbing model value into drawing

sreed
Enthusiast
Enthusiast

I have some rules setup to grab the Design State of a model to show up on a form in the IDW.  I have attached a drawing and the rules for you to look at.  What I would like to do now is grab the checked by and checked date of the model and have it show up in the .idw and be able to push it back to the model once it gets changed.  I don't know much about rules but am scheduled to get training.  Any help  is very appreciated.

0 Likes
Accepted solutions (1)
1,446 Views
3 Replies
Replies (3)
Message 2 of 4

clutsa
Collaborator
Collaborator

I added the code at the bottom. I commented out the code to push the data to the model (just remove the single quotes and paste it in the other rule.)

Try
    'check For Parameter 
    oTest = Parameter("ModelDesignState") 
Catch
    'create multi-value Text Parameter
    ThisDoc.Document.Parameters.UserParameters.AddByValue _
    ("ModelDesignState", "WorkInProgress", UnitsTypeEnum.kTextUnits)
End Try

'set list
MultiValue.SetList("ModelDesignState", "WorkInProgress", "Pending", "Released")

Dim oDoc As DrawingDocument 
oDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView

oSheet = ActiveSheet.Sheet

oViews = oSheet.DrawingViews

If oViews.Count > 0 Then
	oView = oViews.Item(1)
	oModelName = oView.ReferencedDocumentDescriptor.ReferencedDocument.DisplayName
	
	Dim referDoc As Document
	referDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument
	
	oAssemblyState = referDoc.PropertySets.Item("Design Tracking Properties").Item("Design Status").Value
	If oAssemblyState = 1 Then
		oAssemblyState = "WorkInProgress"
		Else If oAssemblyState = 2 Then
		oAssemblyState = "Pending"
		Else If oAssemblyState = 3 Then
		oAssemblyState = "Released"
	End If
	'MessageBox.Show(oAssemblyState, "Assembly State")

	Parameter("ModelDesignState") = oAssemblyState
	

	'push assy/part to drawing
	iProperties.Value("Design Tracking Properties", "Checked By") = referDoc.PropertySets.Item("Design Tracking Properties").Item("Checked By").Value
	iProperties.Value("Design Tracking Properties", "Date Checked") = referDoc.PropertySets.Item("Design Tracking Properties").Item("Date Checked").Value

'	'push drawing to assy/part
'	referDoc.PropertySets.Item("Design Tracking Properties").Item("Checked By").Value = iProperties.Value("Design Tracking Properties", "Checked By") 
'	referDoc.PropertySets.Item("Design Tracking Properties").Item("Date Checked").Value = iProperties.Value("Design Tracking Properties", "Date Checked")
End If
If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes
Message 3 of 4

sreed
Enthusiast
Enthusiast

I pasted those line at the bottom of my rule and I get a bunch of errors.  See attached .jpg for errors.

0 Likes
Message 4 of 4

clutsa
Collaborator
Collaborator
Accepted solution

Sorry, just the three single quotes at the front.QuickNote.PNG

And you only need to copy those three lines to the new rule that will push data from the drawing to the model. (The first three go in the rule just as shown)

Quick lesson: in VB (visual basic) anything after a ' is ignored by the computer for the rest of that line unless the single quote is inside a double quote "'" (double single double)

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes