Ilogic: Object reference not set to an instance of an object.

Ilogic: Object reference not set to an instance of an object.

sreed
Enthusiast Enthusiast
2,360 Views
5 Replies
Message 1 of 6

Ilogic: Object reference not set to an instance of an object.

sreed
Enthusiast
Enthusiast

I have a form in my .idw that fills in my title block and I have a two rules that reach out to the model so that I can change the design state of the model from the .idw.  I can get this to work in a new drawing but when I open and existing drawing and input the form and rules I get errors when it comes to the design state of the model.

I get and error that the "Object reference not set to an instance of an object."  Can some one help me out?

 

I have attached a .idw and the two rules.

 

Thanks,

Steve

0 Likes
Accepted solutions (1)
2,361 Views
5 Replies
Replies (5)
Message 2 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support

@sreed,

 

 

Try below changes in both iLogic code.

 

Get Reference assembly

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

End If

Push Design State

 

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
	'MessageBox.Show(oModelName, "Assembly Name")
	oNewState = Parameter.Value("ModelDesignState")
	'MessageBox.Show(oNewState, "Model Design State")

	oAssemblyState = Parameter.Value("ModelDesignState")

	If oAssemblyState = "WorkInProgress" Then
		oAssemblyState = 1
		Else If oAssemblyState = "Pending" Then
		oAssemblyState = 2
		Else If oAssemblyState = "Released" Then
		oAssemblyState = 3
	End If
	referDoc.PropertySets.Item("Design Tracking Properties").Item("Design Status").Value = oAssemblyState

	'iProperties.Value(oModelName, "Status", "Design State") = oAssemblyState

End If

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 6

sreed
Enthusiast
Enthusiast

Thank you for the help but I am getting an error now, I have attached the error.  Also I attached a pic of the event triggers I have set up.  Do you think the way I have that setup could be a problem?  The pic of the form show that the update model button will not high light. 

 

Thank you,

 

Steve

0 Likes
Message 4 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support

@sreed,

 

Can you please sample drawing and model to test and video recording to demo on errors? please make sure that files are non confidential.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 5 of 6

sreed
Enthusiast
Enthusiast

I attached a pack and go of something simple I did for myself.   I am noticing I only receive these problems because the rules are external rules.  Any thoughts on this?  I would like to keep them external if possible.

 

Thanks,

Steve

0 Likes
Message 6 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@sreed,

 

Drawing document tested and found that Push Design State.txt rule is missing in external rule. After adding as external rule, deleted existing Update Model and recreated with Push Design State rule. Button is renamed to "Update model".

 

External rule.PNG

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes